Asserting an exception in ZeroCode for Kafka ACL testing
See original GitHub issueI am trying to test a kafka reader writer scenario where the user has permission to write to the topic, but does not have permission to read from that topic.
The java code looks like this :
@TargetEnv("kafka_servers/kafka_test_server.properties")
@RunWith(ZeroCodeUnitRunner.class)
public class KafkaConsumeJsonTest {
@Test
@Scenario('path/to/writer-can-write-but-cannot-read.json')
public void test writerWritesButCantRead(){}
}
The corresponding JSON looks like this :
{
"scenarioName": "Writer can write to a topic but cannot read from it",
"steps": [{
"name": "write to test topic",
"url": "kafka-topic:test-topic",
"operation": "produce",
"request": {
"records": [{
"key": "101",
"value": "Hello World"
}]
},
"assertions": {
"status": "Ok",
"recordMetadata": "$NOT.NULL"
}
},
{
"name": "onload_kafka",
"url": "kafka-topic:test-topic",
"operation": "unload",
"request": {
"consumerLocalConfigs": {
"recordType": "JSON",
"maxNoOfRetryPollsOrTimeouts": 3
}
},
"assertions": {
"status": "Failed",
"message": "Caused by: org.apache.kafka.common.errors.GroupAuthorizationException: Not authorized to access group: my-group"
}
}
]
}
When I run the test I encounter :
java.lang.RuntimeException: org.apache.kafka.common.errors.GroupAuthorizationException: Not authorized to access group: my-group.
This is a valid exception and I would to assert that in my test code to prove that the user cannot read from the topic with my-group as gorup-id. How do I assert this in the test case or in the scenario JSON?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Asserting an exception in ZeroCode for Kafka ACL testing
This is a valid exception and I would to assert that in my test code to prove that the user cannot read from...
Read more >Asserting an exception in ZeroCode for Kafka ACL testing
I posted this question on zero code github and I got an answer. Solution We will need to create our own kafka client...
Read more >Authorization using ACLs | Confluent Documentation
An authorizer is a server plugin used by Apache Kafka® to authorize operations. · To enable and use the AclAuthorizer, set its full...
Read more >Full Archive - Baeldung
Full Archive. Sometimes it's difficult to have a birds eye view over an entire site; here's Baeldung from 10000 feet: Expand All. November...
Read more >Change log for 4.8.43
Assert fails #98986; Condition is always 'false' because 'err' is always 'nil' in ... test for Default PodTopologySpread #95777; Return non-zero code on ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@arpan57 Yeah example was with test suite but you can change to your needs quick easily. Glad it was helpful. Btw, you can join our Slack for more discussion etc.
Thanks.