Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Test against multiple versions of operator-courier. #67

Merged
merged 2 commits into from Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Expand Up @@ -4,11 +4,19 @@ matrix:
include:
- dist: trusty
python: "3.6"
env: TOXENV=py36
env: TOXENV=py36-courier_released
after_success: coveralls
- dist: xenial
python: "3.7"
env: TOXENV=py37
env: TOXENV=py37-courier_released
after_success: coveralls
- dist: trusty
python: "3.6"
env: TOXENV=py36-courier_master
after_success: coveralls
- dist: xenial
python: "3.7"
env: TOXENV=py37-courier_master
after_success: coveralls
- dist: xenial
python: "3.7"
Expand Down
7 changes: 6 additions & 1 deletion omps/manifests_util.py
Expand Up @@ -49,6 +49,11 @@ def bundle(self):
def package_name(self):
"""Returns defined package name from operator bundle"""
# op. courier do verification, this should be never empty
pkgs_yaml = self.bundle['data']['packages']
if hasattr(self.bundle, 'bundle'):
# New, op. courier >= 2.0.0
pkgs_yaml = self.bundle.bundle['data']['packages']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to point out that this will only work in the flat directory case. In the operator-registry manifest format, we don't return anything on this field.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack - @kevinrizza can you recommend an approach that will handle both cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, here we're always calling _flatten_manifest_structure before accessing the bundle (up in omps/api/v1/push.py).

else:
# Old, op. courier < 2.0.0
pkgs_yaml = self.bundle['data']['packages']
pkgs = yaml.safe_load(io.StringIO(pkgs_yaml))
return pkgs[0]['packageName']
7 changes: 5 additions & 2 deletions tox.ini
@@ -1,8 +1,11 @@
[tox]
envlist = py36,py37,flake8
envlist = py{36,37}-courier_{released,master},flake8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could py{36,37}-courier_released,flake8} be the default envlist, and *-courier_master be available only through tox -e? All this in order to lower test execution time while developing and calling tox locally. Travis will run all the flavors in the end.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, although - I'm not sure how to accomplish that in a tox.ini config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
envlist = py{36,37}-courier_{released,master},flake8
envlist = py{36,37}-courier_released,flake8

Will do the job, but README.md will need an update to document that tox -e 'py{36,37}-courier_master' can be used to test with the latest version of Operator Courier. This is required, b/c tox -l and tox -a will not list these environments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack - should be fixed.


[testenv]
deps = .[test]
deps =
courier_master: -e git://github.com/operator-framework/operator-courier#egg=operatorcourier
courier_released: operator-courier
.[test]
commands = pytest --cov=omps --ignore=tests/integration tests/

[coverage:report]
Expand Down