osmith has uploaded this change for review.

View Change

tests: add test_gerrit_verifications

Change-Id: I6139e0385470e4c0c48d8a698f67645ac1605cbc
---
A .pytest.ini
A tests/test_gerrit_verifications.py
2 files changed, 32 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/41/43241/1
diff --git a/.pytest.ini b/.pytest.ini
new file mode 100644
index 0000000..1992657
--- /dev/null
+++ b/.pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+addopts = --tb=no
+testpaths = tests
diff --git a/tests/test_gerrit_verifications.py b/tests/test_gerrit_verifications.py
new file mode 100644
index 0000000..05b665c
--- /dev/null
+++ b/tests/test_gerrit_verifications.py
@@ -0,0 +1,29 @@
+import re
+from pathlib import Path
+
+
+def test_gerrit_verifications_binpkgs():
+ """Ensure we don't use more parameters for pipeline_binpkgs than the
+ pipeline can handle."""
+ yml = Path(Path(__file__) / "../../jobs/gerrit-verifications.yml").resolve()
+ regex = re.compile(r'.*pipeline_binpkgs:.*"(.*)"')
+
+ with open(yml) as f:
+ num = 0
+ for line in f:
+ num += 1
+
+ if "pipeline_binpkgs:" not in line:
+ continue
+
+ prefix = f"\n\njobs/gerrit_verifications.yml:{num}: {line}\nERROR"
+
+ match = regex.match(line)
+ assert match, f"{prefix}: failed to read pipeline_binpkgs"
+
+ count = len(match.group(1).split(" "))
+ count_max = 5
+ assert count < count_max, (
+ f"{prefix}: found {count} parameters, but max is currently {count_max}!"
+ " Adjust the 'dsl' section in the yml file and count_max in this test."
+ )

To view, visit change 43241. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I6139e0385470e4c0c48d8a698f67645ac1605cbc
Gerrit-Change-Number: 43241
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>