Page MenuHomeSoftware Heritage

Allow overriding broker settings in the kafka server fixture
ClosedPublic

Authored by olasd on Apr 8 2020, 1:36 PM.

Details

Summary

To test the behavior of swh.journal under different settings of the kafka
broker, split the kafka_server fixture into:

  • a persistent session_kafka_server fixture, spawning a single broker for the whole test session
  • a function-scoped kafka_server fixture, which uses the kafka admin client to override broker settings if needed, for the current test (and restores the original setting values afterwards)

The broker settings can be overridden for a given function using the parametrize
decorator to change the return value of the kafka_server_config_overrides
fixture.

Test Plan

tox is still happy

Diff Detail

Repository
rDJNL Journal infrastructure
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build was aborted

Patch application report for D2979 (id=10588)

Rebasing onto 17d64ff61b...

Current branch diff-target is up to date.
Changes applied before test
commit ba13209e069f57d41b21f97e5c2c8d308127f631
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 13:15:45 2020 +0200

    Allow overriding broker settings in the kafka server fixture
    
    To test the behavior of swh.journal under different settings of the kafka
    broker, split the kafka_server fixture into:
    
     - a persistent session_kafka_server fixture, spawning a single broker for the
     whole test session
    
     - a function-scoped kafka_server fixture, which uses the kafka admin client to
     override broker settings if needed, for the current test (and restores the
     original setting values afterwards)
    
    The broker settings can be overridden for a given function using the parametrize
    decorator to change the return value of the kafka_server_config_overrides
    fixture.

Link to build: https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/17/
See console output for more information: https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/17/console

"tox is still happy" but timeouts in the jenkins build ;)

swh/journal/tests/conftest.py
282

Shouldn't we log something here?

At least to ease introspection in build failures if something goes completely out of control at some point?

(same goes for the other try except below)

Jokes/Question aside, looks good.

This revision is now accepted and ready to land.Apr 8 2020, 2:44 PM

Build is green

Patch application report for D2979 (id=10588)

Rebasing onto a68e800622...

First, rewinding head to replay your work on top of it...
Applying: Allow overriding broker settings in the kafka server fixture
Changes applied before test
commit e0a214d284fdc6684b0961079c28b5e06abc1d0a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 13:15:45 2020 +0200

    Allow overriding broker settings in the kafka server fixture
    
    To test the behavior of swh.journal under different settings of the kafka
    broker, split the kafka_server fixture into:
    
     - a persistent session_kafka_server fixture, spawning a single broker for the
     whole test session
    
     - a function-scoped kafka_server fixture, which uses the kafka admin client to
     override broker settings if needed, for the current test (and restores the
     original setting values afterwards)
    
    The broker settings can be overridden for a given function using the parametrize
    decorator to change the return value of the kafka_server_config_overrides
    fixture.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/19/ for more details.

olasd marked an inline comment as done.Apr 8 2020, 2:50 PM

Well, the "swh.journal tests timeout randomly" bug is still here, I guess.

swh/journal/tests/conftest.py
282

I think you misread the construct: the exception gets re-raised. (I'm just making the "processing" of the concurrent.future explicit here).

olasd marked an inline comment as done.

Rebase.

Build is green

Patch application report for D2979 (id=10591)

Rebasing onto a68e800622...

Current branch diff-target is up to date.
Changes applied before test
commit bf7908bcaa95cd121b9896d109240a6fb63fe0cf
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 13:15:45 2020 +0200

    Allow overriding broker settings in the kafka server fixture
    
    To test the behavior of swh.journal under different settings of the kafka
    broker, split the kafka_server fixture into:
    
     - a persistent session_kafka_server fixture, spawning a single broker for the
     whole test session
    
     - a function-scoped kafka_server fixture, which uses the kafka admin client to
     override broker settings if needed, for the current test (and restores the
     original setting values afterwards)
    
    The broker settings can be overridden for a given function using the parametrize
    decorator to change the return value of the kafka_server_config_overrides
    fixture.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/20/ for more details.

swh/journal/tests/conftest.py
282

right.