Skip to content

Commit 8140c26

Browse files
committed
Add deprecated bundle CI unit tests
1 parent bc44620 commit 8140c26

File tree

5 files changed

+131
-3
lines changed

5 files changed

+131
-3
lines changed

.github/workflows/build_and_test_upstream_ci_image.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,19 @@ jobs:
3030
- name: "Run example default positive operator bundle --> positive test"
3131
continue-on-error: false
3232
run: |
33-
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-default-positive:/project/output -v ./Dockerfiles/ci/example-bundle-default-positive:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_success -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest
33+
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-v45-v49:/project/output -v ./Dockerfiles/ci/example-bundle-default-positive:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_success -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest
3434
3535
- name: "Run example default negative operator bundle --> negative test"
3636
continue-on-error: false
3737
run: |
38-
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-default-positive:/project/output -v ./Dockerfiles/ci/example-bundle-default-negative:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_failure -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest
38+
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-v45-v49:/project/output -v ./Dockerfiles/ci/example-bundle-default-negative:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_failure -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest
39+
40+
- name: "Run example v48 operator bundle --> positive test"
41+
continue-on-error: false
42+
run: |
43+
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-v45-v48:/project/output -v ./Dockerfiles/ci/example-bundle-default-negative:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_failure -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest
44+
45+
- name: "Run example v43 operator bundle --> negative test"
46+
continue-on-error: false
47+
run: |
48+
podman run -it -v $PWD:/project/operator-test-playbooks -v ./Dockerfiles/ci/example-workdir-v43-v44:/project/output -v ./Dockerfiles/ci/example-bundle-default-negative:/project/test_operator_work_dir -e TEST_NAME=test_validate_default_operator_bundle_failure -e WORK_DIR=/project/output -e OPERATOR_WORK_DIR=/project/test_operator_work_dir/ upstream_ci_image:latest

Dockerfiles/ci/example-workdir-default-positive/bundle-skopeo-inspect.json renamed to Dockerfiles/ci/example-workdir-v43-v44/bundle-skopeo-inspect.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"com.redhat.delivery.backport": "true",
1212
"com.redhat.delivery.operator.bundle": "true",
1313
"com.redhat.license_terms": "https://www.redhat.com/agreements",
14-
"com.redhat.openshift.versions": "v4.5",
14+
"com.redhat.openshift.versions": "v4.3-v4.4",
1515
"description": "This is a testing operator used by Vital",
1616
"distribution-scope": "private",
1717
"io.k8s.description": "This is a testing operator used by Vital",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"Digest": "sha256:3dbed3d785b4492751f823af3f55d17232d99a3719f64431fe29a595b3610fa8",
3+
"RepoTags": [],
4+
"Created": "2021-09-03T08:25:53.822713258Z",
5+
"DockerVersion": "",
6+
"Labels": {
7+
"architecture": "x86_64",
8+
"build-date": "2021-09-03T08:25:48.020568",
9+
"com.redhat.build-host": "cpt-1007.osbs.stage.upshift.rdu2.redhat.com",
10+
"com.redhat.component": "e2e-test-operator-bundle-container",
11+
"com.redhat.delivery.backport": "true",
12+
"com.redhat.delivery.operator.bundle": "true",
13+
"com.redhat.license_terms": "https://www.redhat.com/agreements",
14+
"com.redhat.openshift.versions": "v4.5-v4.8",
15+
"description": "This is a testing operator used by Vital",
16+
"distribution-scope": "private",
17+
"io.k8s.description": "This is a testing operator used by Vital",
18+
"io.k8s.display-name": "E2E Test Operator",
19+
"maintainer": "Pipeline Vitals Testing <[email protected]>",
20+
"name": "e2e/e2e-test-operator-bundle-container",
21+
"operators.operatorframework.io.bundle.channel.default.v1": "4.3",
22+
"operators.operatorframework.io.bundle.channels.v1": "4.3",
23+
"operators.operatorframework.io.bundle.manifests.v1": "manifests/",
24+
"operators.operatorframework.io.bundle.mediatype.v1": "registry+v1",
25+
"operators.operatorframework.io.bundle.metadata.v1": "metadata/",
26+
"operators.operatorframework.io.bundle.package.v1": "e2e-test-operator",
27+
"release": "11",
28+
"url": "https://access.qa.redhat.com/containers/#/registry.access.redhat.com/e2e/e2e-test-operator-bundle-container/images/8.0-11",
29+
"vcs-ref": "dca3a174a3aedb3a80be62869304e6e0250cc272",
30+
"vcs-type": "git",
31+
"vendor": "Red Hat, Inc.",
32+
"version": "8.0"
33+
},
34+
"Architecture": "amd64",
35+
"Os": "linux",
36+
"Layers": [
37+
"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4",
38+
"sha256:37e63b1455f2ff52651ced1249a27c3ae6e1b603d2f7cbc338de21cd19778cd4"
39+
],
40+
"Env": [
41+
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
42+
]
43+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"Digest": "sha256:3dbed3d785b4492751f823af3f55d17232d99a3719f64431fe29a595b3610fa8",
3+
"RepoTags": [],
4+
"Created": "2021-09-03T08:25:53.822713258Z",
5+
"DockerVersion": "",
6+
"Labels": {
7+
"architecture": "x86_64",
8+
"build-date": "2021-09-03T08:25:48.020568",
9+
"com.redhat.build-host": "cpt-1007.osbs.stage.upshift.rdu2.redhat.com",
10+
"com.redhat.component": "e2e-test-operator-bundle-container",
11+
"com.redhat.delivery.backport": "true",
12+
"com.redhat.delivery.operator.bundle": "true",
13+
"com.redhat.license_terms": "https://www.redhat.com/agreements",
14+
"com.redhat.openshift.versions": "v4.5-v4.9",
15+
"description": "This is a testing operator used by Vital",
16+
"distribution-scope": "private",
17+
"io.k8s.description": "This is a testing operator used by Vital",
18+
"io.k8s.display-name": "E2E Test Operator",
19+
"maintainer": "Pipeline Vitals Testing <[email protected]>",
20+
"name": "e2e/e2e-test-operator-bundle-container",
21+
"operators.operatorframework.io.bundle.channel.default.v1": "4.3",
22+
"operators.operatorframework.io.bundle.channels.v1": "4.3",
23+
"operators.operatorframework.io.bundle.manifests.v1": "manifests/",
24+
"operators.operatorframework.io.bundle.mediatype.v1": "registry+v1",
25+
"operators.operatorframework.io.bundle.metadata.v1": "metadata/",
26+
"operators.operatorframework.io.bundle.package.v1": "e2e-test-operator",
27+
"release": "11",
28+
"url": "https://access.qa.redhat.com/containers/#/registry.access.redhat.com/e2e/e2e-test-operator-bundle-container/images/8.0-11",
29+
"vcs-ref": "dca3a174a3aedb3a80be62869304e6e0250cc272",
30+
"vcs-type": "git",
31+
"vendor": "Red Hat, Inc.",
32+
"version": "8.0"
33+
},
34+
"Architecture": "amd64",
35+
"Os": "linux",
36+
"Layers": [
37+
"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4",
38+
"sha256:37e63b1455f2ff52651ced1249a27c3ae6e1b603d2f7cbc338de21cd19778cd4"
39+
],
40+
"Env": [
41+
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
42+
]
43+
}

Dockerfiles/ci/run_tests.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,38 @@ def test_validate_default_operator_bundle_failure(self):
5353
print(validation_rc)
5454
self.assertEqual(validation_rc, "1")
5555

56+
def test_validate_v48_operator_bundle_success(self):
57+
exec_cmd = "ansible-playbook -vvv -i localhost, --connection local \
58+
operator-test-playbooks/validate-operator-bundle.yml \
59+
-e 'operator_dir={operator_dir}' \
60+
-e 'operator_work_dir={operator_work_dir}' \
61+
-e 'work_dir={work_dir}'".format(operator_dir=self.operator_dir,
62+
operator_work_dir=self.operator_work_dir,
63+
work_dir=self.work_dir)
64+
subprocess.run(exec_cmd, shell=True)
65+
self.assertTrue(path.exists("{}/validation-rc.txt".format(self.work_dir)))
66+
self.assertTrue(path.exists("{}/validation-output.txt".format(self.work_dir)))
67+
with open("{}/validation-rc.txt".format(self.work_dir), "r") as fd:
68+
validation_rc = fd.read()
69+
print(validation_rc)
70+
self.assertEqual(validation_rc, "0")
71+
72+
def test_validate_v43_operator_bundle_failure(self):
73+
exec_cmd = "ansible-playbook -vvv -i localhost, --connection local \
74+
operator-test-playbooks/validate-operator-bundle.yml \
75+
-e 'operator_dir={operator_dir}' \
76+
-e 'operator_work_dir={operator_work_dir}' \
77+
-e 'work_dir={work_dir}'".format(operator_dir=self.operator_dir,
78+
operator_work_dir=self.operator_work_dir,
79+
work_dir=self.work_dir)
80+
subprocess.run(exec_cmd, shell=True)
81+
self.assertTrue(path.exists("{}/validation-rc.txt".format(self.work_dir)))
82+
self.assertTrue(path.exists("{}/validation-output.txt".format(self.work_dir)))
83+
with open("{}/validation-rc.txt".format(self.work_dir), "r") as fd:
84+
validation_rc = fd.read()
85+
print(validation_rc)
86+
self.assertEqual(validation_rc, "1")
87+
5688

5789
if __name__ == '__main__':
5890
test_name = os.getenv('TEST_NAME')

0 commit comments

Comments
 (0)