tests
dagger function so it can be invoked individually during TDD; All wires themup for parallel execution under `dagger call all`.
Installation
dagger install github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318Entrypoint
Return Type
Tests Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
func (m *MyModule) Example() *dagger.Tests {
return dag.
Tests()
}@function
def example() -> dagger.Tests:
return (
dag.tests()
)@func()
example(): Tests {
return dag
.tests()
}Types
Tests 🔗
all() 🔗
All runs every kafka round-trip test, capped at two concurrent jobs so the engine doesn’t have dozens of cluster containers (controller + brokers per test) in flight at once on smaller CI runners.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
allfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
All(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.all()
)@func()
async example(): Promise<void> {
return dag
.tests()
.all()
}bindBrokersExposesBrokersToCallerContainer() 🔗
BindBrokersExposesBrokersToCallerContainer binds the cluster’s brokers into a vanilla alpine container and asserts that the broker hostname resolves and its client-facing port is reachable from inside that container — the integration the BindBrokers contract promises.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
bind-brokers-exposes-brokers-to-caller-containerfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
BindBrokersExposesBrokersToCallerContainer(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.bind_brokers_exposes_brokers_to_caller_container()
)@func()
async example(): Promise<void> {
return dag
.tests()
.bindBrokersExposesBrokersToCallerContainer()
}clusterClientCanListTopicsOnFreshCluster() 🔗
ClusterClientCanListTopicsOnFreshCluster opens a franz-go-backed Client against a fresh cluster and asserts that ListTopics returns without error. A fresh KRaft cluster has no user topics, so the result may be empty — but the call itself must succeed, which proves module-runtime networking can reach the started broker service.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
cluster-client-can-list-topics-on-fresh-clusterfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
ClusterClientCanListTopicsOnFreshCluster(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.cluster_client_can_list_topics_on_fresh_cluster()
)@func()
async example(): Promise<void> {
return dag
.tests()
.clusterClientCanListTopicsOnFreshCluster()
}createAndDeleteTopicRoundTrip() 🔗
CreateAndDeleteTopicRoundTrip exercises the create/list/delete cycle to confirm kadm wiring. The topic name is randomized so the test is repeatable against the same cluster and never collides with leftovers.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
create-and-delete-topic-round-tripfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
CreateAndDeleteTopicRoundTrip(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.create_and_delete_topic_round_trip()
)@func()
async example(): Promise<void> {
return dag
.tests()
.createAndDeleteTopicRoundTrip()
}dedicatedControllerAndBrokerProduceConsume() 🔗
DedicatedControllerAndBrokerProduceConsume verifies that the split controller+broker topology (introduced this increment) still supports a full produce/consume round-trip — i.e. the broker correctly joined the controller quorum over its WithServiceBinding alias.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
dedicated-controller-and-broker-produce-consumefunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
DedicatedControllerAndBrokerProduceConsume(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.dedicated_controller_and_broker_produce_consume()
)@func()
async example(): Promise<void> {
return dag
.tests()
.dedicatedControllerAndBrokerProduceConsume()
}multiControllerIsRejected() 🔗
MultiControllerIsRejected pins the current contract: this story only supports a single-controller quorum (controllers=1), and the constructor must reject any larger value with a clear error rather than silently spinning up a broken topology. Multi-controller HA is gated behind a follow-up story; see daggerverse/kafka/README.md.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
multi-controller-is-rejectedfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
MultiControllerIsRejected(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.multi_controller_is_rejected()
)@func()
async example(): Promise<void> {
return dag
.tests()
.multiControllerIsRejected()
}oneControllerTwoBrokersReplicationFactorTwo() 🔗
OneControllerTwoBrokersReplicationFactorTwo spins up a 1+2 cluster and creates a replication-factor-2 topic so the produce path forces inter- broker replication. A successful round-trip proves brokers can reach each other over the engine network without explicit peer bindings.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
one-controller-two-brokers-replication-factor-twofunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
OneControllerTwoBrokersReplicationFactorTwo(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.one_controller_two_brokers_replication_factor_two()
)@func()
async example(): Promise<void> {
return dag
.tests()
.oneControllerTwoBrokersReplicationFactorTwo()
}plaintextSecurityProfilesAreNonNil() 🔗
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
plaintext-security-profiles-are-non-nilfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
PlaintextSecurityProfilesAreNonNil(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.plaintext_security_profiles_are_non_nil()
)@func()
async example(): Promise<void> {
return dag
.tests()
.plaintextSecurityProfilesAreNonNil()
}produceConsumeRoundTripBase64() 🔗
ProduceConsumeRoundTripBase64 round-trips the same kind of binary payload through standard base64 (with padding).
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
produce-consume-round-trip-base-6-4func (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
ProduceConsumeRoundTripBase64(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.produce_consume_round_trip_base64()
)@func()
async example(): Promise<void> {
return dag
.tests()
.produceConsumeRoundTripBase64()
}produceConsumeRoundTripHex() 🔗
ProduceConsumeRoundTripHex round-trips a binary payload through hex encoding. The non-UTF-8 bytes (including 0x00) verify that hex transports arbitrary binary safely.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
produce-consume-round-trip-hexfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
ProduceConsumeRoundTripHex(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.produce_consume_round_trip_hex()
)@func()
async example(): Promise<void> {
return dag
.tests()
.produceConsumeRoundTripHex()
}produceConsumeRoundTripRaw() 🔗
ProduceConsumeRoundTripRaw produces a single record with raw-encoded key and value, then consumes it back and asserts byte equality. The raw encoding round-trips Go strings verbatim, so the assertion is direct string equality.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
produce-consume-round-trip-rawfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
ProduceConsumeRoundTripRaw(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.produce_consume_round_trip_raw()
)@func()
async example(): Promise<void> {
return dag
.tests()
.produceConsumeRoundTripRaw()
}produceRejectsUnknownEncoding() 🔗
ProduceRejectsUnknownEncoding verifies that a Produce call with a bogus encoding name fails fast rather than silently misbehaving.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
produce-rejects-unknown-encodingfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
ProduceRejectsUnknownEncoding(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.produce_rejects_unknown_encoding()
)@func()
async example(): Promise<void> {
return dag
.tests()
.produceRejectsUnknownEncoding()
}propertiesFileContainsBootstrapAndSecurityProtocol() 🔗
PropertiesFileContainsBootstrapAndSecurityProtocol verifies that the rendered Java client.properties file carries the bootstrap.servers list and a plaintext security.protocol entry — enough for the Apache Kafka CLI tools to pick up the connection settings.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
properties-file-contains-bootstrap-and-security-protocolfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
PropertiesFileContainsBootstrapAndSecurityProtocol(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.properties_file_contains_bootstrap_and_security_protocol()
)@func()
async example(): Promise<void> {
return dag
.tests()
.propertiesFileContainsBootstrapAndSecurityProtocol()
}singleNodeClusterStarts() 🔗
SingleNodeClusterStarts spins up the smallest split-role cluster (one controller + one broker) and forces the server-side Cluster constructor to run by resolving BootstrapServers, asserting only that the broker hostname is non-empty. End-to-end reachability is covered by sibling tests that exercise ListTopics / produce / consume.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/kafka/tests@9ebfb29b95cb654ed5d00d1e595bcf710c2a7318 call \
single-node-cluster-startsfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Tests().
SingleNodeClusterStarts(ctx)
}@function
async def example() -> None:
return await (
dag.tests()
.single_node_cluster_starts()
)@func()
async example(): Promise<void> {
return dag
.tests()
.singleNodeClusterStarts()
}