Skip to content

Frontend charm integration tests fix with a self hosted runner - #54

Closed
mz2 wants to merge 56 commits into
mainfrom
integration-test-fix-with-hosted-runners
Closed

Frontend charm integration tests fix with a self hosted runner#54
mz2 wants to merge 56 commits into
mainfrom
integration-test-fix-with-hosted-runners

Conversation

@mz2

@mz2 mz2 commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

Integration tests for the frontend charm now actually work also on GitHub!

The workflow looks to be stable, with a dozen passes witnessed today.

It does however take ~10mins to run and I figured we would therefore not start running it on every commit to every branch (6+ mins of the time is taken by the microk8s setup -- we can drop this in a big way with custom images used for the CI runs when that becomes available). It runs on:

  • all branches once a PR review has been posted for the branch for which there is a PR open
  • all branches with a PR which touch resources under ./frontend/charm (the integration tests can capture failures also in resources outside that directory, hence the rule above also).
  • on the main branch
  • on version tagged commits
  • manually via workflow dispatch

The workflow was refactored to reuse two now introduced reusable composite actions in https://github.com/canonical/certification-github-workflows (the first PR to that repo should be reviewed and merged first before this goes in).

NOTE! When squashing this into main, please edit the commit message heavily down in volume since this contains a few months worth of desperate debugging attempts of these integration tests that continued to work locally just fine but failed to be executed specifically on GitHub up until now. I have simplified the version history with some squashing but since there are several merge commits there I didn't want to do anything more drastic than that.

mz2 and others added 30 commits June 7, 2023 11:49
…n blocked status (more scenarios needed to actually relate the frontend to the backend).
…state where relation is not yet connected.

Simplified the charm logic, no _stored state needed (fetching the hostname and port from the relation's application data bag).
Let's try with the microk8s version and libpyjuju < 3.1 that seems to work for rout53-acme-operator where the integration test pipeline is pulled from
@mz2 mz2 changed the title Integration test fix with hosted runners Frontend charm integration tests fix with a self hosted runner Dec 9, 2023
Comment thread .github/workflows/publish_charms.yml Outdated
Comment thread frontend/charm/requirements.txt Outdated
@@ -1 +1,2 @@
ops >= 2.2.0
ops >= 2.8.0
macaroonbakery==1.3.2 No newline at end of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread frontend/charm/tox.ini
deps =
pytest
juju
juju<=3.2

@mz2 mz2 Dec 9, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentionally <= 3.2 as opposed to for example >= 2.9 as is set in the charm metadata: the integration test environment is set to be 3.x (2.9 was not really behaving in the github runner context, which is possible to go investigate but probably not worth our while unless we get stuck in production 2.9 for a long time unexpectedly).

provider: microk8s
uses: actions/checkout@v4
- name: Set up microk8s
uses: canonical/certification-github-workflows/.github/actions/microk8s-setup@microk8s-setup-action

@mz2 mz2 Dec 9, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The setup steps turned out to be more extensive on self hosted runners, and since this is all repetitive boilerplate that becomes relevant again when we want to integration test any other charmed part of our stack, I moved the whole lot to a reusable composite action. Same story below re: the archive-charm-testing-artifacts

terraform {
required_providers {
juju = {
version = "~> 0.7.0"

@mz2 mz2 Dec 9, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The changes below showed up as necessary when the provider was updated: the series was deprecated (and base which replaces is similarly nonsensical for k8s charms) => series removed below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change is not strictly speaking necessary for the charm integration tests (though it was my intention to also test out in succession also that the terraform plan continues to be able to spin a new environment up that stabilises in an all-ready state).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we do this on PS5 though? as in can we use tf provider for juju version 0.10.0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this should indeed Just Work, in that the next time you deploy using this plan, it will upgrade the provider to the latest version that is described here. Deploying to staging will confirm that safely, I'd say.

@mz2
mz2 requested a review from omar-selo December 9, 2023 22:57

@omar-selo omar-selo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's amazing that you got it to work! finally this has been annoying for a long time

Comment thread .github/workflows/publish_api.yml Outdated
Comment thread .github/workflows/publish_frontend.yml
Comment thread frontend/charm/requirements.txt Outdated
terraform {
required_providers {
juju = {
version = "~> 0.7.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we do this on PS5 though? as in can we use tf provider for juju version 0.10.0?

Comment thread .github/workflows/frontend_charm_integration_tests.yml Outdated
@mz2

mz2 commented Dec 11, 2023

Copy link
Copy Markdown
Contributor Author

Superseded by #80

@mz2 mz2 closed this Dec 11, 2023
@wctaylor
wctaylor deleted the integration-test-fix-with-hosted-runners branch May 25, 2026 10:17
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

Successfully merging this pull request may close these issues.

4 participants