зеркало из https://github.com/github/vitess-gh.git
test.go: Add tags for grouping tests.
The Makefile previously listed tests explicitly for groups like site_test and worker_test. These lists got out of date when tests were removed from test/config.json, and the make rules broke. Now the groups are defined in config.json itself, so there is one place to update everything.
This commit is contained in:
Родитель
5895f58345
Коммит
a05f48ba42
4
Makefile
4
Makefile
|
@ -74,10 +74,10 @@ SHELL = /bin/bash
|
|||
# Run the following tests after making worker changes.
|
||||
worker_test:
|
||||
godep go test ./go/vt/worker/
|
||||
go run test.go -docker=false binlog resharding resharding_bytes vertical_split initial_sharding initial_sharding_bytes worker
|
||||
go run test.go -docker=false -tag=worker_test
|
||||
|
||||
site_integration_test:
|
||||
go run test.go -docker=false keyrange keyspace mysqlctl tabletmanager vtdb vtgatev2
|
||||
go run test.go -docker=false -tag=site_test
|
||||
|
||||
java_test:
|
||||
godep go install ./go/cmd/vtgateclienttest
|
||||
|
|
36
test.go
36
test.go
|
@ -71,6 +71,7 @@ var (
|
|||
pull = flag.Bool("pull", true, "re-pull the bootstrap image, in case it's been updated")
|
||||
docker = flag.Bool("docker", true, "run tests with Docker")
|
||||
shard = flag.Int("shard", -1, "if N>=0, run the tests whose Shard field matches N")
|
||||
tag = flag.String("tag", "", "if provided, only run tests with the given tag. Can't be combined with -shard or explicit test list")
|
||||
reshard = flag.Int("rebalance", 0, "if N>0, check the stats and group tests into N similarly-sized bins by average run time")
|
||||
keepData = flag.Bool("keep-data", false, "don't delete the per-test VTDATAROOT subfolders")
|
||||
printLog = flag.Bool("print-log", false, "print the log of each failed test (or all tests if -log-pass) to the console")
|
||||
|
@ -106,15 +107,28 @@ type Test struct {
|
|||
// Shard is used to split tests among workers.
|
||||
Shard int
|
||||
|
||||
// Maximum number of times a test will be retried. If 0, flag *retryMax is used.
|
||||
// RetryMax is the maximum number of times a test will be retried.
|
||||
// If 0, flag *retryMax is used.
|
||||
RetryMax int
|
||||
|
||||
// Tags is a list of tags that can be used to filter tests.
|
||||
Tags []string
|
||||
|
||||
name string
|
||||
runIndex int
|
||||
|
||||
pass, fail int
|
||||
}
|
||||
|
||||
func (t *Test) hasTag(want string) bool {
|
||||
for _, got := range t.Tags {
|
||||
if got == want {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// run executes a single try.
|
||||
// dir is the location of the vitess repo to use.
|
||||
// dataDir is the VTDATAROOT to use for this run.
|
||||
|
@ -197,10 +211,15 @@ func main() {
|
|||
}
|
||||
flag.Parse()
|
||||
|
||||
outDirBaseName := "local"
|
||||
if *docker {
|
||||
outDirBaseName = *flavor
|
||||
}
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
// Make output directory.
|
||||
outDir := path.Join("_test", fmt.Sprintf("%v.%v.%v", *flavor, startTime.Format("20060102-150405"), os.Getpid()))
|
||||
outDir := path.Join("_test", fmt.Sprintf("%v.%v.%v", outDirBaseName, startTime.Format("20060102-150405"), os.Getpid()))
|
||||
if err := os.MkdirAll(outDir, os.FileMode(0755)); err != nil {
|
||||
log.Fatalf("Can't create output directory: %v", err)
|
||||
}
|
||||
|
@ -622,6 +641,15 @@ firstPass:
|
|||
continue
|
||||
}
|
||||
ct.Shard = i
|
||||
if ct.Args == nil {
|
||||
ct.Args = []string{}
|
||||
}
|
||||
if ct.Command == nil {
|
||||
ct.Command = []string{}
|
||||
}
|
||||
if ct.Tags == nil {
|
||||
ct.Tags = []string{}
|
||||
}
|
||||
log.Printf("% 32v:\t%v\n", t.name, t.PassTime)
|
||||
}
|
||||
log.Printf("Shard %v total: %v\n", i, time.Duration(sums[i]))
|
||||
|
@ -675,8 +703,8 @@ func selectedTests(args []string, config *Config) []*Test {
|
|||
if len(args) == 0 && *shard < 0 {
|
||||
// Run all tests.
|
||||
var names []string
|
||||
for name := range config.Tests {
|
||||
if !config.Tests[name].Manual {
|
||||
for name, t := range config.Tests {
|
||||
if !t.Manual && (*tag == "" || t.hasTag(*tag)) {
|
||||
names = append(names, name)
|
||||
}
|
||||
}
|
||||
|
|
150
test/config.json
150
test/config.json
|
@ -6,7 +6,8 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"backup": {
|
||||
"File": "backup.py",
|
||||
|
@ -14,15 +15,19 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"binlog": {
|
||||
"File": "binlog.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 0,
|
||||
"RetryMax": 0
|
||||
"Shard": 4,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"custom_sharding": {
|
||||
"File": "custom_sharding.py",
|
||||
|
@ -30,7 +35,8 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"goveralls": {
|
||||
"File": "",
|
||||
|
@ -40,7 +46,8 @@
|
|||
],
|
||||
"Manual": true,
|
||||
"Shard": 0,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"initial_sharding": {
|
||||
"File": "initial_sharding.py",
|
||||
|
@ -48,7 +55,10 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 2,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"initial_sharding_bytes": {
|
||||
"File": "initial_sharding_bytes.py",
|
||||
|
@ -56,7 +66,10 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 3,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"java": {
|
||||
"File": "",
|
||||
|
@ -66,16 +79,20 @@
|
|||
"java_test"
|
||||
],
|
||||
"Manual": false,
|
||||
"Shard": 2,
|
||||
"RetryMax": 0
|
||||
"Shard": 1,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"keyrange": {
|
||||
"File": "keyrange_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"Shard": 3,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"site_test"
|
||||
]
|
||||
},
|
||||
"keyspace": {
|
||||
"File": "keyspace_test.py",
|
||||
|
@ -83,7 +100,10 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"site_test"
|
||||
]
|
||||
},
|
||||
"mysqlctl": {
|
||||
"File": "mysqlctl.py",
|
||||
|
@ -91,7 +111,10 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"site_test"
|
||||
]
|
||||
},
|
||||
"php": {
|
||||
"File": "",
|
||||
|
@ -101,16 +124,18 @@
|
|||
"php_test"
|
||||
],
|
||||
"Manual": false,
|
||||
"Shard": 3,
|
||||
"RetryMax": 0
|
||||
"Shard": 4,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"python_client": {
|
||||
"File": "python_client_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 0,
|
||||
"RetryMax": 0
|
||||
"Shard": 2,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"reparent": {
|
||||
"File": "reparent.py",
|
||||
|
@ -118,7 +143,8 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"resharding": {
|
||||
"File": "resharding.py",
|
||||
|
@ -126,15 +152,21 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 2,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"resharding_bytes": {
|
||||
"File": "resharding_bytes.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 3,
|
||||
"RetryMax": 0
|
||||
"Shard": 2,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"rowcache_invalidator": {
|
||||
"File": "rowcache_invalidator.py",
|
||||
|
@ -142,7 +174,8 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"schema": {
|
||||
"File": "schema.py",
|
||||
|
@ -150,39 +183,46 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"secure": {
|
||||
"File": "secure.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 2,
|
||||
"RetryMax": 0
|
||||
"Shard": 4,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"sharded": {
|
||||
"File": "sharded.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"Shard": 0,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"sql_builder": {
|
||||
"File": "sql_builder_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"Shard": 2,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"tabletmanager": {
|
||||
"File": "tabletmanager.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"Shard": 3,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"site_test"
|
||||
]
|
||||
},
|
||||
"unit": {
|
||||
"File": "",
|
||||
|
@ -192,7 +232,8 @@
|
|||
],
|
||||
"Manual": false,
|
||||
"Shard": 0,
|
||||
"RetryMax": 1
|
||||
"RetryMax": 1,
|
||||
"Tags": []
|
||||
},
|
||||
"unit_race": {
|
||||
"File": "",
|
||||
|
@ -203,7 +244,8 @@
|
|||
],
|
||||
"Manual": false,
|
||||
"Shard": 3,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"update_stream": {
|
||||
"File": "update_stream.py",
|
||||
|
@ -211,15 +253,19 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"vertical_split": {
|
||||
"File": "vertical_split.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"Shard": 3,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
},
|
||||
"vtctld": {
|
||||
"File": "vtctld_test.py",
|
||||
|
@ -227,15 +273,17 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"vtgate_utils": {
|
||||
"File": "vtgate_utils_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"Shard": 3,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"vtgatev2": {
|
||||
"File": "vtgatev2_test.py",
|
||||
|
@ -243,31 +291,39 @@
|
|||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"site_test"
|
||||
]
|
||||
},
|
||||
"vtgatev3": {
|
||||
"File": "vtgatev3_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 3,
|
||||
"RetryMax": 0
|
||||
"Shard": 4,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"vttest_sample": {
|
||||
"File": "vttest_sample_test.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 4,
|
||||
"RetryMax": 0
|
||||
"Shard": 1,
|
||||
"RetryMax": 0,
|
||||
"Tags": []
|
||||
},
|
||||
"worker": {
|
||||
"File": "worker.py",
|
||||
"Args": [],
|
||||
"Command": [],
|
||||
"Manual": false,
|
||||
"Shard": 1,
|
||||
"RetryMax": 0
|
||||
"Shard": 3,
|
||||
"RetryMax": 0,
|
||||
"Tags": [
|
||||
"worker_test"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче