Skip to content

Commit dcfa059

Browse files
committed
Add tests for #2005
1 parent 32b4e93 commit dcfa059

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/unit/test_housekeeper.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
sonar-housekeeper tests
2525
"""
2626

27+
from collections.abc import Generator
28+
import pytest
29+
2730
import utilities as tutil
2831
from sonar import errcodes
2932
from cli import housekeeper, options
@@ -36,3 +39,14 @@ def test_housekeeper() -> None:
3639
"""test_housekeeper"""
3740
for opts in __GOOD_OPTS:
3841
assert tutil.run_cmd(housekeeper.main, f"{CMD} {tutil.SQS_OPTS} {opts}") == errcodes.OK
42+
43+
def test_keep_branches_override(csv_file: Generator[str]) -> None:
44+
"""test_keep_branches_override"""
45+
if tutil.SQ.version() == "community":
46+
pytest.skip("No branches in Community")
47+
assert tutil.run_cmd(housekeeper.main, f"{CMD} {tutil.SQS_OPTS} -P 730 -T 730 -R 730 -B 90 -f {csv_file}") == errcodes.OK
48+
nbr_br = tutil.csv_col_count_values(csv_file, 1, "BRANCH_LAST_ANALYSIS")
49+
assert tutil.run_cmd(housekeeper.main, f"{CMD} {tutil.SQS_OPTS} -P 730 -T 730 -R 730 -B 90 -f {csv_file} --keepWhenInactive 'dontkeepanything'") == errcodes.OK
50+
# With 'dontkeepanything' as branch regexp, more branches to delete should be found
51+
assert tutil.csv_col_count_values(csv_file, 1, "BRANCH_LAST_ANALYSIS") > nbr_br
52+

0 commit comments

Comments
 (0)