-
Notifications
You must be signed in to change notification settings - Fork 119
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
ci: run the smoke tests on a schedule #1387
Merged
tonyandrewmeyer
merged 29 commits into
canonical:main
from
tonyandrewmeyer:regular-smoke-tests
Sep 25, 2024
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e9dc9be
ci: run the smoke tests on a schedule.
tonyandrewmeyer 2244f83
2.9 needs to install with --classic.
tonyandrewmeyer 885c9da
4.0 needs the beta label.
tonyandrewmeyer ce9912f
charmcraft needs --classic.
tonyandrewmeyer 8fca48e
Need the actual repo to run the tests :)
tonyandrewmeyer 05af3ff
Test on lxd and microk8s.
tonyandrewmeyer 2f0d756
pylibjuju on 2.x and 4.x is complex, so just stick with Juju 3 for now.
tonyandrewmeyer c379ea4
Use the tutorial instructions for setting up microk8s.
tonyandrewmeyer 7c686b7
Set up the cloud before Juju.
tonyandrewmeyer 3064046
microk8s needs --classic.
tonyandrewmeyer cced4e6
Fix if statements.
tonyandrewmeyer 7573ca5
Maybe the group instructions are out of date?
tonyandrewmeyer 530553c
Simplify the microk8s install.
tonyandrewmeyer 78aea0d
Use a pre-packaged action to get microk8s.
tonyandrewmeyer c4113ba
Fix the cloud name for k8s.
tonyandrewmeyer aa1e0f6
Run tests as root (ugh).
tonyandrewmeyer 728789c
Install tox for root.
tonyandrewmeyer ad6c711
Use sudo for bootstrapping k8s.
tonyandrewmeyer ec417ca
Use sudo for bootstrapping k8s.
tonyandrewmeyer 5533145
Try to get just k8s working.
tonyandrewmeyer e729106
LXD is required for packing.
tonyandrewmeyer b57a376
Pack ourselves, to work around the permission issue (and does packing…
tonyandrewmeyer 7653ed4
The charm path needs to be absolute or Juju looks in the store.
tonyandrewmeyer 4b57fe7
Try running against Juju 2 and 3.
tonyandrewmeyer 49dccfd
Stick with Juju 3.5 for now.
tonyandrewmeyer 5aed2d3
Bump LXD version.
tonyandrewmeyer 1646ceb
Run pack with verbose.
tonyandrewmeyer f5a5299
Skip the test that needs charmcraft 3 if only charmcraft 2 is installed.
tonyandrewmeyer 0d9c0cc
Handle differences in charmcraft version between 2 and 3.
tonyandrewmeyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: ops Smoke Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 7 25 * *' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# pylibjuju does not currently support Juju 4.x | ||
# The smoke tests do not yet work on Juju 2.9. | ||
juju-version: ['3.5'] | ||
charmcraft-version: ['2.x', '3.x'] | ||
cloud: ['lxd', 'microk8s'] | ||
|
||
env: | ||
JUJU_VERSION: "${{ matrix.juju-version }}" | ||
|
||
steps: | ||
# LXD is required for charmcraft to pack, even if it's not used as the | ||
# Juju cloud. | ||
- name: Set up LXD | ||
uses: canonical/setup-lxd@8fb85546a934dfb994becf81341dd387ffe6aabb | ||
with: | ||
channel: 5.0/stable | ||
|
||
- name: Set up Microk8s | ||
if: matrix.cloud == 'microk8s' | ||
uses: balchua/[email protected] | ||
with: | ||
channel: '1.26-strict/stable' | ||
devMode: 'true' | ||
addons: '["dns", "hostpath-storage"]' | ||
|
||
- name: Set up Juju (classic) | ||
if: matrix.juju-version == '2.9' | ||
run: sudo snap install juju --classic --channel=${{ matrix.juju-version }} | ||
|
||
- name: Set up Juju | ||
if: matrix.juju-version != '2.9' | ||
run: sudo snap install juju --channel=${{ matrix.juju-version }} | ||
|
||
- name: Bootstrap Juju controller (k8s) | ||
if: matrix.cloud == 'microk8s' | ||
run: sg snap_microk8s -c 'juju bootstrap microk8s' | ||
|
||
- name: Bootstrap Juju controller (lxd) | ||
if: matrix.cloud == 'lxd' | ||
run: juju bootstrap localhost | ||
|
||
- name: Install charmcraft | ||
run: sudo snap install charmcraft --channel=${{ matrix.charmcraft-version }} --classic | ||
|
||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
|
||
- name: Install tox | ||
run: pip install tox~=4.2 | ||
|
||
- name: Run smoke tests | ||
run: tox -e smoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ description = Run a smoke test against a Juju controller. | |
allowlist_externals = juju | ||
charmcraft | ||
bash | ||
passenv = JUJU_VERSION | ||
deps = | ||
build | ||
coverage[toml]~=7.0 | ||
|
@@ -147,6 +148,8 @@ commands = | |
python -m build --sdist --outdir={toxinidir}/test/charms/test_smoke/ | ||
# Inject the tarball into the smoke test charm's requirements. | ||
bash -c 'echo "./$(ls -1 ./test/charms/test_smoke/ | grep tar.gz)" > ./test/charms/test_smoke/requirements.txt' | ||
# If a specific Juju version is set, then make sure we are using that version of pylibjuju. | ||
bash -c 'if [ -n "$JUJU_VERSION" ]; then pip install "juju ~= $JUJU_VERSION"; fi' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clever! |
||
|
||
# Run our smoke tests (this will build the charm, then run the tests). | ||
pytest -v --tb native --log-cli-level=INFO -s {posargs} {toxinidir}/test/smoke/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we just drop the "if 2.9" stuff here, seeing we're not running these on 2.9? Or do you think we should add that in the near future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good question. I started out planning to do 2.9, 3.[latest stable], and 4.0, thinking that would be a good range of coverage. 2.9 because it's still in "security fix support" and seems to have non-trivial use still, 3.[latest stable] because it seems unlikely that we'd break deploying only for one 3.x, and 4.0 because it's good to be proactive. I then ran into a bunch of issues and ended up dropping down to just 3.x.
tox -e smoke
passes for me (except for trying to deploy on 24.04) locally, so I think it shouldn't be too much work to get it working in CI as well. I'd like to use a quite small amount of time to try to get that going and if not dropping it would make sense yes. I could cut it from this PR and add it back later if that was preferred.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'm happy either way -- no specific urgency on this.