Skip to content

Run the conformance suite

The suite is go/messaging's conformance.RunDurable, the same one every durable backend runs (the backend contract). The adapter runs it against RabbitMQ in a container, from ./test/integration.

Run it

You need a Docker daemon and a checkout of the adapter.

INT_TEST_INTEGRATION=1 go test ./test/integration/... -v

just test-integration is the same command. Without INT_TEST_INTEGRATION=1 the package prints a skip line and exits 0, so a plain go test ./... needs no Docker. The unit tests under ./... need nothing.

TestMain starts one container from rabbitmq:4.3.5-management with testcontainers-go and shares it across every test. Set INT_TEST_LOG=1 to give the backend a text logger on stderr. CI runs this package in the go-test component's Docker-in-Docker job with a 25 minute timeout, because the suite includes a container restart.

What it runs

  • TestConformance: RunDurable once per wire format, binary, structured, masstransit and nservicebus, each on its own exchange and queue prefix so one run's queues do not fill under the next. The interop formats read behind the default chain, so their runs also prove the formats tell each other apart. The run passes WithKillable and WithForeign, so the link-death row and the unreadable-message row run too.
  • TestTopologyTheOperatorGotWrongIsRefused: builds each wrong queue the suite's fixture never would (absent, classic, no dead-letter exchange, wrong strategy, wrong overflow, low limit, unbound pattern) and checks the refusal names what was found. The suite cannot reach those branches because its fixture builds correct topology.
  • TestAMissingQueueIsRefusedWithTheSentinel, TestAnUnroutablePublishIsRefused, TestAPublishIsWrittenWithTheFormat, TestAnInteropFormatIsWhatGoesOut and TestAHeaderNoFormatTakesIsForeign: the adapter's own checks of what the suite does not.

How the fixture stands in for an operator

The fixture implements conformance.Durable, Binder, Immutable, Foreign and the killer:

  • Open declares the topic exchange and returns a backend whose Topology is the fixture.
  • Queue, on first resolve of a durable name, declares a quorum queue with a dead-letter fanout exchange and quorum queue of its own, at-least-once strategy, reject-publish overflow and a delivery limit of MaxDeliver - 1, and binds the subscription's pattern. It never changes a queue it already made, so a changed MaxDeliver or pattern on reopen is the module's to refuse.
  • Restart stops and starts the same container, which keeps its node name and data.
  • ImmutableFields returns Pattern and MaxDeliver: the pattern is the binding's, and MaxDeliver is held to the delivery limit. AckWait is the adapter's own and StartAt does not exist here.
  • Kill deletes the queue, which cancels its consumers with basic.cancel, the same message the broker sends for a delivery acknowledgement timeout.
  • SendUnreadable publishes straight to the exchange past the bus's writer: bytes that are no event, a message both CloudEvents formats claim, and one that is claimed but malformed.

Run it against your own broker

The container and its URLs are fixed in test/integration/main_test.go; there is no setting for an external broker. To test another RabbitMQ version, change the image constant there. The suite then proves the adapter against that version, which Tested versions does not claim for any other.