Skip to content

Commit 23181e7

Browse files
Cleanup
1 parent a578991 commit 23181e7

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

go/localtests/test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (test *Test) Migrate(config Config, primary, replica *sql.DB) (err error) {
127127
cmd.Stdout = &output
128128

129129
if err = cmd.Run(); err != nil {
130-
if isExpectedFailureOutput(stderr, test.ExpectedFailure) {
130+
if isExpectedFailureOutput(&stderr, test.ExpectedFailure) {
131131
return nil
132132
}
133133
output.Write(stderr.Bytes())
@@ -136,9 +136,11 @@ func (test *Test) Migrate(config Config, primary, replica *sql.DB) (err error) {
136136
return err
137137
}
138138

139+
/*
139140
func getPrimaryOrUniqueKey(db *sql.DB, database, table string) (string, error) {
140141
return "id", nil // TODO: fix this
141142
}
143+
*/
142144

143145
// Validate performs a validation of the migration test results.
144146
func (test *Test) Validate(config Config, primary, replica *sql.DB) error {

go/localtests/utils.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func getMysqlHostInfo(db *sql.DB) (*MysqlInfo, error) {
7373
return &info, err
7474
}
7575

76-
func isExpectedFailureOutput(output bytes.Buffer, expectedFailure string) bool {
77-
scanner := bufio.NewScanner(&output)
76+
func isExpectedFailureOutput(output io.Reader, expectedFailure string) bool {
77+
scanner := bufio.NewScanner(output)
7878
for scanner.Scan() {
7979
if !strings.Contains(scanner.Text(), "FATAL") {
8080
continue
@@ -109,7 +109,10 @@ func pingAndGetGTIDExecuted(db *sql.DB, timeout time.Duration) (*mysql.UUIDSet,
109109

110110
func readTestFile(file string) (string, error) {
111111
bytes, err := ioutil.ReadFile(file)
112-
return strings.TrimSpace(string(bytes)), err
112+
if err != nil {
113+
return "", err
114+
}
115+
return strings.TrimSpace(string(bytes)), nil
113116
}
114117

115118
func setDBGlobalSqlMode(db *sql.DB, sqlMode string) (err error) {

localtests/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ services:
1010
- "replica"
1111
primary:
1212
image: ${TEST_DOCKER_IMAGE}
13-
command: "--enforce-gtid-consistency --gtid-mode=ON --event-scheduler=ON --log-bin --log-slave-updates --server-id=1"
13+
command: "--bind-address=0.0.0.0 --enforce-gtid-consistency --gtid-mode=ON --event-scheduler=ON --log-bin --log-slave-updates --server-id=1"
1414
env_file: "mysql.env"
1515
volumes:
1616
- "./init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro"
1717
replica:
1818
image: ${TEST_DOCKER_IMAGE}
19-
command: "--enforce-gtid-consistency --gtid-mode=ON --log-bin --log-slave-updates --read-only=ON --server-id=2"
19+
command: "--bind-address=0.0.0.0 --enforce-gtid-consistency --gtid-mode=ON --log-bin --log-slave-updates --read-only=ON --server-id=2"
2020
env_file: "mysql.env"
2121
depends_on:
2222
- "primary"

localtests/init.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
CREATE DATABASE IF NOT EXISTS `test`;
22

3-
GRANT ALL ON *.* TO `gh-ost`@`%` IDENTIFIED BY 'gh-ost';
3+
CREATE USER IF NOT EXISTS `gh-ost`@`%`;
4+
SET PASSWORD FOR `gh-ost`@`%` = PASSWORD('gh-ost');
5+
GRANT ALL ON *.* TO `gh-ost`@`%`;

0 commit comments

Comments
 (0)