Skip to content

Commit

Permalink
bazel: improve test parallelism under pkg/{kv/kv,}server
Browse files Browse the repository at this point in the history
And add a few references/comments about how to run tests under bazel.

Release note: None
  • Loading branch information
irfansharif committed Nov 9, 2020
1 parent 5c2b08d commit 331295b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
15 changes: 12 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:exclude pkg/sql/opt/rule_name_string.go
# gazelle:exclude pkg/cmd/prereqs/testdata

# Generally useful references:
#
# https://docs.bazel.build/versions/master/user-manual.html
# https://docs.bazel.build/versions/master/guide.html

# TODO(irfansharif): Today we let bazel take over the vendor directory and
# define each vendored dependency as a bazel target. We should be able to have
# bazel ignore all of vendor/ and create those dependencies on the fly.
Expand All @@ -55,6 +60,10 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# short hands I've used so far:
#
# bazel test //pkg/kv/kvserver/concurrency/...
# bazel test //pkg/kv/kvserver:all --test_cache_results=no --test_output=all
# bazel test --features race //pkg/kv/kvserver/concurrency/... --test_output=all \
# --test_arg='-test.v' --test_arg='-show-logs' --test_filter='TestBTreeClone.*' \
# --run_under='stress -maxtime=120s' --cache_test_results=no
# bazel build //pkg/sql/opt
# bazel build //pkg/sql/opt:all
# bazel build //pkg/sql/colexec:gen-exec
Expand All @@ -72,13 +81,13 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
#
# bazel build @cockroach//pkg/cmd/cockroach-short
#
# TODO(irfansharif): We should probably define shorthands for the more common
# ones from up above.
# TODO(irfansharif): We should define shorthands for all of the above. See
# https://docs.bazel.build/versions/master/skylark/tutorial-custom-verbs.html

# TODO(irfansharif): The way we currently generate code through bazel, that
# code is only available within the bazel sandbox. Bazel ignores all
# the pre-generated code that is already checked into the codebase (through
# `make generate`/etc.)through the exclude directives above. It's generating
# `make generate`/etc.) through the exclude directives above. It's generating
# everything on the fly.
#
# As we move towards bazel, we'll want to introduce a mechanism that implants
Expand Down
1 change: 1 addition & 0 deletions pkg/kv/kvserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ go_test(
],
data = glob(["testdata/**"]),
embed = [":kvserver"],
shard_count = 16,
deps = [
"//pkg/base",
"//pkg/clusterversion",
Expand Down
1 change: 1 addition & 0 deletions pkg/server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ go_test(
"version_cluster_test.go",
],
embed = [":server"],
shard_count = 16,
deps = [
"//pkg/base",
"//pkg/build",
Expand Down

0 comments on commit 331295b

Please sign in to comment.