Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add e2e tests for replication #15671

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions go/test/endtoend/utils/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewMySQL(cluster *cluster.LocalProcessCluster, dbName string, schemaSQL ...
}
sqls = append(sqls, split...)
}
mysqlParam, _, closer, error := NewMySQLWithMysqld(cluster.GetAndReservePort(), cluster.Hostname, dbName, sqls...)
mysqlParam, _, _, closer, error := NewMySQLWithMysqld(cluster.GetAndReservePort(), cluster.Hostname, dbName, sqls...)
return mysqlParam, closer, error
}

Expand All @@ -75,24 +75,24 @@ func CreateMysqldAndMycnf(tabletUID uint32, mysqlSocket string, mysqlPort int) (
return mysqlctl.NewMysqld(&cfg), mycnf, nil
}

func NewMySQLWithMysqld(port int, hostname, dbName string, schemaSQL ...string) (mysql.ConnParams, *mysqlctl.Mysqld, func(), error) {
func NewMySQLWithMysqld(port int, hostname, dbName string, schemaSQL ...string) (mysql.ConnParams, *mysqlctl.Mysqld, *mysqlctl.Mycnf, func(), error) {
mysqlDir, err := createMySQLDir()
if err != nil {
return mysql.ConnParams{}, nil, nil, err
return mysql.ConnParams{}, nil, nil, nil, err
}
initMySQLFile, err := createInitSQLFile(mysqlDir, dbName)
if err != nil {
return mysql.ConnParams{}, nil, nil, err
return mysql.ConnParams{}, nil, nil, nil, err
}

mysqlPort := port
mysqld, mycnf, err := CreateMysqldAndMycnf(0, "", mysqlPort)
if err != nil {
return mysql.ConnParams{}, nil, nil, err
return mysql.ConnParams{}, nil, nil, nil, err
}
err = initMysqld(mysqld, mycnf, initMySQLFile)
if err != nil {
return mysql.ConnParams{}, nil, nil, err
return mysql.ConnParams{}, nil, nil, nil, err
}

params := mysql.ConnParams{
Expand All @@ -104,10 +104,10 @@ func NewMySQLWithMysqld(port int, hostname, dbName string, schemaSQL ...string)
for _, sql := range schemaSQL {
err = prepareMySQLWithSchema(params, sql)
if err != nil {
return mysql.ConnParams{}, nil, nil, err
return mysql.ConnParams{}, nil, nil, nil, err
}
}
return params, mysqld, func() {
return params, mysqld, mycnf, func() {
ctx := context.Background()
_ = mysqld.Teardown(ctx, mycnf, true, mysqlShutdownTimeout)
}, nil
Expand Down
Loading
Loading