This is an additional example for Karate Kafka that shows how to use MTLS and client-side authentication.
This section of the test in kafka-json.feature sets up client-side SSL:
* configure kafka =
"""
{
'bootstrap.servers': 'localhost:29093',
'security.protocol': 'SSL',
'ssl.truststore.location': 'ssl/client.truststore.pkcs12',
'ssl.truststore.password': 'karate'
}
"""
Here the docker-compose.yml configures Kafka to use SSL. This example does not use the schema registry.
The certificates and related files in the /ssl folder were created using conf/commands.txt.
This example also contains an example of how to mix API and Kafka tests, which is a common scenario.
Refer to kafka-hybrid.feature. Note how karate.consume()
is called at the start of the test before any other actions.
Commands were adapted from these references: