Skip to content

Commit

Permalink
Removed python test dependencies from public API
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored and gravypod committed Jul 2, 2021
1 parent cd06d6d commit b886744
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ tasks:
- -//tests/docker/util:test_extracted_file
- -//tests/docker/util:test_extracted_file_impl
# Tests included on macos
- //container:image_test
- //container/go/pkg/compat:go_default_test
- //container/go/pkg/oci:go_default_test
- //docker/util:config_stripper_test
Expand All @@ -125,6 +124,7 @@ tasks:
- //tests/container:distroless_fixed_id_digest_test_impl
- //tests/container:distroless_fixed_id_image_digest_test
- //tests/container:distroless_fixed_id_image_digest_test_impl
- //tests/container:image_test
- //tests/container:k8s_pause_arm64_digest_test
- //tests/container:k8s_pause_arm64_digest_test_impl
- //tests/container:pause_tar_test_0_tar_gz
Expand Down
5 changes: 5 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ container_deps()

load("//repositories:images.bzl", test_images = "images")

# py_deps are test dependencies only
load("//repositories:py_repositories.bzl", "py_deps")

py_deps()

test_images()

load(
Expand Down
91 changes: 0 additions & 91 deletions container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,97 +50,6 @@ py_library(
visibility = ["//visibility:public"],
)

TEST_TARGETS = [
":base_with_entrypoint",
":base_with_volume",
":derivative_with_cmd",
":derivative_with_shadowed_cmd",
":derivative_with_volume",
":directory_with_tar_base",
":files_base",
":files_with_files_base",
":files_in_layer_with_files_base",
":files_with_tar_base",
":tar_base",
":tar_with_mtimes_preserved",
":tar_with_files_base",
":tar_with_tar_base",
":tars_in_layer_with_tar_base",
":docker_tarball_base",
":layers_with_docker_tarball_base",
# TODO(mattmoor): Re-enable once archive is visible
# "generated_tarball",
":with_unix_epoch_creation_time",
":with_millisecond_unix_epoch_creation_time",
":with_rfc_3339_creation_time",
":with_stamped_creation_time",
":with_default_stamped_creation_time",
":with_base_stamped_image",
":with_env",
":layers_with_env",
":with_double_env",
":with_label",
":with_double_label",
":with_stamp_label",
":with_user",
":workdir_with_tar_base",
":link_with_files_base",
":build_with_tag",
":with_passwd",
":with_passwd_tar",
":with_group",
":with_empty_files",
":with_empty_dirs",
":gen_image",
":data_path_image",
":no_data_path_image",
":absolute_data_path_image",
":root_data_path_image",
":dummy_repository",
# TODO(mattmoor): Re-enable once archive is visible
# "extras_with_deb",
":bundle_test",
":stamped_bundle_test",
":pause_based",
":dashdash_entrypoint",
":base_based_warning",
":cc_based_warning",
"/pause_piecemeal:image",
"/pause_piecemeal_gz:image",
# Re-enable once https://github.com/bazelbuild/rules_d/issues/14 is fixed.
# "d_image",
":java_image",
":py_image",
":py_image_with_symlinks_in_data",
":py_image_complex",
":war_image",
":flat",
":flatten_with_tarball_base",
":nodejs_image",
":compressed_experiment",
]

TEST_DATA = [
"//testdata%s.tar" % t
for t in TEST_TARGETS
] + [
"//testdata:push_compression_gzip_fast",
"//testdata:push_compression_gzip_normal",
"//testdata:stamped_bundle_test",
"//testdata:stamp_info_file.txt",
"//tests/container:basic_windows_image.tar",
]

py_test(
name = "image_test",
size = "medium",
srcs = ["image_test.py"],
data = TEST_DATA,
python_version = "PY3",
srcs_version = "PY3",
deps = ["@containerregistry"],
)

bzl_library(
name = "bundle",
srcs = ["bundle.bzl"],
Expand Down
2 changes: 0 additions & 2 deletions repositories/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ repository.
"""

load(":go_repositories.bzl", "go_deps")
load(":py_repositories.bzl", "py_deps")

def deps():
"""Pull in external dependencies needed by rules in this repo.
Expand All @@ -31,4 +30,3 @@ def deps():
already.
"""
go_deps()
py_deps()
91 changes: 91 additions & 0 deletions tests/container/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,94 @@ bzl_library(
srcs = ["pull_info_validation_test.bzl"],
visibility = ["//visibility:private"],
)

TEST_TARGETS = [
":base_with_entrypoint",
":base_with_volume",
":derivative_with_cmd",
":derivative_with_shadowed_cmd",
":derivative_with_volume",
":directory_with_tar_base",
":files_base",
":files_with_files_base",
":files_in_layer_with_files_base",
":files_with_tar_base",
":tar_base",
":tar_with_mtimes_preserved",
":tar_with_files_base",
":tar_with_tar_base",
":tars_in_layer_with_tar_base",
":docker_tarball_base",
":layers_with_docker_tarball_base",
# TODO(mattmoor): Re-enable once archive is visible
# "generated_tarball",
":with_unix_epoch_creation_time",
":with_millisecond_unix_epoch_creation_time",
":with_rfc_3339_creation_time",
":with_stamped_creation_time",
":with_default_stamped_creation_time",
":with_base_stamped_image",
":with_env",
":layers_with_env",
":with_double_env",
":with_label",
":with_double_label",
":with_stamp_label",
":with_user",
":workdir_with_tar_base",
":link_with_files_base",
":build_with_tag",
":with_passwd",
":with_passwd_tar",
":with_group",
":with_empty_files",
":with_empty_dirs",
":gen_image",
":data_path_image",
":no_data_path_image",
":absolute_data_path_image",
":root_data_path_image",
":dummy_repository",
# TODO(mattmoor): Re-enable once archive is visible
# "extras_with_deb",
":bundle_test",
":stamped_bundle_test",
":pause_based",
":dashdash_entrypoint",
":base_based_warning",
":cc_based_warning",
"/pause_piecemeal:image",
"/pause_piecemeal_gz:image",
# Re-enable once https://github.com/bazelbuild/rules_d/issues/14 is fixed.
# "d_image",
":java_image",
":py_image",
":py_image_with_symlinks_in_data",
":py_image_complex",
":war_image",
":flat",
":flatten_with_tarball_base",
":nodejs_image",
":compressed_experiment",
]

TEST_DATA = [
"//testdata%s.tar" % t
for t in TEST_TARGETS
] + [
"//testdata:push_compression_gzip_fast",
"//testdata:push_compression_gzip_normal",
"//testdata:stamped_bundle_test",
"//testdata:stamp_info_file.txt",
"//tests/container:basic_windows_image.tar",
]

py_test(
name = "image_test",
size = "medium",
srcs = ["image_test.py"],
data = TEST_DATA,
python_version = "PY3",
srcs_version = "PY3",
deps = ["@containerregistry"],
)
2 changes: 1 addition & 1 deletion container/image_test.py → tests/container/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def test_with_default_stamped_creation_time(self):
# https://bazel-review.googlesource.com/c/bazel/+/48211
# Assume that any value for 'created' within a reasonable bound is fine.
self.assertLessEqual(now - created, datetime.timedelta(minutes=15))

def test_with_base_stamped_image(self):
# {BUILD_TIMESTAMP} should be the default when `stamp = True` is configured
# in the base image and `creation_time` isn't explicitly defined.
Expand Down

0 comments on commit b886744

Please sign in to comment.