forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bazel: run docker image tests under Bazel
This commit is to add a test infrastructure for docker image in TeamCity using bazel. It downloads the docker image tar from an upstream build configuration (not fully implemented yet, cockroachdb#72394 ), loads the docker image from the tar, builds a docker container based on it, and runs SQL queries inside that container. Release note: None
- Loading branch information
1 parent
bc88633
commit ebceb55
Showing
7 changed files
with
667 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
dir="$(dirname $(dirname $(dirname $(dirname $(dirname "${0}")))))" | ||
source "$dir/teamcity-support.sh" | ||
|
||
tc_prepare | ||
|
||
tc_start_block "Run docker image tests" | ||
bazel run \ | ||
//pkg/testutils/docker:docker_test \ | ||
--config=crosslinux --config=test \ | ||
--test_timeout=1800 | ||
tc_end_block "Run docker image tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "testutils_docker", | ||
srcs = ["docker_utils.go"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/testutils/docker", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_cockroachdb_errors//:errors", | ||
"@com_github_docker_docker//api/types", | ||
"@com_github_docker_docker//api/types/container", | ||
"@com_github_docker_docker//api/types/filters", | ||
"@com_github_docker_docker//client", | ||
"@com_github_docker_docker//pkg/stdcopy", | ||
"@com_github_docker_go_connections//nat", | ||
"@org_golang_x_net//context", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "docker_test", | ||
size = "enormous", | ||
srcs = ["single_node_docker_test.go"], | ||
data = glob([ | ||
"testdata/single-node-test/docker-entrypoint-initdb.d/**", | ||
]) + [ | ||
"//pkg/testutils/docker:testdata/single-node-test/docker-entrypoint-initdb.d", | ||
], | ||
embed = [":testutils_docker"], | ||
deps = [ | ||
"//pkg/util/contextutil", | ||
"//pkg/util/log", | ||
"@com_github_cockroachdb_errors//:errors", | ||
"@com_github_docker_docker//client", | ||
"@org_golang_x_net//context", | ||
], | ||
) |
Oops, something went wrong.