dzbarsky / rules_itest

Bazel rules for integration testing services
MIT License
18 stars 6 forks source link

Merge service_test env vars with the underlying test #16

Closed darkrift closed 5 months ago

darkrift commented 5 months ago

service_test should merge it's env with the integration test it launches.

If a duplicate key is found in both the service_test and the underlying test, fail the build with the possibility to override that behavior at a later time.

DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {"ITEST_ENV_TEST": "test_value"}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {"ITEST_ENV_TEST": "test_value"}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
DEBUG: /private/var/tmp/_bazel_david.zbarsky/a972481bcfde40ab4d0f2f1c6ac38331/external/rules_itest~/private/itest.bzl:314:10: ENV {}
+++ b/private/itest.bzl
@@ -311,6 +311,8 @@ def _service_test_impl(ctx):
     env = ctx.attr.env | _run_environment(ctx, service_specs_file)
     env["SVCINIT_TEST_RLOCATION_PATH"] = to_rlocation_path(ctx, ctx.executable.test)

+    print("ENV", ctx.attr.test[RunEnvironmentInfo].environment)
+
dzbarsky commented 5 months ago

Fixed in https://github.com/dzbarsky/rules_itest/commit/e2b14e974230b520de54e268003120aedb6ee6be