Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest_operator_cache prevents non-cached build_charm #82

Closed
paulomach opened this issue Aug 24, 2023 · 5 comments
Closed

pytest_operator_cache prevents non-cached build_charm #82

paulomach opened this issue Aug 24, 2023 · 5 comments

Comments

@paulomach
Copy link

Plugin pytest_operator_cache will always try to use cached charm file.
Maybe fallback (here?) to use pytest_operator.build_charm?

Use-case for the mysql upgrade rollback test, where we need to refresh with a faulty charm.
The test and the error

@github-actions
Copy link

@carlcsaposs-canonical
Copy link
Contributor

This is by design—so that caching fails with an error instead of failing silently.

Also, how would the plugin differentiate between two different builds of the same charm? i.e. two calls to ops_test.build_charm(".")—should the cache be used in both, one, or neither of those cases?

It looks like we need to add an option to build without the cache (maybe an ops_test.build_charm_without_cache), but I don't think it should be an automatic fallback

@carlcsaposs-canonical carlcsaposs-canonical changed the title cached build_charm has no way to enforce a build pytest_operator_cache prevents non-cached build_charm Aug 24, 2023
@paulomach
Copy link
Author

paulomach commented Aug 24, 2023

I see your point.
I like the suggestion of having an explicit method ops_test.build_charm_without_cache that frontends to pytest_operator's ops_test.build_charm

@carlcsaposs-canonical
Copy link
Contributor

Found another solution: unzip the .charm file, modify the charm, and rezip the .charm file

This prevents adding 1 hour+ to the upgrade integration test (from using a non-cached build)

@carlcsaposs-canonical carlcsaposs-canonical closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2023
@carlcsaposs-canonical
Copy link
Contributor

In the future, if it's necessary to build multiple versions of the same charm using the cached workflow, it may be possible to add this functionality to the workflow. This might be a better solution if the modifications become more complex (e.g. modifying the charmcraft.yaml file), but for simple modifications, unzipping & rezipping the .charm file seems much simpler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants