Skip to content

Commit bce5f79

Browse files
move rust testdata into a dedicated Bazel package
1 parent 7112f38 commit bce5f79

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

pkg/discovery/module/rust/BUILD.bazel

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,12 @@ rust_binary(
168168
# Tests
169169
# ============================================================================
170170

171-
# Test data files
172-
filegroup(
173-
name = "testdata",
174-
srcs = glob(["testdata/**/*"]),
175-
)
176-
177-
filegroup(
178-
name = "mock_system_probe",
179-
srcs = ["testdata/fallback/mock-system-probe.sh"],
180-
)
181-
182171
# Unit tests embedded in source files
183172
rust_test(
184173
name = "dd_discovery_test",
185174
crate = ":dd_discovery",
186175
# Make test data available to tests
187-
data = [":testdata"],
176+
data = ["//pkg/discovery/module/rust/testdata:files"],
188177
edition = "2024",
189178
deps = [
190179
# Dev dependencies from Cargo.toml
@@ -201,15 +190,15 @@ rust_test(
201190
name = "fallback_integration_test",
202191
srcs = ["tests/fallback_integration_test.rs"],
203192
data = [
204-
":mock_system_probe",
193+
"//pkg/discovery/module/rust/testdata:mock_system_probe",
205194
":sd-agent",
206195
],
207196
edition = "2024",
208197
# Set compile-time environment variable pointing to sd-agent binary
209198
# This mimics Cargo's CARGO_BIN_EXE_* behavior
210199
rustc_env = {
211200
"CARGO_BIN_EXE_sd-agent": "$(rootpath :sd-agent)",
212-
"MOCK_SYSTEM_PROBE": "$(rootpath :mock_system_probe)",
201+
"MOCK_SYSTEM_PROBE": "$(rootpath //pkg/discovery/module/rust/testdata:mock_system_probe)",
213202
},
214203
deps = [
215204
"@crates//:nix",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Omnibus packaging excludes **/testdata/**/* from the source tree it builds
2+
# from. Keeping testdata globs in this dedicated subpackage prevents those
3+
# stripped packaging builds from evaluating test-only globs in the parent
4+
# package when they only need //pkg/discovery/module/rust:install.
5+
filegroup(
6+
name = "files",
7+
srcs = glob(
8+
["**/*", "**/.*"],
9+
exclude = ["BUILD.bazel"],
10+
),
11+
visibility = ["//pkg/discovery/module/rust:__pkg__"],
12+
)
13+
14+
filegroup(
15+
name = "mock_system_probe",
16+
srcs = ["fallback/mock-system-probe.sh"],
17+
visibility = ["//pkg/discovery/module/rust:__pkg__"],
18+
)

0 commit comments

Comments
 (0)