Skip to content

Commit

Permalink
roachtest: move all tests to tests/
Browse files Browse the repository at this point in the history
This was pure drag-and-drop via Goland, with the exception of

- changing the `go:generate` in `drt.go` to specify the `tests` package
  instead of `main`,
- a matching adjustment to `build/bazelutil/check.sh` (:science-dog:),
- `make bazel-generate`,
- massaging some lint exception rules (for which the filename had
  changed due to the move), and
- removing some `lib/pq` imports that Golint took offense with (blank
  imports from libraries).

Release note: None
  • Loading branch information
tbg committed Jul 7, 2021
1 parent fa73ec7 commit fbfcded
Show file tree
Hide file tree
Showing 128 changed files with 367 additions and 386 deletions.
2 changes: 1 addition & 1 deletion build/bazelutil/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pkg/kv/kvclient/rangecache/range_cache.go://go:generate mockgen -package=rangeca
pkg/kv/kvclient/rangefeed/rangefeed.go://go:generate mockgen -package=rangefeed -source rangefeed.go -destination=mocks_generated.go .
pkg/kv/kvclient/kvcoord/transport.go://go:generate mockgen -package=kvcoord -destination=mocks_generated.go . Transport
pkg/roachpb/api.go://go:generate mockgen -package=roachpb -destination=mocks_generated.go . InternalClient,Internal_RangeFeedClient
pkg/cmd/roachtest/drt.go://go:generate mockgen -source drt.go -package main -destination drt_generated.go
pkg/cmd/roachtest/tests/drt.go://go:generate mockgen -source drt.go -package tests -destination drt_generated.go
pkg/security/securitytest/securitytest.go://go:generate go-bindata -mode 0600 -modtime 1400000000 -pkg securitytest -o embedded.go -ignore README.md -ignore regenerate.sh test_certs
pkg/security/securitytest/securitytest.go://go:generate gofmt -s -w embedded.go
pkg/security/securitytest/securitytest.go://go:generate goimports -w embedded.go
Expand Down
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ALL_TESTS = [
"//pkg/cmd/roachprod/vm:vm_test",
"//pkg/cmd/roachtest/prometheus:prometheus_test",
"//pkg/cmd/roachtest/spec:spec_test",
"//pkg/cmd/roachtest/tests:tests_test",
"//pkg/cmd/roachtest:roachtest_test",
"//pkg/cmd/teamcity-trigger:teamcity-trigger_test",
"//pkg/cmd/testfilter:testfilter_test",
Expand Down
175 changes: 0 additions & 175 deletions pkg/cmd/roachtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,123 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
go_library(
name = "roachtest_lib",
srcs = [
"acceptance.go",
"activerecord.go",
"activerecord_blocklist.go",
"allocator.go",
"alterpk.go",
"autoupgrade.go",
"backup.go",
"canary.go",
"cancel.go",
"cdc.go",
"chaos.go",
"clearrange.go",
"cli.go",
"clock_jump_crash.go",
"clock_monotonic.go",
"clock_util.go",
"cluster_init.go",
"connection_latency.go",
"copy.go",
"decommission.go",
"decommission_self.go",
"disk_full.go",
"django.go",
"django_blocklist.go",
"drop.go",
"drt.go",
"drt_generated.go",
"encryption.go",
"engine_switch.go",
"event_log.go",
"flowable.go",
"follower_reads.go",
"go_helpers.go",
"gopg.go",
"gopg_blocklist.go",
"gorm.go",
"gorm_blocklist.go",
"gorm_helpers.go",
"gossip.go",
"hibernate.go",
"hibernate_blocklist.go",
"hotspotsplits.go",
"import.go",
"inconsistency.go",
"indexes.go",
"interleavedpartitioned.go",
"inverted_index.go",
"java_helpers.go",
"jobs.go",
"kv.go",
"kvbench.go",
"ledger.go",
"libpq.go",
"libpq_blocklist.go",
"liquibase.go",
"main.go",
"many_splits.go",
"mixed_version_decommission.go",
"mixed_version_jobs.go",
"mixed_version_schemachange.go",
"multitenant.go",
"multitenant_upgrade.go",
"network.go",
"nodejs_postgres.go",
"orm_helpers.go",
"overload_tpcc_olap.go",
"pebble.go",
"pgjdbc.go",
"pgjdbc_blocklist.go",
"pgx.go",
"pgx_blocklist.go",
"pop.go",
"psycopg.go",
"psycopg_blocklist.go",
"python_helpers.go",
"queue.go",
"quit.go",
"rapid_restart.go",
"rebalance_load.go",
"registry.go",
"replicagc.go",
"reset_quorum.go",
"restart.go",
"restore.go",
"roachmart.go",
"ruby_pg.go",
"ruby_pg_blocklist.go",
"schema_change_database_version_upgrade.go",
"schemachange.go",
"schemachange_random_load.go",
"scrub.go",
"secondary_indexes.go",
"sequelize.go",
"sequence_upgrade.go",
"split.go",
"sqlalchemy.go",
"sqlalchemy_blocklist.go",
"sqlsmith.go",
"status_server.go",
"synctest.go",
"sysbench.go",
"tlp.go",
"toxiproxy.go",
"tpc_utils.go",
"tpcc.go",
"tpcdsvec.go",
"tpce.go",
"tpchbench.go",
"tpchvec.go",
"ts_util.go",
"typeorm.go",
"util_disk_usage.go",
"util_if_local.go",
"util_load_group.go",
"version.go",
"versionupgrade.go",
"ycsb.go",
"z_cluster.go",
"z_monitor.go",
"z_slack.go",
Expand All @@ -131,81 +15,32 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/roachtest",
visibility = ["//visibility:private"],
deps = [
"//pkg/base",
"//pkg/ccl/changefeedccl/cdctest",
"//pkg/ccl/changefeedccl/changefeedbase",
"//pkg/cli",
"//pkg/cmd/cmpconn",
"//pkg/cmd/internal/issues",
"//pkg/cmd/roachtest/cluster",
"//pkg/cmd/roachtest/logger",
"//pkg/cmd/roachtest/option",
"//pkg/cmd/roachtest/prometheus",
"//pkg/cmd/roachtest/registry",
"//pkg/cmd/roachtest/spec",
"//pkg/cmd/roachtest/test",
"//pkg/cmd/roachtest/tests",
"//pkg/gossip",
"//pkg/internal/sqlsmith",
"//pkg/internal/team",
"//pkg/jobs",
"//pkg/jobs/jobspb",
"//pkg/kv",
"//pkg/roachpb",
"//pkg/server",
"//pkg/server/serverpb",
"//pkg/sql/pgwire/pgcode",
"//pkg/sql/pgwire/pgerror",
"//pkg/storage/cloud",
"//pkg/storage/cloud/amazon",
"//pkg/testutils",
"//pkg/testutils/skip",
"//pkg/testutils/sqlutils",
"//pkg/ts/tspb",
"//pkg/util",
"//pkg/util/binfetcher",
"//pkg/util/cancelchecker",
"//pkg/util/contextutil",
"//pkg/util/ctxgroup",
"//pkg/util/envutil",
"//pkg/util/httputil",
"//pkg/util/humanizeutil",
"//pkg/util/log",
"//pkg/util/protoutil",
"//pkg/util/quotapool",
"//pkg/util/randutil",
"//pkg/util/retry",
"//pkg/util/search",
"//pkg/util/stop",
"//pkg/util/syncutil",
"//pkg/util/sysutil",
"//pkg/util/timeutil",
"//pkg/util/version",
"//pkg/workload/histogram",
"//pkg/workload/querybench",
"//pkg/workload/tpcc",
"//pkg/workload/tpcds",
"//pkg/workload/tpch",
"@com_github_armon_circbuf//:circbuf",
"@com_github_cockroachdb_cockroach_go//crdb",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_logtags//:logtags",
"@com_github_cockroachdb_ttycolor//:ttycolor",
"@com_github_codahale_hdrhistogram//:hdrhistogram",
"@com_github_dustin_go_humanize//:go-humanize",
"@com_github_golang_mock//gomock",
"@com_github_kr_pretty//:pretty",
"@com_github_lib_pq//:pq",
"@com_github_nlopes_slack//:slack",
"@com_github_petermattis_goid//:goid",
"@com_github_prometheus_client_golang//api",
"@com_github_prometheus_client_golang//api/prometheus/v1:prometheus",
"@com_github_prometheus_common//model",
"@com_github_shopify_sarama//:sarama",
"@com_github_shopify_toxiproxy//client",
"@com_github_spf13_cobra//:cobra",
"@com_github_stretchr_testify//require",
"@org_golang_x_exp//rand",
"@org_golang_x_sync//errgroup",
],
)
Expand All @@ -220,10 +55,6 @@ go_test(
name = "roachtest_test",
size = "small",
srcs = [
"blocklist_test.go",
"drt_test.go",
"tpcc_test.go",
"util_load_group_test.go",
"z_cluster_test.go",
"z_test_registry_test.go",
"z_test_test.go",
Expand All @@ -234,22 +65,16 @@ go_test(
"//pkg/cmd/roachtest/cluster",
"//pkg/cmd/roachtest/logger",
"//pkg/cmd/roachtest/option",
"//pkg/cmd/roachtest/prometheus",
"//pkg/cmd/roachtest/registry",
"//pkg/cmd/roachtest/spec",
"//pkg/cmd/roachtest/test",
"//pkg/testutils",
"//pkg/testutils/skip",
"//pkg/util/syncutil",
"//pkg/util/timeutil",
"//pkg/util/version",
"@com_github_cockroachdb_errors//:errors",
"@com_github_golang_mock//gomock",
"@com_github_google_go_github//github",
"@com_github_kr_pretty//:pretty",
"@com_github_prometheus_common//model",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_x_oauth2//:oauth2",
],
)
10 changes: 6 additions & 4 deletions pkg/cmd/roachtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import (

"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/logger"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
_ "github.com/lib/pq" // register postgres driver
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -125,9 +127,9 @@ Examples:
return err
}
if !listBench {
RegisterTests(&r)
tests.RegisterTests(&r)
} else {
RegisterBenchmarks(&r)
tests.RegisterBenchmarks(&r)
}

matchedTests := r.List(context.Background(), args)
Expand Down Expand Up @@ -160,7 +162,7 @@ failed, it is 10. Any other exit status reports a problem with the test
runner itself.
`,
RunE: func(_ *cobra.Command, args []string) error {
return runTests(RegisterTests, cliCfg{
return runTests(tests.RegisterTests, cliCfg{
args: args,
count: count,
cpuQuota: cpuQuota,
Expand Down Expand Up @@ -193,7 +195,7 @@ runner itself.
Short: "run automated benchmarks on cockroach cluster",
Long: `Run automated benchmarks on existing or ephemeral cockroach clusters.`,
RunE: func(_ *cobra.Command, args []string) error {
return runTests(RegisterBenchmarks, cliCfg{
return runTests(tests.RegisterBenchmarks, cliCfg{
args: args,
count: count,
cpuQuota: cpuQuota,
Expand Down
Loading

0 comments on commit fbfcded

Please sign in to comment.