Branch: refs/heads/master
Home:
https://github.com/tribe29/checkmk
Commit: f42a3179b1378cc4a96261506fa85f7745552f9e
https://github.com/tribe29/checkmk/commit/f42a3179b1378cc4a96261506fa85f774…
Author: Pablo Santiago Blum de Aguiar <pablo.blum(a)tribe29.com>
Date: 2022-01-21 (Fri, 21 Jan 2022)
Changed paths:
M tests/unit/cmk/base/plugins/agent_based/test_kube_pod_restarts.py
Log Message:
-----------
test_kube_pod_restarts: Optionally return an empty fixture
The test in question takes advantage of a mutable fixture (a dictionary
in this case) to assert one aspect of correctness. Basically, it tests
one expected side-effect of the check function.
Relying on a fixture and overriding its object makes resilience tests
fail, as running it once leaves the mutable object in an "invalid"
state for the next iteration.
What makes it an issue is the way with which `pytest-repeat` "tricks"
tests into repeating themselves by adding one additional dimension of
parametrization, which does not trigger a re-assignment of the other
parameters and a consequential reset to their initial states.
To overcome that, the fixture is changed to rely on a flag that tells
whether it should return an empty dict or not. The test can then
override this flag instead of the fixture itself.
Change-Id: I89224cc587dca1ca4d390a3ad32172b99f42eeb8