Skip to content

Commit bee9195

Browse files
Additional test 2
1 parent e5f7b6b commit bee9195

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

go/base/utils_test.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ func TestValidateConnection(t *testing.T) {
3737
Port: mysql.DefaultInstancePort,
3838
},
3939
}
40-
// check valid port matches on plain mysql
40+
// check valid port matches connectionConfig
4141
{
4242
migrationContext := &MigrationContext{Log: NewDefaultLogger()}
4343
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},
4546
}
4647
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
4748
}
@@ -51,9 +52,7 @@ func TestValidateConnection(t *testing.T) {
5152
Log: NewDefaultLogger(),
5253
AliyunRDS: true,
5354
}
54-
serverInfo := &mysql.ServerInfo{
55-
Port: gosql.NullInt64{Int64: 0, Valid: false},
56-
}
55+
serverInfo := &mysql.ServerInfo{}
5756
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
5857
}
5958
// check NULL port validates when AzureMySQL=true
@@ -62,9 +61,7 @@ func TestValidateConnection(t *testing.T) {
6261
Log: NewDefaultLogger(),
6362
AzureMySQL: true,
6463
}
65-
serverInfo := &mysql.ServerInfo{
66-
Port: gosql.NullInt64{Int64: 0, Valid: false},
67-
}
64+
serverInfo := &mysql.ServerInfo{}
6865
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
6966
}
7067
// check NULL port validates when GoogleCloudPlatform=true
@@ -73,9 +70,7 @@ func TestValidateConnection(t *testing.T) {
7370
Log: NewDefaultLogger(),
7471
GoogleCloudPlatform: true,
7572
}
76-
serverInfo := &mysql.ServerInfo{
77-
Port: gosql.NullInt64{Int64: 0, Valid: false},
78-
}
73+
serverInfo := &mysql.ServerInfo{}
7974
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
8075
}
8176
// check extra_port validates when port=NULL
@@ -86,7 +81,7 @@ func TestValidateConnection(t *testing.T) {
8681
}
8782
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
8883
}
89-
// check validation fails when port does not match connectionConfig
84+
// check validation fails when valid port does not match connectionConfig
9085
{
9186
migrationContext := &MigrationContext{Log: NewDefaultLogger()}
9287
serverInfo := &mysql.ServerInfo{

0 commit comments

Comments
 (0)