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

Adjustments to test charm upgrades #217

Merged
merged 12 commits into from
Dec 18, 2024
Merged

Conversation

addyess
Copy link
Contributor

@addyess addyess commented Dec 14, 2024

Overview

Create tests that performs a charm upgrade from k8s edge --> k8s local_path

Details

  • eliminates k8s-worker leader from checking node readiness on pre-upgrade-check action
  • k8s leader is responsible for checking the whole cluster on pre-upgrade-check
  • k8s checks kube-system namespace to ensure all pods are ready during update-status event
  • heavy refactor of integration test conftest.py to support test configuration by pytest model markings
  • latest/edge snap is now 1.32, requiring new dependency literals
  • increase runner size for amd64 runs

Note

VMs on LXD cannot pull an image for focal that supports cilium. This PR moves all testing on amd64 therefore to jammy rather than focal. Focal is still tested on arm64 due to GH ARM64 workers not supporting /dev/kvm

@addyess addyess requested a review from a team as a code owner December 14, 2024 04:59
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 4d874ea to 8ffdcfc Compare December 16, 2024 15:58
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 8ffdcfc to 963c140 Compare December 16, 2024 16:05
@@ -56,6 +56,7 @@ def get_nodes(self, labels: LabelSelector) -> Optional[List[Node]]:
Raises:
ClusterInspectorError: If the nodes cannot be retrieved.
"""
labels = labels or {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

labels are now "OPTIONAL"

@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 01cf131 to 3d58015 Compare December 16, 2024 18:43
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 3ab71a6 to 8490141 Compare December 16, 2024 22:21
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 8490141 to 48d52df Compare December 17, 2024 18:01
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from 6f7df7f to 1f877ed Compare December 17, 2024 19:26
Comment on lines -53 to +54
${{ matrix.arch.id == 'arm64' && ' --lxd-containers' || '' }}
${{ matrix.arch.id == 'arm64' && ' --lxd-containers --series=focal' || '' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

arm64 -- you stay testing on focal so we can know if we break focal compatability

Copy link
Member

@mateoflorido mateoflorido left a comment

Choose a reason for hiding this comment

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

Great job! Thanks for adding testing for the upgrades and improving the stability of the suite.

tests/integration/helpers.py Outdated Show resolved Hide resolved
@addyess addyess force-pushed the KU-2261/test-charm-upgrades branch from e265e70 to 8ccaf1f Compare December 17, 2024 23:29
Copy link
Contributor

Test coverage for b1a3178

coverage-report: install_deps /home/runner/work/k8s-operator/k8s-operator/charms/worker/k8s> python -I -m pip install 'coverage[toml]'
coverage-report: commands[0] /home/runner/work/k8s-operator/k8s-operator/charms/worker/k8s> coverage report
Name                                    Stmts   Miss  Cover
-----------------------------------------------------------
lib/charms/k8s/v0/k8sd_api_manager.py     278     29    90%
src/charm.py                              500    260    48%
src/cloud_integration.py                   80      3    96%
src/config/extra_args.py                   29      2    93%
src/containerd.py                         140     22    84%
src/cos_integration.py                     33     12    64%
src/events/update_status.py                68     24    65%
src/inspector.py                           41      4    90%
src/kube_control.py                        39     31    21%
src/literals.py                            21      0   100%
src/protocols.py                           28      5    82%
src/reschedule.py                          77      4    95%
src/snap.py                               185     26    86%
src/token_distributor.py                  181    109    40%
src/upgrade.py                            108     48    56%
-----------------------------------------------------------
TOTAL                                    1808    579    68%
coverage-report: OK (1.32=setup[1.09]+cmd[0.23] seconds)
congratulations :) (1.37 seconds)

Static code analysis report

Run started:2024-12-18 04:53:00.314346

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 3847
  Total lines skipped (#nosec): 3
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@addyess addyess merged commit 98c12d5 into main Dec 18, 2024
70 checks passed
@addyess addyess deleted the KU-2261/test-charm-upgrades branch December 18, 2024 15:07
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.

2 participants