Unable to delete message from branch #2300
Replies: 1 comment 6 replies
-
Hey @mariamjamal94 👋 If you run the tests with input:
generate:
count: 1
mapping: root = ""
processors:
- branch:
processors:
- mapping: throw("Kaboom!")
- catch:
- mapping: meta error = error()
result_map: |
root = if metadata("error") != null { throw(metadata("error")) } else { this }
- catch:
- mapping: root = deleted()
tests:
- name: tests branch processor
target_processors: "/input/processors"
input_batch:
- json_content:
foo: "bar" Also, not sure why you have |
Beta Was this translation helpful? Give feedback.
-
I am using benthos for the first time and am miserably stuck.
My problem is that in case an
http
processor 'errors' (e.g. 500 response), I delete the root incatch
mapping i.e.root = deleted()
While unit testing this behavior, I expect the output batches to be empty. However it fails, expecting the output batch to be the same as the input batch.
Processor:
My unit test is very simple:
When I run the test, I get:
unexpected batch: [{"test1":"test1"}]
Can someone help me what am I missing or if my understanding of
root
is completely wrong?Slighty related: is this even the right way to mock failed http processor with a
500
response?Beta Was this translation helpful? Give feedback.
All reactions