Skip to content

Commit

Permalink
Additional test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
timvaillancourt committed Dec 13, 2022
1 parent e5f7b6b commit bee9195
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions go/base/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ func TestValidateConnection(t *testing.T) {
Port: mysql.DefaultInstancePort,
},
}
// check valid port matches on plain mysql
// check valid port matches connectionConfig
{
migrationContext := &MigrationContext{Log: NewDefaultLogger()}
serverInfo := &mysql.ServerInfo{
Port: gosql.NullInt64{Int64: mysql.DefaultInstancePort, Valid: true},
Port: gosql.NullInt64{Int64: mysql.DefaultInstancePort, Valid: true},
ExtraPort: gosql.NullInt64{Int64: mysql.DefaultInstancePort + 1, Valid: true},
}
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
}
Expand All @@ -51,9 +52,7 @@ func TestValidateConnection(t *testing.T) {
Log: NewDefaultLogger(),
AliyunRDS: true,
}
serverInfo := &mysql.ServerInfo{
Port: gosql.NullInt64{Int64: 0, Valid: false},
}
serverInfo := &mysql.ServerInfo{}
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
}
// check NULL port validates when AzureMySQL=true
Expand All @@ -62,9 +61,7 @@ func TestValidateConnection(t *testing.T) {
Log: NewDefaultLogger(),
AzureMySQL: true,
}
serverInfo := &mysql.ServerInfo{
Port: gosql.NullInt64{Int64: 0, Valid: false},
}
serverInfo := &mysql.ServerInfo{}
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
}
// check NULL port validates when GoogleCloudPlatform=true
Expand All @@ -73,9 +70,7 @@ func TestValidateConnection(t *testing.T) {
Log: NewDefaultLogger(),
GoogleCloudPlatform: true,
}
serverInfo := &mysql.ServerInfo{
Port: gosql.NullInt64{Int64: 0, Valid: false},
}
serverInfo := &mysql.ServerInfo{}
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
}
// check extra_port validates when port=NULL
Expand All @@ -86,7 +81,7 @@ func TestValidateConnection(t *testing.T) {
}
test.S(t).ExpectNil(ValidateConnection(serverInfo, connectionConfig, migrationContext, "test"))
}
// check validation fails when port does not match connectionConfig
// check validation fails when valid port does not match connectionConfig
{
migrationContext := &MigrationContext{Log: NewDefaultLogger()}
serverInfo := &mysql.ServerInfo{
Expand Down

0 comments on commit bee9195

Please sign in to comment.