authorjapps / authorjapps/zerocode

[KAFKA] Assert record content when multiple records collected

Open
#448 5 comments 0 reactions 0 assignees View on GitHub
kafka not-an-issue
Dominant language
Java
Stars
1k
Forks
453
Avg merge
7d 2h
Merged PRs (30d)
5

Description

Sometimes when I run consumer tests more than one record is picked up by the KafkaConsumer together with the one I'm looking for but AssertionProcessor only tries to match the first record collected.

Here is my consumer configuration :
```json
{
"scenarioName": "Check phoneNumbersChange even is generated",
"steps": [
{
"name": "consume_step",
"url": "kafka-topic:t1.party.customer.test.v1",
"operation": "consume",
"request": {
"consumerLocalConfigs": {
"recordType": "JSON",
"commitSync": true,
"showRecordsConsumed": true,
"maxNoOfRetryPollsOrTimeouts": 10
}
},
"assertions": {
"records": [
{
"key" : "37_party_customer_7C8012AC-0122-4911-8808-54AA687C0002",
"value": {
"metadata": {
"bankNr": 37,
"eventName":"phoneNumbersChanged"
},
"payload": {
"phoneNumberList": [
{
"description" : "Mobil",
"isMobilePhone" : true,
"phoneNumber" : "${SYSTEM.PROPERTY:37_phoneChange}"
}
]
}
}
}
]
}
}
]
}
```
KafkaConsumer then properly pick's up the records including mine with
![image](https://user-images.githubusercontent.com/12811878/95749745-58d94e80-0c9c-11eb-8f7e-a3806f6100c4.png)

but when then it continues to assertion phase it checks only for the first records
![image](https://user-images.githubusercontent.com/12811878/95749857-8a521a00-0c9c-11eb-8fc7-5ddf4f001733.png)

How can I fix this?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the records collected by KafkaConsumer into AssertionProcessor using the consumer configuration in the issue. Reproduce the case with multiple records, then verify that the assertion can match the expected key and value when it is not the first collected record.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka
Domain
stream-processing, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.