Skip to content

Commit

Permalink
Move tests to //integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Oct 8, 2020
1 parent 7431ae3 commit 4696e49
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
script: &script_multiarch
# Generate BUILD.bazel files (we do not check them in)
- bazel run //:gazelle
- bazel build --cpu=${CPU} --curses=no //cmd/executor:all
- bazel build --cpu=${CPU} --curses=no //integration:all
# Build all targets tagged with our architecture:
- bazel build --cpu=${CPU} --curses=no $(bazel query 'attr("tags", "'${GOARCH}'", "//...")')
# Run all tests not tagged as "manual":
- bazel test --cpu=${CPU} --curses=no --test_output=errors --test_timeout=900 //cmd/executor:all
- bazel test --cpu=${CPU} --curses=no --test_output=errors --test_timeout=900 //integration:all
# Run all tests tagged with our architecture:
- bazel test --cpu=${CPU} --curses=no --test_output=errors --test_timeout=900 $(bazel query 'attr("tags", "'${GOARCH}'", "//...")')

Expand Down
66 changes: 1 addition & 65 deletions cmd/executor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -53,72 +53,8 @@ ARCHITECTURES = [
symlinks = {
"/kaniko/executor": "/kaniko/executor_" + arch,
},
visibility = ["//visibility:public"],
workdir = "/workspace",
)
for arch in ARCHITECTURES
]

# Image with testdata
[
container_image(
name = "buildtest_image_" + arch,
architecture = arch,
base = ":image_" + arch,
directory = "/workspace",
files = [
":testdata/Dockerfile.trivial",
],
)
for arch in ARCHITECTURES
]

load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")

# Non-executable tests can run on any architecture,
# so do not tag them.
[
container_test(
name = "image_files_" + arch + "_test",
configs = ["testdata/files.yaml"],
image = ":image_" + arch,
)
for arch in ARCHITECTURES
]

[
container_test(
name = "buildtest_image_" + arch + "_test",
configs = [
"testdata/files.yaml",
"testdata/testfiles.yaml",
],
image = ":buildtest_image_" + arch,
)
for arch in ARCHITECTURES
]

[
container_test(
name = "image_exec_" + arch + "_test",
configs = ["testdata/exec.yaml"],
image = ":image_" + arch,
tags = [
"manual",
arch,
],
)
for arch in ARCHITECTURES
]

[
container_test(
name = "image_build_" + arch + "_test",
configs = ["testdata/build.yaml"],
image = ":buildtest_image_" + arch,
tags = [
"manual",
arch,
],
)
for arch in ARCHITECTURES
]
108 changes: 108 additions & 0 deletions integration/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "integration",
srcs = [
"cleanup.go",
"cmd.go",
"config.go",
"gcs.go",
"images.go",
],
importpath = "github.com/GoogleContainerTools/kaniko/integration",
tags = ["manual"],
visibility = ["//visibility:public"],
deps = ["//pkg/timing"],
)

go_test(
name = "integration_test",
srcs = [
"benchmark_test.go",
"integration_test.go",
"integration_with_context_test.go",
"integration_with_stdin_test.go",
"k8s_test.go",
],
embed = [":integration"],
tags = ["manual"],
deps = [
"//pkg/timing",
"//pkg/util",
"//testutil",
"//vendor/github.com/google/go-containerregistry/pkg/name",
"//vendor/github.com/google/go-containerregistry/pkg/v1/daemon",
"//vendor/github.com/pkg/errors",
],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")

ARCHITECTURES = [
"amd64",
"arm64",
]

# Image with testdata
[
container_image(
name = "buildtest_image_" + arch,
architecture = arch,
base = "//cmd/executor:image_" + arch,
directory = "/workspace",
files = [
":testdata/Dockerfile.trivial",
],
)
for arch in ARCHITECTURES
]

# Non-executable tests can run on any architecture,
# so do not tag them.
[
container_test(
name = "image_files_" + arch + "_test",
configs = ["testdata/files.yaml"],
image = "//cmd/executor:image_" + arch,
)
for arch in ARCHITECTURES
]

[
container_test(
name = "buildtest_image_" + arch + "_test",
configs = [
"testdata/files.yaml",
"testdata/testfiles.yaml",
],
image = ":buildtest_image_" + arch,
)
for arch in ARCHITECTURES
]

[
container_test(
name = "image_exec_" + arch + "_test",
configs = ["testdata/exec.yaml"],
image = "//cmd/executor:image_" + arch,
tags = [
"manual",
arch,
],
)
for arch in ARCHITECTURES
]

[
container_test(
name = "image_build_" + arch + "_test",
configs = ["testdata/build.yaml"],
image = ":buildtest_image_" + arch,
tags = [
"manual",
arch,
],
)
for arch in ARCHITECTURES
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4696e49

Please sign in to comment.