Skip to content

Commit 4d22ce1

Browse files
esensarpront
andauthored
fix(unit tests): prevent missing components errors for memory tables in tests (#24081)
* fix(unit tests): prevent missing components errors for memory tables in tests This ensures that memory enrichment tables are always considered in tests, because we can't be sure if they are used. Related: #23972 * Add changelog entry * improve comment --------- Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
1 parent 24099eb commit 4d22ce1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixed an issue in vector tests where memory enrichment tables would report missing components errors.
2+
3+
authors: esensar Quad9DNS

src/config/unit_test/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ async fn build_unit_test(
432432
.collect::<Vec<_>>();
433433
valid_components.extend(unexpanded_transforms);
434434

435+
// Enrichment tables consume inputs but are referenced dynamically in VRL transforms
436+
// (via get_enrichment_table_record). Since we can't statically analyze VRL usage,
437+
// we conservatively include all enrichment table inputs as valid components.
438+
config_builder
439+
.enrichment_tables
440+
.iter()
441+
.filter_map(|(key, c)| c.as_sink(key).map(|(_, sink)| sink.inputs))
442+
.for_each(|i| valid_components.extend(i.into_iter()));
443+
435444
// Remove all transforms that are not relevant to the current test
436445
config_builder.transforms = config_builder
437446
.transforms

0 commit comments

Comments
 (0)