HomeSoftware Heritage

pytest_plugin: modify the kafka_server fixture so topics are created beforehand

Description

pytest_plugin: modify the kafka_server fixture so topics are created beforehand

Since we now check that topics exist on the kafka broker when instantiating a
JournalClient, topics but be created when the mock kafka broker is started
for tests to keep working (e.g. in swh.storage).

This needs a small adaptation in the JournalClient code itself to ensure
"empty" messages used to create topics will be silently ignored.

The kafka_server() fixture is split in 2 fixtures:

  • kafka_server_base() that only creates the mock kafka server,
  • kafka_server that() uses this later and creates the topics resulting from the conjunction of the kafka_prefix() and the new object_types() fixture.

This new object_types() fixture is thus used to define the list
of topics (in conjunction with the kafka_prefix fixture) a (mock)
kafka_server() will create at startup time.

Details

Provenance
douarddaAuthored on May 6 2020, 4:48 PM
douarddaPushed on May 7 2020, 9:33 AM
Differential Revision
D3130: Refactor the pytest_plugin
Parents
rDJNL3e8e7dff4ec5: pytest_plugin: do not crash if the list of consumed messages is empty
Branches
Unknown
Tags
Unknown
Build Status
Buildable 12297
Build 18652: test-and-buildJenkins console · Jenkins