@@ -29,13 +29,15 @@ func templ(tpl string) *template.Template {
2929func TestValidate (t * testing.T ) {
3030 ctrl := gomock .NewController (t )
3131 defer ctrl .Finish ()
32+ managerStop := make (chan struct {})
33+ workerStop := make (chan struct {})
3234
3335 managerFlavor := NewManagerFlavor (func (Spec ) (docker_client.APIClient , error ) {
3436 return mock_client .NewMockAPIClient (ctrl ), nil
35- }, templ (DefaultManagerInitScriptTemplate ))
37+ }, templ (DefaultManagerInitScriptTemplate ), managerStop )
3638 workerFlavor := NewWorkerFlavor (func (Spec ) (docker_client.APIClient , error ) {
3739 return mock_client .NewMockAPIClient (ctrl ), nil
38- }, templ (DefaultWorkerInitScriptTemplate ))
40+ }, templ (DefaultWorkerInitScriptTemplate ), workerStop )
3941
4042 require .NoError (t , workerFlavor .Validate (
4143 types .AnyString (`{"Docker" : {"Host":"unix:///var/run/docker.sock"}}` ),
@@ -75,17 +77,22 @@ func TestValidate(t *testing.T) {
7577 group_types.AllocationMethod {LogicalIDs : []instance.LogicalID {"127.0.0.1" }})
7678 require .Error (t , err )
7779 require .Equal (t , "Invalid attachment Type 'keyboard', only ebs is supported" , err .Error ())
80+
81+ close (managerStop )
82+ close (workerStop )
7883}
7984
8085func TestWorker (t * testing.T ) {
8186 ctrl := gomock .NewController (t )
8287 defer ctrl .Finish ()
8388
89+ workerStop := make (chan struct {})
90+
8491 client := mock_client .NewMockAPIClient (ctrl )
8592
8693 flavorImpl := NewWorkerFlavor (func (Spec ) (docker_client.APIClient , error ) {
8794 return client , nil
88- }, templ (DefaultWorkerInitScriptTemplate ))
95+ }, templ (DefaultWorkerInitScriptTemplate ), workerStop )
8996
9097 swarmInfo := swarm.Swarm {
9198 ClusterInfo : swarm.ClusterInfo {ID : "ClusterUUID" },
@@ -137,6 +144,8 @@ func TestWorker(t *testing.T) {
137144 instance.Description {Tags : map [string ]string {associationTag : associationID }})
138145 require .NoError (t , err )
139146 require .Equal (t , flavor .Healthy , health )
147+
148+ close (workerStop )
140149}
141150
142151const nodeID = "my-node-id"
@@ -147,11 +156,13 @@ func TestManager(t *testing.T) {
147156 ctrl := gomock .NewController (t )
148157 defer ctrl .Finish ()
149158
159+ managerStop := make (chan struct {})
160+
150161 client := mock_client .NewMockAPIClient (ctrl )
151162
152163 flavorImpl := NewManagerFlavor (func (Spec ) (docker_client.APIClient , error ) {
153164 return client , nil
154- }, templ (DefaultManagerInitScriptTemplate ))
165+ }, templ (DefaultManagerInitScriptTemplate ), managerStop )
155166
156167 swarmInfo := swarm.Swarm {
157168 ClusterInfo : swarm.ClusterInfo {ID : "ClusterUUID" },
@@ -214,4 +225,6 @@ func TestManager(t *testing.T) {
214225 instance.Description {Tags : map [string ]string {associationTag : associationID }})
215226 require .NoError (t , err )
216227 require .Equal (t , flavor .Healthy , health )
228+
229+ close (managerStop )
217230}
0 commit comments