From e5c1790be79c1996cabed34e53377a6b91100409 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 26 Jan 2024 09:16:40 -0800 Subject: [PATCH] Rollback to 1.28/stable microk8s in functional testing We use latest/stable by default which very recently updated to 1.29/stable. Unfortunately it appears there are issues [0] with this version on Debian Bookworm which also happens to be the platform we test on. Our jobs have been consistently failing in a manner that appears related to this issue. Update the job to collect logs so that we can better confirm this is the case and rollback to 1.28 which should be working. Also update the AWS tests to handle a recent moto release which requires us to use mock_aws rather than individual mock_* classes. [0] https://github.com/canonical/microk8s/issues/4361 Change-Id: I72310521bdabfc3e34a9f2e87ff80f6d7c27c180 Co-Authored-By: James E. Blair Co-Authored-By: Jeremy Stanley --- .zuul.yaml | 1 + nodepool/tests/unit/test_driver_aws.py | 13 ++++--------- playbooks/nodepool-functional-k8s/post.yaml | 4 ++++ playbooks/nodepool-functional-k8s/pre.yaml | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 playbooks/nodepool-functional-k8s/post.yaml diff --git a/.zuul.yaml b/.zuul.yaml index e834dd6a0..09ebe30ba 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,6 +4,7 @@ name: nodepool-functional-k8s pre-run: playbooks/nodepool-functional-k8s/pre.yaml run: playbooks/nodepool-functional-k8s/run.yaml + post-run: playbooks/nodepool-functional-k8s/post.yaml required-projects: - zuul/nodepool nodeset: debian-bookworm diff --git a/nodepool/tests/unit/test_driver_aws.py b/nodepool/tests/unit/test_driver_aws.py index 2937befdc..cc94f99c6 100644 --- a/nodepool/tests/unit/test_driver_aws.py +++ b/nodepool/tests/unit/test_driver_aws.py @@ -21,7 +21,7 @@ import urllib.parse import boto3 import botocore.exceptions -from moto import mock_ec2, mock_s3, mock_iam +from moto import mock_aws import testtools from nodepool import config as nodepool_config @@ -122,9 +122,7 @@ def ebs_quotas(quotas): class TestDriverAws(tests.DBTestCase): log = logging.getLogger("nodepool.TestDriverAws") - mock_ec2 = mock_ec2() - mock_s3 = mock_s3() - mock_iam = mock_iam() + mock_aws = mock_aws() def setUp(self): super().setUp() @@ -144,9 +142,7 @@ class TestDriverAws(tests.DBTestCase): fixtures.EnvironmentVariable('AWS_SECRET_ACCESS_KEY', aws_key)) self.fake_aws = FakeAws() - self.mock_ec2.start() - self.mock_s3.start() - self.mock_iam.start() + self.mock_aws.start() self.ec2 = boto3.resource('ec2', region_name='us-west-2') self.ec2_client = boto3.client('ec2', region_name='us-west-2') @@ -197,8 +193,7 @@ class TestDriverAws(tests.DBTestCase): ebs_quotas=getattr(test, '__aws_ebs_quotas__', None)) def tearDown(self): - self.mock_ec2.stop() - self.mock_s3.stop() + self.mock_aws.stop() super().tearDown() def setup_config(self, *args, **kw): diff --git a/playbooks/nodepool-functional-k8s/post.yaml b/playbooks/nodepool-functional-k8s/post.yaml new file mode 100644 index 000000000..829ec8e66 --- /dev/null +++ b/playbooks/nodepool-functional-k8s/post.yaml @@ -0,0 +1,4 @@ +- hosts: all + roles: + - name: Collect k8s logs for debugging purposes + role: collect-kubernetes-logs diff --git a/playbooks/nodepool-functional-k8s/pre.yaml b/playbooks/nodepool-functional-k8s/pre.yaml index 54097f58b..f2d01e513 100644 --- a/playbooks/nodepool-functional-k8s/pre.yaml +++ b/playbooks/nodepool-functional-k8s/pre.yaml @@ -6,3 +6,4 @@ - role: ensure-nox - role: ensure-kubernetes ensure_kubernetes_type: microk8s + ensure_kubernetes_microk8s_channel: '1.28/stable'