Skip to content

Commit

Permalink
Add an integration test for the exit code of the consumer on failure
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
  • Loading branch information
abompard committed Jul 11, 2024
1 parent 7bb65f6 commit d29f1f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def halt_exit_42(message):
raise exceptions.HaltConsumer(exit_code=42, reason="Life, the universe, and everything")


def fail_processing(message):
"""Fail processing message"""
raise ValueError()


@pytest.fixture
def queue(scope="function"):
queue = str(uuid.uuid4())
Expand All @@ -62,6 +67,7 @@ def queue(scope="function"):
[
("halt_exit_0", 0, b"Consumer indicated it wishes consumption to halt"),
("halt_exit_42", 42, b"Life, the universe, and everything"),
("fail_processing", 13, b"Unexpected error occurred in consumer"),
],
)
@pytest_twisted.inlineCallbacks
Expand Down Expand Up @@ -91,5 +97,5 @@ def test_consume_halt_with_exitcode(callback, exit_code, msg, queue, cli_conf):
process.kill()
pytest.fail(f"Process never stopped!: {process.stdout.read()}")

assert process.returncode == exit_code
assert process.returncode == exit_code, process.stderr.read()
assert msg in process.stdout.read()

0 comments on commit d29f1f2

Please sign in to comment.