Skip to content

Commit 05c3232

Browse files
authored
Merge pull request #256 from dirgim/ensure-parsed-operator-data
[CVP-2407] Ensure correct data types in parsed_operator_data.yml
2 parents 4a2edf3 + 60ec037 commit 05c3232

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

Dockerfiles/ci/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ RUN export ARCH=$(case $(arch) in x86_64) echo -n amd64 ;; aarch64) echo -n arm6
88
chmod a+x /usr/local/bin/operator-sdk && \
99
curl -fL -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/2.2.1/yq_linux_amd64 && \
1010
chmod a+x /usr/local/bin/yq && \
11+
curl -fL -o /usr/local/bin/umoci https://github.com/opencontainers/umoci/releases/download/v0.4.5/umoci.amd64 && \
12+
chmod a+x /usr/local/bin/umoci && \
1113
mkdir /project/output && \
12-
dnf install --setopt=install_weak_deps=False -y git-core ansible python3-pip mlocate jq && \
14+
dnf install --setopt=install_weak_deps=False -y git-core ansible python3-pip mlocate jq skopeo && \
1315
dnf clean all && \
1416
pip3 install operator-courier
1517
ADD ./run_tests.py /run_tests.py

Dockerfiles/ci/run_tests.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,38 @@ def test_prepare_metadata_without_alm_annotations_success(self):
3737
print(result_output)
3838
self.assertEqual(result_output["result"], "pass")
3939

40+
def test_extract_operator_bundle_430_channel_success(self):
41+
operator_work_dir = "{}/test_extract_operator_bundle_430_channel_success".format(self.test_dir)
42+
work_dir = operator_work_dir
43+
operator_dir = "{}/test-operator".format(operator_work_dir)
44+
operator_bundle_dir = "{}/operator-bundle".format(operator_work_dir)
45+
bundle_image = "quay.io/cvpops/test-operator:test-430-channel-positive-v1"
46+
exec_cmd = "ansible-playbook -vvv -i localhost, --connection local \
47+
operator-test-playbooks/extract-operator-bundle.yml \
48+
-e 'operator_dir={operator_dir}' \
49+
-e 'bundle_image={bundle_image}' \
50+
-e 'operator_work_dir={operator_work_dir}' \
51+
-e 'operator_bundle_dir={operator_bundle_dir}' \
52+
-e 'work_dir={work_dir}'".format(operator_dir=operator_dir,
53+
operator_work_dir=operator_work_dir,
54+
operator_bundle_dir=operator_bundle_dir,
55+
bundle_image=bundle_image,
56+
work_dir=work_dir)
57+
playbook_command = subprocess.run(exec_cmd, shell=True)
58+
59+
print(playbook_command.returncode)
60+
self.assertTrue(playbook_command.returncode == 0)
61+
self.assertTrue(path.exists("{}/parsed_operator_data.yml".format(work_dir)))
62+
with open("{}/parsed_operator_data.yml".format(work_dir), "r") as fd:
63+
parsed_output = fd.read()
64+
print(parsed_output)
65+
self.assertIn('package_name: "e2e-test-operator"', parsed_output)
66+
self.assertIn('current_csv: "e2e-test-operator.4.3.1-202002032140"', parsed_output)
67+
self.assertIn('current_channel: "4.30"', parsed_output)
68+
self.assertIn('is_bundle_image: True', parsed_output)
69+
self.assertIn('is_backport: True', parsed_output)
70+
self.assertIn('ocp_versions: "v4.5"', parsed_output)
71+
4072
def test_validate_default_operator_bundle_success(self):
4173
operator_work_dir = "{}/example-bundle-default-positive".format(self.test_dir)
4274
work_dir = "{}/example-workdir-v45-v49".format(self.test_dir)
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package_name: {{ package_name }}
1+
package_name: "{{ package_name }}"
22
is_bundle_image: {{ is_bundle_image }}
33
is_backport: {{ is_backport }}
4-
current_channel: {{ current_channel }}
5-
default_channel: {{ default_channel }}
6-
current_csv_dir: {{ current_csv_dir }}
7-
current_csv: {{ current_csv }}
8-
csv_path: {{ csv_path }}
9-
operator_pod_name: {{ operator_pod_name }}
10-
operator_capabilities: {{ operator_capabilities }}
11-
operator_container_name: {{ operator_container_name }}
4+
current_channel: "{{ current_channel }}"
5+
default_channel: "{{ default_channel }}"
6+
current_csv_dir: "{{ current_csv_dir }}"
7+
current_csv: "{{ current_csv }}"
8+
csv_path: "{{ csv_path }}"
9+
operator_pod_name: "{{ operator_pod_name }}"
10+
operator_capabilities: "{{ operator_capabilities }}"
11+
operator_container_name: "{{ operator_container_name }}"
1212
operator_allnamespaces_support: {{ operator_allnamespaces_support }}
1313
operator_ownnamespace_support: {{ operator_ownnamespace_support }}
1414
operator_singlenamespace_support: {{ operator_singlenamespace_support }}
@@ -21,4 +21,4 @@ crd_paths:
2121
- {{ crd_path }}
2222
{% endfor %}
2323
{% endif %}
24-
ocp_versions: {{ ocp_versions }}
24+
ocp_versions: "{{ ocp_versions }}"

0 commit comments

Comments
 (0)