Skip to content

Commit

Permalink
[CVP-3985] add all targeted channels data to parsed_operator_data.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yashvardhannanavati committed Feb 12, 2024
1 parent c3d6a83 commit 170d8cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Dockerfiles/ci/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,36 @@ def test_extract_operator_bundle_with_skiprange_and_without_replaces(self):
print(parsed_output)
self.assertNotIn('olm_replaces', parsed_output)

def test_all_target_channels_parsing(self):
operator_work_dir = "{}/test_all_target_channels_parsing".format(self.test_dir)
work_dir = operator_work_dir
operator_dir = "{}/test-operator".format(operator_work_dir)
operator_bundle_dir = "{}/operator-bundle".format(operator_work_dir)
bundle_image = "quay.io/cvpops/test-operator:parse-channel"
exec_cmd = "ansible-playbook -vvv -i localhost, --connection local \
operator-test-playbooks/extract-operator-bundle.yml \
-e 'operator_dir={operator_dir}' \
-e 'bundle_image={bundle_image}' \
-e 'operator_work_dir={operator_work_dir}' \
-e 'operator_bundle_dir={operator_bundle_dir}' \
-e 'work_dir={work_dir}'".format(operator_dir=operator_dir,
operator_work_dir=operator_work_dir,
operator_bundle_dir=operator_bundle_dir,
bundle_image=bundle_image,
work_dir=work_dir)
playbook_command = subprocess.run(exec_cmd, shell=True)

print(playbook_command.returncode)
self.assertTrue(playbook_command.returncode == 0)
self.assertTrue(path.exists("{}/parsed_operator_data.yml".format(work_dir)))
with open("{}/parsed_operator_data.yml".format(work_dir), "r") as fd:
parsed_output = fd.read()
print(parsed_output)
self.assertNotIn('olm_replaces', parsed_output)
parsed_output = yaml.safe_load(fd)
print(parsed_output)
self.assertEqual('target_channels:\n - "4.10"', parsed_output)

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

Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ operator_feature_token_auth_azure: "{{ operator_feature_token_auth_azure }}"
{% if operator_feature_token_auth_gcp is defined %}
operator_feature_token_auth_gcp: "{{ operator_feature_token_auth_gcp }}"
{% endif %}
{% if channels is defined %}
target_channels:
{% for channel in channels %}
- "{{ channel }}"
{% endfor %}
{% endif %}

0 comments on commit 170d8cb

Please sign in to comment.