Skip to content

Commit 817136c

Browse files
authored
Fix elliott functional tests (#1387)
* Initial commit * add group * Comment out broken tests * fixes
1 parent 8579fb0 commit 817136c

13 files changed

+205
-288
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ unit:
1919
./.venv/bin/python -m pytest --verbose --color=yes pyartcd/tests/
2020
./.venv/bin/python -m pytest --verbose --color=yes ocp-build-data-validator/tests/
2121

22+
functional-elliott:
23+
./.venv/bin/python -m pytest --verbose --color=yes elliott/functional_tests/
24+
2225
test: lint unit
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
22
from elliottlib import constants as elliott_constants
33

4-
ELLIOTT_CMD = [sys.executable, "-m", "elliottlib.cli", "--quiet"]
4+
ELLIOTT_CMD = [sys.executable, "-m", "elliottlib.cli"]
55
ERRATA_TOOL_URL = elliott_constants.errata_url

elliott/functional_tests/test_change_state.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@
44

55

66
class ChangeStateTestCase(unittest.TestCase):
7-
def test_change_state(self):
8-
out = subprocess.check_output(
9-
constants.ELLIOTT_CMD
10-
+ [
11-
"--group=openshift-3.9", "change-state", "--state=QE", "--advisory=47924",
12-
],
13-
)
14-
self.assertIn("current state is SHIPPED_LIVE", out.decode("utf-8"))
7+
def test_change_state_fail(self):
8+
cmd = constants.ELLIOTT_CMD + [
9+
"--group=openshift-4.2",
10+
"change-state",
11+
"--state=QE",
12+
"--advisory=49645",
13+
]
14+
result = subprocess.run(cmd, capture_output=True)
15+
self.assertEqual(result.returncode, 1)
16+
self.assertIn("Cannot change state from SHIPPED_LIVE to QE", result.stderr.decode())
17+
18+
def test_change_state_from(self):
19+
cmd = constants.ELLIOTT_CMD + [
20+
"--group=openshift-4.2",
21+
"change-state",
22+
"--from=NEW_FILES",
23+
"--state=QE",
24+
"--advisory=49645",
25+
]
26+
result = subprocess.run(cmd, capture_output=True)
27+
self.assertEqual(result.returncode, 0, msg=f"stdout: {result.stdout.decode()}, stderr: {result.stderr.decode()}")
28+
self.assertIn("Current state is not NEW_FILES: SHIPPED_LIVE", result.stdout.decode())
1529

1630

1731
if __name__ == '__main__':

elliott/functional_tests/test_find_bugs_qe.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55

66
class FindBugsQETestCase(unittest.TestCase):
77
def test_find_bugs_qe(self):
8-
out = subprocess.check_output(
9-
constants.ELLIOTT_CMD
10-
+ [
11-
"--assembly=stream", "--group=openshift-4.6", "find-bugs:qe", '--noop'
12-
]
13-
)
14-
result = out.decode("utf-8")
15-
self.assertRegex(result, "Found \\d+ bugs")
8+
cmd = constants.ELLIOTT_CMD + [
9+
"--assembly=stream", "--group=openshift-4.6", "find-bugs:qe", '--noop'
10+
]
11+
result = subprocess.run(cmd, capture_output=True)
12+
self.assertEqual(result.returncode, 0,
13+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
14+
self.assertRegex(result.stderr.decode(), "Found \\d+ bugs")
1615

1716

1817
if __name__ == '__main__':

elliott/functional_tests/test_find_bugs_sweep.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
class FindBugsSweepTestCase(unittest.TestCase):
77
def test_sweep_bugs(self):
8-
out = subprocess.check_output(
9-
constants.ELLIOTT_CMD
10-
+ [
11-
"--group=openshift-4.11", "--assembly=rc.7", "find-bugs:sweep", "--check-builds",
12-
"--into-default-advisories", "--noop"
13-
]
14-
)
15-
self.assertRegex(out.decode("utf-8"), "Found \\d+ bugs")
8+
cmd = constants.ELLIOTT_CMD + [
9+
"--group=openshift-4.11",
10+
"--assembly=4.11.36", # This assembly has a pinned bug
11+
"find-bugs:sweep"
12+
]
13+
result = subprocess.run(cmd, capture_output=True)
14+
self.assertEqual(result.returncode, 0,
15+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
16+
self.assertRegex(result.stdout.decode(), "Found \\d+ bugs")
1617

1718

1819
if __name__ == '__main__':

elliott/functional_tests/test_find_builds.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44

55
# This test may start failing once this version is EOL and we either change the
66
# ocp-build-data bugzilla schema or all of the non-shipped builds are garbage-collected.
7-
version = "4.3"
7+
version = "4.12"
88

99

1010
class FindBuildsTestCase(unittest.TestCase):
1111
def test_find_rpms(self):
12-
out = subprocess.check_output(
13-
constants.ELLIOTT_CMD
14-
+ [
15-
"--assembly=stream", f"--group=openshift-{version}", "find-builds", "--kind=rpm",
16-
]
17-
)
18-
self.assertIn("may be attached to an advisory", out.decode("utf-8"))
12+
cmd = constants.ELLIOTT_CMD + [
13+
"--assembly=stream", f"--group=openshift-{version}", "find-builds", "--kind=rpm",
14+
]
15+
result = subprocess.run(cmd, capture_output=True)
16+
self.assertEqual(result.returncode, 0,
17+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
18+
self.assertRegex(result.stderr.decode(), "Found \\d+ builds")
1919

2020
def test_find_images(self):
21-
out = subprocess.check_output(
22-
constants.ELLIOTT_CMD
23-
+ [
24-
f"--group=openshift-{version}", "-i", "openshift-enterprise-cli", "find-builds", "--kind=image",
25-
]
26-
)
27-
self.assertIn("may be attached to an advisory", out.decode("utf-8"))
21+
cmd = constants.ELLIOTT_CMD + [
22+
f"--group=openshift-{version}", "-i", "openshift-enterprise-cli", "find-builds", "--kind=image",
23+
]
24+
result = subprocess.run(cmd, capture_output=True)
25+
self.assertEqual(result.returncode, 0,
26+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
27+
self.assertRegex(result.stderr.decode(), "Found \\d+ builds")
2828

2929
def test_change_state(self):
3030
"""To attach a build to an advisory, it will be attempted to set the
@@ -40,7 +40,8 @@ def test_change_state(self):
4040
]
4141
result = subprocess.run(command, capture_output=True)
4242

43-
self.assertEqual(result.returncode, 1)
43+
self.assertEqual(result.returncode, 1,
44+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
4445
self.assertIn('Cannot change state', result.stdout.decode())
4546

4647

elliott/functional_tests/test_get.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55

66
class GetTestCase(unittest.TestCase):
7-
def test_get_errutum(self):
8-
out = subprocess.check_output(constants.ELLIOTT_CMD + ["get", "49982"])
9-
self.assertIn("49982", out.decode("utf-8"))
7+
def test_get_erratum(self):
8+
cmd = constants.ELLIOTT_CMD + ["get", "49982"]
9+
result = subprocess.run(cmd, capture_output=True)
10+
self.assertEqual(result.returncode, 0,
11+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
12+
self.assertIn("49982", result.stdout.decode())
1013

11-
def test_get_errutum_with_group(self):
12-
out = subprocess.check_output(constants.ELLIOTT_CMD + ["--assembly=stream", "--group=openshift-4.2", "get", "--use-default-advisory", "rpm"])
13-
self.assertIn(constants.ERRATA_TOOL_URL, out.decode("utf-8"))
14+
def test_get_erratum_with_group(self):
15+
cmd = constants.ELLIOTT_CMD + ["--assembly=stream", "--group=openshift-4.2", "get", "--use-default-advisory", "rpm"]
16+
result = subprocess.run(cmd, capture_output=True)
17+
self.assertEqual(result.returncode, 0,
18+
msg=f"stdout: {result.stdout.decode()}\nstderr: {result.stderr.decode()}")
19+
self.assertIn(constants.ERRATA_TOOL_URL, result.stdout.decode())
1420

1521

1622
if __name__ == '__main__':

elliott/functional_tests/test_list.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

elliott/functional_tests/test_poll_signed.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

elliott/functional_tests/test_rpmdiff.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)