vector icon indicating copy to clipboard operation
vector copied to clipboard

fix(enrichment_tables): Fail when unit testing a config with unused enrichment table

Open elobommart opened this issue 1 month ago • 13 comments

Summary

When running unit tests for Vector's configuration, enrichment tables are not sanitized the same way transforms are.

This incurs a bug when creating a configuration with an enrichment table that has a transform as an input, and a test that does not use said transform, because said transform is pruned from the transforms list, and Vector then tries to create the enrichment_table but cannot find its input. Moreover, there is no reason for the transforms to be sanitized and not the enrichment tables.

The following configuration currently fails when building tests on master, the reported error being that the input 'cache_builder' does not exist in the configuration. With this fix, this kind of tests build correctly.

Vector configuration

sources:
  src_1:
    type: socket
    address: 0.0.0.0:8001
    mode: udp

enrichment_tables:
  table_1:
    type: memory
    ttl: 600
    inputs:
      - cache_builder

transforms:
  transform_1:
    type: remap
    inputs:
      - src_1
    source: |
      .message = "test"

  cache_builder:
    type: remap
    inputs:
      - src_1
    source: |
      . = set!(value: {}, path: ["k1"], data: "d1")

sinks:
  sink1:
    type: console
    inputs:
      - transform_1
    encoding:
      codec: json
      json:
        pretty: true

tests:
  - name: "test 1"
    inputs:
      - insert_at: transform_1
        type: log
        log_fields:
          message: "test message"
    outputs:
      - extract_from: transform_1
        conditions:
          - type: vrl
            source: |-
              assert_eq!(.message, "test")

How did you test this PR?

via unit tests, running locally

Change Type

  • [x] Bug fix
  • [ ] New feature
  • [ ] Non-functional (chore, refactoring, docs)
  • [ ] Performance

Is this a breaking change?

  • [ ] Yes
  • [x] No

Does this PR include user facing changes?

  • [ ] Yes. Please add a changelog fragment based on our guidelines.
  • [x] No. A maintainer will apply the no-changelog label to this PR.

elobommart avatar Nov 13 '25 15:11 elobommart

Hi @elobommart, please sign the CLA and we will take a look.

pront avatar Nov 18 '25 15:11 pront

I can't sign the CLA. The CLA management app shows the following error :

There is no CLA to sign for vectordotdev/vector (could not find linked item for owner vectordotdev and repo vector)

elobommart avatar Nov 24 '25 12:11 elobommart

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Nov 24 '25 14:11 github-actions[bot]

Hi @elobommart sorry. We migrated the CLA check to a new workflow. I updated the branch and instructions should be posted here shortly

thomasqueirozb avatar Nov 24 '25 14:11 thomasqueirozb

Thanks @thomasqueirozb, if the new process is just the comment on the agreement, I think it's ok now ! Should the agreement CI task re-run to validate it ? Can I force this ?

elobommart avatar Nov 24 '25 18:11 elobommart

@elobommart After reading and reviewing the CLA you just need to post a comment stating "I have read the CLA Document and I hereby sign the CLA". If it doesn't automatically refresh then also comment "recheck" - that's all!

thomasqueirozb avatar Nov 24 '25 21:11 thomasqueirozb

I have read the CLA Document and I hereby sign the CLA

elobommart avatar Nov 26 '25 08:11 elobommart

recheck

elobommart avatar Nov 26 '25 08:11 elobommart

@thomasqueirozb so I did both, but to no avail :(

elobommart avatar Nov 26 '25 09:11 elobommart

The issue is that your original commit is not associated with your GitHub account. You should add that email to you GitHub account. You can view the email associated with the commit by running git show 09ebed422ede23b50c7470a39454f2f978c9095f (I don't want to put it out here for anyone/bots to see).

Alternatively I can try to take ownership of that commit or change the commit's owner to your other email and force push to this branch

thomasqueirozb avatar Nov 26 '25 16:11 thomasqueirozb

recheck

elobommart avatar Nov 26 '25 16:11 elobommart

The issue is that your original commit is not associated with your GitHub account. You should add that email to you GitHub account. You can view the email associated with the commit by running git show 09ebed422ede23b50c7470a39454f2f978c9095f (I don't want to put it out here for anyone/bots to see).

Alternatively I can try to take ownership of that commit or change the commit's owner to your other email and force push to this branch

right, I did not realise that it was still my "old" email, sorry for the noise ! we are good to go now :-)

elobommart avatar Nov 26 '25 16:11 elobommart

Hello @thomasqueirozb , thanks again for your time. Now that the CLA is handled, should we move forward ?

elobommart avatar Dec 10 '25 09:12 elobommart