redpanda-data / redpanda-data/benthos

Benthos tests don't recognise template components

Open
#194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug templates
Dominant language
Go
Stars
571
Forks
120
Avg merge
2d 1h
Merged PRs (30d)
18

Description

Given this foo.tmpl.yaml:

name: foobar
type: processor
fields:
  - name: foo
    type: string

mapping: |
  #!blobl
  root.mapping = "root.foo = \"" + this.foo + "\""

And foo.yaml:

input:
  generate:
    count: 1
    mapping: root = ""

pipeline:
    processors:
      - foobar:
          foo: bar

output:
  stdout: {}

tests:
  - name: example test
    target_processors: '/pipeline/processors'
    environment: {}
    input_batch:
      - content: ""
    output_batches:
      -
        - json_equals: '{ "foo": "bar" }'

This command:

$ benthos test -t foo.tmpl.yaml foo.yaml

Fails with:

Failed to execute test target 'foo.yaml': test case 0 failed: failed to initialise processors '/pipeline/processors': failed to initialise processor index '0': processor type of 'foobar' was not recognised

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run benthos test -t foo.tmpl.yaml foo.yaml with the two issue examples and confirm the unrecognised foobar processor error. Trace how the benthos test command loads template components before initialising /pipeline/processors; done means the test recognises foobar and produces the expected { "foo": "bar" } output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.