@@ -37,11 +37,12 @@ func TestValidateConnection(t *testing.T) {
37
37
Port : mysql .DefaultInstancePort ,
38
38
},
39
39
}
40
- // check valid port matches on plain mysql
40
+ // check valid port matches connectionConfig
41
41
{
42
42
migrationContext := & MigrationContext {Log : NewDefaultLogger ()}
43
43
serverInfo := & mysql.ServerInfo {
44
- Port : gosql.NullInt64 {Int64 : mysql .DefaultInstancePort , Valid : true },
44
+ Port : gosql.NullInt64 {Int64 : mysql .DefaultInstancePort , Valid : true },
45
+ ExtraPort : gosql.NullInt64 {Int64 : mysql .DefaultInstancePort + 1 , Valid : true },
45
46
}
46
47
test .S (t ).ExpectNil (ValidateConnection (serverInfo , connectionConfig , migrationContext , "test" ))
47
48
}
@@ -51,9 +52,7 @@ func TestValidateConnection(t *testing.T) {
51
52
Log : NewDefaultLogger (),
52
53
AliyunRDS : true ,
53
54
}
54
- serverInfo := & mysql.ServerInfo {
55
- Port : gosql.NullInt64 {Int64 : 0 , Valid : false },
56
- }
55
+ serverInfo := & mysql.ServerInfo {}
57
56
test .S (t ).ExpectNil (ValidateConnection (serverInfo , connectionConfig , migrationContext , "test" ))
58
57
}
59
58
// check NULL port validates when AzureMySQL=true
@@ -62,9 +61,7 @@ func TestValidateConnection(t *testing.T) {
62
61
Log : NewDefaultLogger (),
63
62
AzureMySQL : true ,
64
63
}
65
- serverInfo := & mysql.ServerInfo {
66
- Port : gosql.NullInt64 {Int64 : 0 , Valid : false },
67
- }
64
+ serverInfo := & mysql.ServerInfo {}
68
65
test .S (t ).ExpectNil (ValidateConnection (serverInfo , connectionConfig , migrationContext , "test" ))
69
66
}
70
67
// check NULL port validates when GoogleCloudPlatform=true
@@ -73,9 +70,7 @@ func TestValidateConnection(t *testing.T) {
73
70
Log : NewDefaultLogger (),
74
71
GoogleCloudPlatform : true ,
75
72
}
76
- serverInfo := & mysql.ServerInfo {
77
- Port : gosql.NullInt64 {Int64 : 0 , Valid : false },
78
- }
73
+ serverInfo := & mysql.ServerInfo {}
79
74
test .S (t ).ExpectNil (ValidateConnection (serverInfo , connectionConfig , migrationContext , "test" ))
80
75
}
81
76
// check extra_port validates when port=NULL
@@ -86,7 +81,7 @@ func TestValidateConnection(t *testing.T) {
86
81
}
87
82
test .S (t ).ExpectNil (ValidateConnection (serverInfo , connectionConfig , migrationContext , "test" ))
88
83
}
89
- // check validation fails when port does not match connectionConfig
84
+ // check validation fails when valid port does not match connectionConfig
90
85
{
91
86
migrationContext := & MigrationContext {Log : NewDefaultLogger ()}
92
87
serverInfo := & mysql.ServerInfo {
0 commit comments