Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
timvaillancourt committed Nov 14, 2022
1 parent 1ad5403 commit e3c72e2
Show file tree
Hide file tree
Showing 9 changed files with 647 additions and 30 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ require (
github.com/go-ini/ini v1.62.0
github.com/go-mysql-org/go-mysql v1.3.0
github.com/go-sql-driver/mysql v1.6.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/openark/golib v0.0.0-20210531070646-355f37940af8
github.com/satori/go.uuid v1.2.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467
golang.org/x/text v0.3.6
)

Expand All @@ -21,7 +22,6 @@ require (
github.com/smartystreets/goconvey v1.6.4 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
)
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
Expand Down Expand Up @@ -81,8 +83,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -96,14 +96,10 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
21 changes: 11 additions & 10 deletions go/cmd/gh-ost-localtests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,19 @@ func main() {
}
defer db.Close()

var tests []localtests.Test
if testNoop {
if err = localtests.RunTest(db, cnf, localtests.Test{
Name: "no-op",
}); err != nil {
log.Fatalf("Failed to run no-op test: %+v", err)
tests = []localtests.Test{
{
Name: "noop",
ExtraArgs: `--alter='ENGINE=InnoDB'`,
},
}
} else {
tests, err = localtests.ReadTests(localtestsDir)
if err != nil {
log.Fatalf("Failed to read tests: %+v", err)
}
return
}

tests, err := localtests.ReadTests(localtestsDir)
if err != nil {
log.Fatalf("Failed to read tests: %+v", err)
}

for _, test := range tests {
Expand Down
10 changes: 8 additions & 2 deletions go/localtests/localtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"os/exec"
"path/filepath"
"strings"

"github.com/google/shlex"
)

const (
Expand Down Expand Up @@ -96,7 +98,7 @@ func (test *Test) Migrate(db *sql.DB, config Config) error {
"--initially-drop-old-table",
"--initially-drop-ghost-table",
"--initially-drop-socket-file",
fmt.Sprintf("--throttle-query=%q", throttleQuery),
fmt.Sprintf("--throttle-query=%s", throttleQuery),
fmt.Sprintf("--throttle-flag-file=%s", throttleFlagFile),
fmt.Sprintf("--serve-socket-file=%s", testSocketFile),
//"--test-on-replica",
Expand All @@ -109,7 +111,11 @@ func (test *Test) Migrate(db *sql.DB, config Config) error {
if test.ExtraArgs == "" {
flags = append(flags, "--alter='engine=innodb'")
} else {
flags = append(flags, test.ExtraArgs)
extraArgs, err := shlex.Split(test.ExtraArgs)
if err != nil {
return err
}
flags = append(flags, extraArgs...)
}

log.Printf("[%s] running gh-ost command: %s\n %s", test.Name, config.GhostBinary, strings.Join(flags, "\n "))
Expand Down
9 changes: 1 addition & 8 deletions localtests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
version: "3.6"
services:
localtests:
tests:
build:
context: ../
dockerfile: localtests/Dockerfile
command: "--host primary"
depends_on:
- primary
- replica
links:
- primary
- replica
primary:
image: mysql:${MYSQL_VERSION}
command: "--log-bin --server-id=1 --log-slave-updates"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
expose:
- 3306
volumes:
- "./init.sql:/docker-entrypoint-initdb.d/init.sql:ro"
replica:
image: mysql:${MYSQL_VERSION}
command: "--log-bin --server-id=2 --log-slave-updates --read-only=ON"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
expose:
- 3306
volumes:
- "./init.sql:/docker-entrypoint-initdb.d/init.sql:ro"
202 changes: 202 additions & 0 deletions vendor/github.com/google/shlex/COPYING

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/github.com/google/shlex/README

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e3c72e2

Please sign in to comment.