Skip to content

Commit e3c72e2

Browse files
WIP
1 parent 1ad5403 commit e3c72e2

File tree

9 files changed

+647
-30
lines changed

9 files changed

+647
-30
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ require (
66
github.com/go-ini/ini v1.62.0
77
github.com/go-mysql-org/go-mysql v1.3.0
88
github.com/go-sql-driver/mysql v1.6.0
9+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
910
github.com/openark/golib v0.0.0-20210531070646-355f37940af8
1011
github.com/satori/go.uuid v1.2.0
11-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
1212
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
13+
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467
1314
golang.org/x/text v0.3.6
1415
)
1516

@@ -21,7 +22,6 @@ require (
2122
github.com/smartystreets/goconvey v1.6.4 // indirect
2223
go.uber.org/atomic v1.7.0 // indirect
2324
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
24-
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
2525
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2626
gopkg.in/ini.v1 v1.62.0 // indirect
2727
)

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
1717
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
1818
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
1919
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
20+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
21+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
2022
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
2123
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
2224
github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
@@ -81,8 +83,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
8183
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
8284
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
8385
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
84-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
85-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
8686
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
8787
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
8888
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -96,14 +96,10 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
9696
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
9797
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
9898
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
99-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10099
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
101-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
102100
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
103101
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
104102
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
105-
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
106-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
107103
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
108104
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM=
109105
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=

go/cmd/gh-ost-localtests/main.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,19 @@ func main() {
5353
}
5454
defer db.Close()
5555

56+
var tests []localtests.Test
5657
if testNoop {
57-
if err = localtests.RunTest(db, cnf, localtests.Test{
58-
Name: "no-op",
59-
}); err != nil {
60-
log.Fatalf("Failed to run no-op test: %+v", err)
58+
tests = []localtests.Test{
59+
{
60+
Name: "noop",
61+
ExtraArgs: `--alter='ENGINE=InnoDB'`,
62+
},
63+
}
64+
} else {
65+
tests, err = localtests.ReadTests(localtestsDir)
66+
if err != nil {
67+
log.Fatalf("Failed to read tests: %+v", err)
6168
}
62-
return
63-
}
64-
65-
tests, err := localtests.ReadTests(localtestsDir)
66-
if err != nil {
67-
log.Fatalf("Failed to read tests: %+v", err)
6869
}
6970

7071
for _, test := range tests {

go/localtests/localtests.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"os/exec"
1010
"path/filepath"
1111
"strings"
12+
13+
"github.com/google/shlex"
1214
)
1315

1416
const (
@@ -96,7 +98,7 @@ func (test *Test) Migrate(db *sql.DB, config Config) error {
9698
"--initially-drop-old-table",
9799
"--initially-drop-ghost-table",
98100
"--initially-drop-socket-file",
99-
fmt.Sprintf("--throttle-query=%q", throttleQuery),
101+
fmt.Sprintf("--throttle-query=%s", throttleQuery),
100102
fmt.Sprintf("--throttle-flag-file=%s", throttleFlagFile),
101103
fmt.Sprintf("--serve-socket-file=%s", testSocketFile),
102104
//"--test-on-replica",
@@ -109,7 +111,11 @@ func (test *Test) Migrate(db *sql.DB, config Config) error {
109111
if test.ExtraArgs == "" {
110112
flags = append(flags, "--alter='engine=innodb'")
111113
} else {
112-
flags = append(flags, test.ExtraArgs)
114+
extraArgs, err := shlex.Split(test.ExtraArgs)
115+
if err != nil {
116+
return err
117+
}
118+
flags = append(flags, extraArgs...)
113119
}
114120

115121
log.Printf("[%s] running gh-ost command: %s\n %s", test.Name, config.GhostBinary, strings.Join(flags, "\n "))

localtests/docker-compose.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
version: "3.6"
22
services:
3-
localtests:
3+
tests:
44
build:
55
context: ../
66
dockerfile: localtests/Dockerfile
77
command: "--host primary"
88
depends_on:
99
- primary
1010
- replica
11-
links:
12-
- primary
13-
- replica
1411
primary:
1512
image: mysql:${MYSQL_VERSION}
1613
command: "--log-bin --server-id=1 --log-slave-updates"
1714
environment:
1815
MYSQL_ALLOW_EMPTY_PASSWORD: true
19-
expose:
20-
- 3306
2116
volumes:
2217
- "./init.sql:/docker-entrypoint-initdb.d/init.sql:ro"
2318
replica:
2419
image: mysql:${MYSQL_VERSION}
2520
command: "--log-bin --server-id=2 --log-slave-updates --read-only=ON"
2621
environment:
2722
MYSQL_ALLOW_EMPTY_PASSWORD: true
28-
expose:
29-
- 3306
3023
volumes:
3124
- "./init.sql:/docker-entrypoint-initdb.d/init.sql:ro"

vendor/github.com/google/shlex/COPYING

Lines changed: 202 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/shlex/README

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)