Skip to content

Commit

Permalink
logictest: don't download cockroach from the internet in test
Browse files Browse the repository at this point in the history
Instead, make it a Bazel-level dependency and look it up in runfiles.
This means the test no longer has to talk to the network.

Closes cockroachdb#108865.

Epic: CRDB-8308
Release note: None
  • Loading branch information
rickystewart committed Sep 21, 2023
1 parent 82a703d commit 5bef18e
Show file tree
Hide file tree
Showing 52 changed files with 309 additions and 168 deletions.
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ http_archive(
],
)

# Cockroach binaries for use by mixed-version logictests.
load("//pkg/sql/logictest:REPOSITORIES.bzl", "cockroach_binaries_for_testing")
cockroach_binaries_for_testing()

load("//build/bazelutil:repositories.bzl", "distdir_repositories")

distdir_repositories()
Expand Down
32 changes: 32 additions & 0 deletions build/toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -616,3 +616,35 @@ config_setting(
"//c-deps:__pkg__",
],
)

config_setting(
name = "is_linux_amd64",
constraint_values = [
"@io_bazel_rules_go//go/toolchain:linux",
"@platforms//cpu:x86_64",
],
)

config_setting(
name = "is_linux_arm64",
constraint_values = [
"@io_bazel_rules_go//go/toolchain:linux",
"@platforms//cpu:arm64",
],
)

config_setting(
name = "is_darwin_amd64",
constraint_values = [
"@io_bazel_rules_go//go/toolchain:darwin",
"@platforms//cpu:x86_64",
],
)

config_setting(
name = "is_darwin_arm64",
constraint_values = [
"@io_bazel_rules_go//go/toolchain:darwin",
"@platforms//cpu:arm64",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ go_test(
"//pkg/sql/logictest:testdata", # keep
"//pkg/sql/opt/exec/execbuilder:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 5,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/3node-tenant/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ go_test(
"//pkg/sql/logictest:testdata", # keep
"//pkg/sql/opt/exec/execbuilder:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 48,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/5node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 5,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/fakedist-disk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 6,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/fakedist-vec-off/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 6,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/fakedist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 7,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 6,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/local-mixed-22.2-23.1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 7,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/local-vec-off/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 6,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/logictestccl/tests/local/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 20,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 4,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 1,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 20,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 16,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 9,
tags = [
"ccl_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ go_test(
"//c-deps:libgeos", # keep
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 27,
tags = [
"ccl_test",
Expand Down
4 changes: 1 addition & 3 deletions pkg/ccl/sqlitelogictestccl/tests/3node-tenant/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ go_test(
"//c-deps:libgeos", # keep
"@com_github_cockroachdb_sqllogictest//:testfiles", # keep
],
exec_properties = {
"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = 48,
tags = [
"ccl_test",
Expand Down
9 changes: 3 additions & 6 deletions pkg/cmd/generate-logictest/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,12 @@ go_test(
"//c-deps:libgeos", # keep{{ if .SqliteLogicTest }}
"@com_github_cockroachdb_sqllogictest//:testfiles", # keep{{ end }}{{ if .CockroachGoTestserverTest }}
"//pkg/cmd/cockroach-short", # keep{{ end }}{{ if .CclLogicTest }}
"//pkg/ccl/logictestccl:testdata", # keep{{ end }}{{ if .LogicTest }}
"//pkg/ccl/logictestccl:testdata", # keep{{ end }}{{ if .CockroachGoTestserverTest }}
"//pkg/sql/logictest:cockroach_predecessor_version", # keep{{ end }}{{ if .LogicTest }}
"//pkg/sql/logictest:testdata", # keep{{ end }}{{ if .ExecBuildLogicTest }}
"//pkg/sql/opt/exec/execbuilder:testdata", # keep{{ end }}
],
exec_properties = {{ if eq .TestRuleName "cockroach-go-testserver-upgrade-to-master" }}{
"dockerNetwork": "standard",
{{ else }}{
{{ end }}"Pool": "large",
},
exec_properties = {"Pool": "large"},
shard_count = {{ if gt .TestCount 48 }}48{{ else }}{{ .TestCount }}{{end}},
tags = [{{ if .Ccl }}
"ccl_test",{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
rootCmd.AddCommand(postReleaseSeriesBlockersCmd)
rootCmd.AddCommand(cancelReleaseSeriesDateCmd)
rootCmd.AddCommand(setOrchestrationVersionCmd)
rootCmd.AddCommand(updateReleasesTestFileCmd)
rootCmd.AddCommand(updateReleasesTestFilesCmd)
rootCmd.AddCommand(setCockroachVersionCmd)
rootCmd.AddCommand(updateVersionsCmd)
}
Loading

0 comments on commit 5bef18e

Please sign in to comment.