From 7a1541e45c7787029359e64db761dea7cd31f67e Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Tue, 4 Mar 2025 17:07:52 +0100 Subject: [PATCH] fix(IDX): don't run system tests with 'local' by default This ensures that -- by default -- system tests are not with run the `local` strategy. When run `local`ly, system tests don't seem to get cached across server restarts. The `select()` which was evaluated as a boolean was truthy meaning the `local` tag was always added. Instead, the `local` strategy is specified as a CLI arg in the k8s CI job. --- rs/tests/kubeconfig.bzl | 7 +++++++ rs/tests/system_tests.bzl | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/rs/tests/kubeconfig.bzl b/rs/tests/kubeconfig.bzl index 19393a4275c..383d257840c 100644 --- a/rs/tests/kubeconfig.bzl +++ b/rs/tests/kubeconfig.bzl @@ -7,6 +7,13 @@ def _kubeconfig_impl(ctx): ctx.file("kubeconfig.yaml", content = cfg.stdout) ctx.file("BUILD.bazel", content = """exports_files(glob(['*']))""") + # set extra tags for k8s + if ctx.getenv("KUBECONFIG"): + # set "local" tag for k8s system tests due to rootful container image builds + ctx.file("defs.bzl", content = """k8s_tags = ['local']""") + else: + ctx.file("defs.bzl", content = """k8s_tags = []""") + kubeconfig_rule = repository_rule( _kubeconfig_impl, local = True, diff --git a/rs/tests/system_tests.bzl b/rs/tests/system_tests.bzl index c0849b6c932..ad86f0c4d5c 100644 --- a/rs/tests/system_tests.bzl +++ b/rs/tests/system_tests.bzl @@ -4,6 +4,7 @@ Rules for system-tests. load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@kubeconfig//:defs.bzl", "k8s_tags") load("@rules_oci//oci:defs.bzl", "oci_load") load("@rules_rust//rust:defs.bzl", "rust_binary") load("//bazel:defs.bzl", "mcopy", "zstd_compress") @@ -275,11 +276,6 @@ def system_test( icos_images["ENV_DEPS__BOUNDARY_GUESTOS_DISK_IMG"] = "//ic-os/boundary-guestos/envs/dev:disk-img.tar.zst" # set "local" tag for k8s system tests due to rootful container image builds - is_k8s = select({ - "//rs/tests:k8s": True, - "//conditions:default": False, - }) - run_system_test( name = name, src = test_driver_target, @@ -288,7 +284,8 @@ def system_test( env = env, icos_images = icos_images, env_inherit = env_inherit, - tags = tags + ["requires-network", "system_test"] + (["local"] if is_k8s else []) + + tags = tags + ["requires-network", "system_test"] + + k8s_tags + (["manual"] if "experimental_system_test_colocation" in tags else []), target_compatible_with = ["@platforms//os:linux"], timeout = test_timeout,