Skip to content

Commit 6440fb6

Browse files
committed
Updates to tests for deprecated APIs check
1 parent ad3e266 commit 6440fb6

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

Dockerfiles/ci/run_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,11 @@ def test_for_report_success_empty_alm_examples(self):
3535
print(result_output)
3636
self.assertEqual(result_output["result"], "pass")
3737

38+
3839
if __name__ == '__main__':
39-
unittest.main()
40+
test_name = os.getenv('TEST_NAME', "test_for_report_success_empty_alm_examples")
41+
suite = unittest.TestSuite()
42+
suite.addTest(RunOperatorTestPlaybookTests(test_name))
43+
runner = unittest.TextTestRunner()
44+
runner.run(suite)
45+

Dockerfiles/midstream/unit_tests.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_default_negative(self):
9191
cwd=OUTPUT_DIR)
9292
self.assertEqual(70, result.returncode)
9393
# check if the .errormessage file generated is empty
94-
self.assertTrue(os.stat("/tmp/.errormessage").st_size != 0)
94+
self.assertTrue(os.stat(OUTPUT_DIR+".errormessage").st_size != 0)
9595
# check if the .errormessage exists since its a logger file
9696
self.assertTrue(os.path.exists(OUTPUT_DIR+".errormessage"))
9797
message = self.get_error_message_content()
@@ -107,10 +107,26 @@ def test_default_positive(self):
107107
cwd=OUTPUT_DIR)
108108
self.assertEqual(0, result.returncode)
109109
# check if the .errormessage file generated is empty
110-
self.assertTrue(os.stat("/tmp/.errormessage").st_size == 0)
110+
self.assertTrue(os.stat(OUTPUT_DIR+".errormessage").st_size == 0)
111111
# check if the .errormessage exists since its a logger file
112112
self.assertTrue(os.path.exists(OUTPUT_DIR+".errormessage"))
113113

114+
# Run with a test-operator that does not support v4.9 or above which passes the
115+
# bundle image validation job
116+
def test_default_positive_below_4_9(self):
117+
self.env["IMAGE_TO_TEST"] = "quay.io/cvpops/test-operator:test-default-positive-below-4.9-v1"
118+
result = subprocess.run(self.exec_cmd,
119+
shell=True,
120+
env=self.env,
121+
cwd=OUTPUT_DIR,
122+
stdout=subprocess.PIPE,
123+
text=True)
124+
self.assertEqual(0, result.returncode)
125+
# check if the .errormessage file generated is empty
126+
self.assertTrue(os.stat(OUTPUT_DIR+".errormessage").st_size == 0)
127+
# check if the .errormessage exists since its a logger file
128+
self.assertTrue(os.path.exists(OUTPUT_DIR+".errormessage"))
129+
self.assertIn(result.stdout, '"support_v4_9": false', "Could not verify that support_v4_9 was set to false")
114130

115131
if __name__ == '__main__':
116132
unittest.main()

roles/validate_operator_bundle/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
- name: "Fail if Pyxis response is not 200"
6161
fail:
62-
msg: "Error collecting OCP version range from Pyxis. Error message: {{ supported_indices_json.content }}"
62+
msg: "Error collecting OCP version range from Pyxis - status {{ supported_indices_json.status }}. Error message: {{ supported_indices_json.content }}"
6363
when: supported_indices_json.status != 200
6464

6565
- name: "Convert output to map"
@@ -71,8 +71,8 @@
7171
msg: "Indices: {{ supported_indices['data'] }}"
7272

7373
- name: "Set support_v4_9 to false if there are no supported versions"
74-
set_fact:
75-
support_v4_9: false
74+
fail:
75+
msg: "No supported OCP versions found in Pyxis. Please verify that the version label '{{ ocp_version_annotation }} 'is valid and includes a currently-supported OCP version"
7676
when: supported_indices['data']|length==0
7777

7878
- name: "Parse values returned from Pyxis"

0 commit comments

Comments
 (0)