@@ -19,7 +19,7 @@ import (
1919
2020const (
2121 testSSHPort = int64 (22 )
22- testDockerPort = int64 (2376 )
22+ testDockerPort = int64 (12345 )
2323 testSwarmPort = int64 (3376 )
2424)
2525
3232)
3333
3434func TestConfigureSecurityGroupPermissionsEmpty (t * testing.T ) {
35- driver := NewTestDriver ()
35+ driver := NewTestDriver (int ( testDockerPort ) )
3636
3737 perms , err := driver .configureSecurityGroupPermissions (securityGroup )
3838
@@ -41,7 +41,7 @@ func TestConfigureSecurityGroupPermissionsEmpty(t *testing.T) {
4141}
4242
4343func TestConfigureSecurityGroupPermissionsSshOnly (t * testing.T ) {
44- driver := NewTestDriver ()
44+ driver := NewTestDriver (int ( testDockerPort ) )
4545 group := securityGroup
4646 group .IpPermissions = []* ec2.IpPermission {
4747 {
@@ -59,7 +59,7 @@ func TestConfigureSecurityGroupPermissionsSshOnly(t *testing.T) {
5959}
6060
6161func TestConfigureSecurityGroupPermissionsDockerOnly (t * testing.T ) {
62- driver := NewTestDriver ()
62+ driver := NewTestDriver (int ( testDockerPort ) )
6363 group := securityGroup
6464 group .IpPermissions = []* ec2.IpPermission {
6565 {
@@ -77,7 +77,7 @@ func TestConfigureSecurityGroupPermissionsDockerOnly(t *testing.T) {
7777}
7878
7979func TestConfigureSecurityGroupPermissionsDockerAndSsh (t * testing.T ) {
80- driver := NewTestDriver ()
80+ driver := NewTestDriver (int ( testDockerPort ) )
8181 group := securityGroup
8282 group .IpPermissions = []* ec2.IpPermission {
8383 {
@@ -99,7 +99,7 @@ func TestConfigureSecurityGroupPermissionsDockerAndSsh(t *testing.T) {
9999}
100100
101101func TestConfigureSecurityGroupPermissionsOpenPorts (t * testing.T ) {
102- driver := NewTestDriver ()
102+ driver := NewTestDriver (int ( testDockerPort ) )
103103 driver .OpenPorts = []string {"8888/tcp" , "8080/udp" , "9090" }
104104 perms , err := driver .configureSecurityGroupPermissions (& ec2.SecurityGroup {})
105105
@@ -114,7 +114,7 @@ func TestConfigureSecurityGroupPermissionsOpenPorts(t *testing.T) {
114114}
115115
116116func TestConfigureSecurityGroupPermissionsOpenPortsSkipExisting (t * testing.T ) {
117- driver := NewTestDriver ()
117+ driver := NewTestDriver (int ( testDockerPort ) )
118118 group := securityGroup
119119 group .IpPermissions = []* ec2.IpPermission {
120120 {
@@ -137,7 +137,7 @@ func TestConfigureSecurityGroupPermissionsOpenPortsSkipExisting(t *testing.T) {
137137}
138138
139139func TestConfigureSecurityGroupPermissionsInvalidOpenPorts (t * testing.T ) {
140- driver := NewTestDriver ()
140+ driver := NewTestDriver (int ( testDockerPort ) )
141141 driver .OpenPorts = []string {"2222/tcp" , "abc1" }
142142 perms , err := driver .configureSecurityGroupPermissions (& ec2.SecurityGroup {})
143143
@@ -146,7 +146,7 @@ func TestConfigureSecurityGroupPermissionsInvalidOpenPorts(t *testing.T) {
146146}
147147
148148func TestConfigureSecurityGroupPermissionsWithSwarm (t * testing.T ) {
149- driver := NewTestDriver ()
149+ driver := NewTestDriver (int ( testDockerPort ) )
150150 driver .SwarmMaster = true
151151 group := securityGroup
152152 group .IpPermissions = []* ec2.IpPermission {
@@ -219,7 +219,7 @@ func TestDefaultVPCIsMissing(t *testing.T) {
219219}
220220
221221func TestGetRegionZoneForDefaultEndpoint (t * testing.T ) {
222- driver := NewCustomTestDriver (& fakeEC2WithLogin {})
222+ driver := NewCustomTestDriver (int ( testDockerPort ), & fakeEC2WithLogin {})
223223 driver .awsCredentialsFactory = NewValidAwsCredentials
224224 options := & commandstest.FakeFlagger {
225225 Data : map [string ]interface {}{
@@ -238,7 +238,7 @@ func TestGetRegionZoneForDefaultEndpoint(t *testing.T) {
238238}
239239
240240func TestGetRegionZoneForCustomEndpoint (t * testing.T ) {
241- driver := NewCustomTestDriver (& fakeEC2WithLogin {})
241+ driver := NewCustomTestDriver (int ( testDockerPort ), & fakeEC2WithLogin {})
242242 driver .awsCredentialsFactory = NewValidAwsCredentials
243243 options := & commandstest.FakeFlagger {
244244 Data : map [string ]interface {}{
@@ -272,7 +272,7 @@ func TestDescribeAccountAttributeFails(t *testing.T) {
272272}
273273
274274func TestAwsCredentialsAreRequired (t * testing.T ) {
275- driver := NewTestDriver ()
275+ driver := NewTestDriver (int ( testDockerPort ) )
276276 driver .awsCredentialsFactory = NewErrorAwsCredentials
277277
278278 options := & commandstest.FakeFlagger {
@@ -288,7 +288,7 @@ func TestAwsCredentialsAreRequired(t *testing.T) {
288288}
289289
290290func TestValidAwsCredentialsAreAccepted (t * testing.T ) {
291- driver := NewCustomTestDriver (& fakeEC2WithLogin {})
291+ driver := NewCustomTestDriver (int ( testDockerPort ), & fakeEC2WithLogin {})
292292 driver .awsCredentialsFactory = NewValidAwsCredentials
293293 options := & commandstest.FakeFlagger {
294294 Data : map [string ]interface {}{
@@ -303,7 +303,7 @@ func TestValidAwsCredentialsAreAccepted(t *testing.T) {
303303}
304304
305305func TestEndpointIsMandatoryWhenSSLDisabled (t * testing.T ) {
306- driver := NewTestDriver ()
306+ driver := NewTestDriver (int ( testDockerPort ) )
307307 driver .awsCredentialsFactory = NewValidAwsCredentials
308308 options := & commandstest.FakeFlagger {
309309 Data : map [string ]interface {}{
@@ -402,7 +402,7 @@ func ipPermission(port int64) *ec2.IpPermission {
402402func TestConfigureSecurityGroupsEmpty (t * testing.T ) {
403403 recorder := fakeEC2SecurityGroupTestRecorder {}
404404
405- driver := NewCustomTestDriver (& recorder )
405+ driver := NewCustomTestDriver (int ( testDockerPort ), & recorder )
406406 err := driver .configureSecurityGroups ([]string {})
407407
408408 assert .Nil (t , err )
@@ -457,7 +457,7 @@ func TestConfigureSecurityGroupsMixed(t *testing.T) {
457457 }).Return (
458458 & ec2.AuthorizeSecurityGroupIngressOutput {}, nil )
459459
460- driver := NewCustomTestDriver (& recorder )
460+ driver := NewCustomTestDriver (int ( testDockerPort ), & recorder )
461461 err := driver .configureSecurityGroups (groups )
462462
463463 assert .Nil (t , err )
@@ -472,15 +472,15 @@ func TestConfigureSecurityGroupsErrLookupExist(t *testing.T) {
472472 recorder .On ("DescribeSecurityGroups" , mock .MatchedBy (matchGroupLookup (groups ))).Return (
473473 nil , lookupExistErr )
474474
475- driver := NewCustomTestDriver (& recorder )
475+ driver := NewCustomTestDriver (int ( testDockerPort ), & recorder )
476476 err := driver .configureSecurityGroups (groups )
477477
478478 assert .Exactly (t , lookupExistErr , err )
479479 recorder .AssertExpectations (t )
480480}
481481
482482func TestBase64UserDataIsEmptyIfNoFileProvided (t * testing.T ) {
483- driver := NewTestDriver ()
483+ driver := NewTestDriver (int ( testDockerPort ) )
484484
485485 userdata , err := driver .Base64UserData ()
486486
@@ -495,7 +495,7 @@ func TestBase64UserDataGeneratesErrorIfFileNotFound(t *testing.T) {
495495 defer os .RemoveAll (dir )
496496 userdata_path := filepath .Join (dir , "does-not-exist.yml" )
497497
498- driver := NewTestDriver ()
498+ driver := NewTestDriver (int ( testDockerPort ) )
499499 driver .UserDataFile = userdata_path
500500
501501 _ , ud_err := driver .Base64UserData ()
@@ -516,7 +516,7 @@ func TestBase64UserDataIsCorrectWhenFileProvided(t *testing.T) {
516516 err = ioutil .WriteFile (userdata_path , content , 0666 )
517517 assert .NoError (t , err , "Unable to create temporary userdata file." )
518518
519- driver := NewTestDriver ()
519+ driver := NewTestDriver (int ( testDockerPort ) )
520520 driver .UserDataFile = userdata_path
521521
522522 userdata , ud_err := driver .Base64UserData ()
0 commit comments