Add integration tests for Kafka messaging#85
Conversation
|
With the PR being opened against a feature branch, no CI is actually triggering. Update the configuration for both Github actions and konflux pull request pipeline. |
All three MUST FIX issues and the SHOULD FIX addressed:
|
CI triggers now include
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/integration-tests #85 +/- ##
============================================================
Coverage ? 83.69%
============================================================
Files ? 13
Lines ? 1325
Branches ? 0
============================================================
Hits ? 1109
Misses ? 216
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/retest |
a94a676 to
2f0c5bc
Compare
The Switched to the official |
The Fixed by adding:
No changes to the Kafka image, environment variables, or any other part of the pipeline. |
The Fixed by mounting a third |
Deploy an Apache Kafka 3.9.2 KRaft single-node broker in the ephemeral test namespace and verify that CTS publishes messages to Kafka for compose-created, compose-tagged, and compose-untagged operations. Use localhost:9093 for KAFKA_CONTROLLER_QUORUM_VOTERS so the broker can reach its own controller listener directly without going through the Kubernetes Service, which is not yet ready when the pod first starts (chicken-and-egg issue with the readiness probe on port 9092). Mount emptyDir volumes for /opt/kafka/config, /opt/kafka/logs, and /tmp/kafka-logs so the container runs without elevated privileges under OpenShift's restricted-v2 SCC. Generated-By: OpenCode (google-vertex-anthropic/claude-sonnet-4-6@default)
The Fixed by changing |
Add integration tests for Kafka messaging
Closes #84
Changes
tests/test_integration_api.pykafka_urlmodule-scoped fixture that skips whenKAFKA_URLis not set._consume_kafka_messagehelper usingKafkaConsumerwithauto_offset_reset='earliest'and a per-call UUIDgroup_id, so messages published before the consumer subscribes are still visible.test_kafka_compose_created— imports a compose and asserts a message arrives oncts.compose-created.test_kafka_compose_tagged— tags a compose and asserts a message arrives oncts.compose-tagged.test_kafka_compose_untagged— untags a compose and asserts a message arrives oncts.compose-untagged.KAFKA_URLis unset, preserving backward compatibility.test-requirements.txtkafka-pythonfor use in the integration tests..tekton/integration-test-eaas.yamldeploy-kafkatask (afterprovision-environment) that deploys a Bitnami Kafka 3.7 single-broker KRaft instance accessible atkafka:9092with no TLS or SASL.deploy-kafkatodeploy-cts'srunAfterlist to enforce ordering.cts-configConfigMap insidedeploy-cts:run-teststask'spip installto includekafka-pythonand itspytestinvocation to passKAFKA_URL=kafka:9092.Acceptance criteria verification
pytest … -k "not kafka"with noKAFKA_URL— no new errors; three Kafka tests deselected.test_kafka_compose_createdskips gracefully withoutKAFKA_URL; asserts both positive (correct event field) and negative (non-empty payload) when running live.test_kafka_compose_tagged— same pattern.test_kafka_compose_untagged— same pattern.deploy-kafkatask exists anddeploy-ctslistsdeploy-kafkain itsrunAfterfield.run-testspip install includeskafka-python;kubectl execscript passesKAFKA_URL=kafka:9092.