From 48465a2e07a1ca264b079696efe07b2f6ca447bc Mon Sep 17 00:00:00 2001 From: Anton Krivoborodov Date: Tue, 6 Oct 2026 11:13:35 +0000 Subject: [PATCH] fix(test): package datarouter docker config at opt/datarouter/etc The datarouter component tests fail when score_logging is consumed as an external Bazel dependency (e.g. in reference_integration): the datarouter runs with cwd=/opt/datarouter and opens ./etc/log-channels.json, but the config files were packaged at opt/datarouter/external/score_logging+/score/test/component/datarouter/etc/ instead of opt/datarouter/etc/. ReadStaticDlt then fails, DltLogServer is nullptr ("static config is not available, interrupt work"), the unix socket never opens, and every test times out with "Datarouter not ready". Root cause: _datarouter_conf_pkg used pkg_tar(strip_prefix = "/score/test/component/datarouter"). A leading-slash strip_prefix is repo-root-relative and only matches when logging is the root module (its own component_tests.yml CI). When logging is external the file path is prefixed with external/score_logging+/, the strip matches nothing, and the whole prefix survives under package_dir. Fix: package the config via a package-relative pkg_files (datarouter_docker_config_pkg) using strip_prefix.from_pkg(), mirroring the existing QNX datarouter_config_pkg. This resolves to opt/datarouter/etc/* for both root and external consumption. --- score/test/component/BUILD | 4 +--- score/test/component/datarouter/BUILD | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/score/test/component/BUILD b/score/test/component/BUILD index dc443e6ae..e00a9ca8c 100644 --- a/score/test/component/BUILD +++ b/score/test/component/BUILD @@ -33,9 +33,7 @@ pkg_tar( pkg_tar( name = "_datarouter_conf_pkg", - srcs = ["//score/test/component/datarouter:datarouter_test_config_files"], - package_dir = "opt/datarouter", - strip_prefix = "/score/test/component/datarouter", + srcs = ["//score/test/component/datarouter:datarouter_docker_config_pkg"], target_compatible_with = ["@platforms//os:linux"], ) diff --git a/score/test/component/datarouter/BUILD b/score/test/component/datarouter/BUILD index fab77b035..798592fb0 100644 --- a/score/test/component/datarouter/BUILD +++ b/score/test/component/datarouter/BUILD @@ -12,7 +12,7 @@ # ******************************************************************************* load("@rules_cc//cc:cc_binary.bzl", "cc_binary") -load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files") +load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "strip_prefix") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//score/test/component:defs.bzl", "py_logging_itf_test") @@ -95,6 +95,19 @@ pkg_files( visibility = ["//score/test/component:__subpackages__"], ) +# Docker image config. Package-relative strip so the etc/ files resolve to +# opt/datarouter/etc/* whether score_logging is built as the root module or +# consumed as an external dependency (an absolute strip_prefix only matches +# when logging is root and silently leaves the external/score_logging+/ prefix +# otherwise). +pkg_files( + name = "datarouter_docker_config_pkg", + srcs = [":datarouter_test_config_files"], + prefix = "opt/datarouter", + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//score/test/component:__subpackages__"], +) + py_logging_itf_test( name = "test_datarouter_filters", srcs = ["test_datarouter_filters.py"],