From 898ce7664817f0c62fecae7740090ecf4c53fbbe Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:00:33 -0500 Subject: [PATCH] adding python3.11 updates (#1012) Signed-off-by: Paige Patton --- .github/workflows/tests.yml | 5 +++-- containers/Dockerfile.template | 12 ++++++------ requirements.txt | 4 ++-- tests/test_gcp_node_scenarios.py | 9 +++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 668fee38..167b6575 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,13 +32,14 @@ jobs: - name: Install Python uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.11' architecture: 'x64' - name: Install environment run: | sudo apt-get install build-essential python3-dev pip install --upgrade pip pip install -r requirements.txt + pip install coverage - name: Deploy test workloads run: | @@ -181,7 +182,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.11' - name: Copy badge on GitHub Page Repo env: COLOR: yellow diff --git a/containers/Dockerfile.template b/containers/Dockerfile.template index 3da243e4..4e029d6e 100644 --- a/containers/Dockerfile.template +++ b/containers/Dockerfile.template @@ -41,7 +41,7 @@ ENV KUBECONFIG /home/krkn/.kube/config # This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo RUN dnf update && dnf install -y --setopt=install_weak_deps=False \ - git python39 jq yq gettext wget which ipmitool openssh-server &&\ + git python3.11 jq yq gettext wget which ipmitool openssh-server &&\ dnf clean all # copy oc client binary from oc-build image @@ -63,15 +63,15 @@ RUN if [ -n "$PR_NUMBER" ]; then git fetch origin pull/${PR_NUMBER}/head:pr-${PR # if it is a TAG trigger checkout the tag RUN if [ -n "$TAG" ]; then git checkout "$TAG";fi -RUN python3.9 -m ensurepip --upgrade --default-pip -RUN python3.9 -m pip install --upgrade pip setuptools==78.1.1 +RUN python3.11 -m ensurepip --upgrade --default-pip +RUN python3.11 -m pip install --upgrade pip setuptools==78.1.1 # removes the the vulnerable versions of setuptools and pip RUN rm -rf "$(pip cache dir)" RUN rm -rf /tmp/* -RUN rm -rf /usr/local/lib/python3.9/ensurepip/_bundled -RUN pip3.9 install -r requirements.txt -RUN pip3.9 install jsonschema +RUN rm -rf /usr/local/lib/python3.11/ensurepip/_bundled +RUN pip3.11 install -r requirements.txt +RUN pip3.11 install jsonschema LABEL krknctl.title.global="Krkn Base Image" LABEL krknctl.description.global="This is the krkn base image." diff --git a/requirements.txt b/requirements.txt index 27d44025..7c2a0469 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ google-cloud-compute==1.22.0 ibm_cloud_sdk_core==3.18.0 ibm_vpc==0.20.0 jinja2==3.1.6 -krkn-lib==5.1.13 +krkn-lib==6.0 lxml==5.1.0 kubernetes==34.1.0 numpy==1.26.4 @@ -33,7 +33,7 @@ service_identity==24.1.0 PyYAML==6.0.1 setuptools==78.1.1 wheel==0.42.0 -zope.interface==5.4.0 +zope.interface==6.1 git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.0 cryptography>=42.0.4 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/tests/test_gcp_node_scenarios.py b/tests/test_gcp_node_scenarios.py index 5d4a9c6e..12f5723d 100644 --- a/tests/test_gcp_node_scenarios.py +++ b/tests/test_gcp_node_scenarios.py @@ -43,14 +43,15 @@ class TestGCP(unittest.TestCase): def setUp(self): """Set up test fixtures""" # Mock google.auth before creating GCP instance - self.auth_patcher = patch('google.auth.default') - self.compute_patcher = patch('google.cloud.compute_v1.InstancesClient') + self.auth_patcher = patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.google.auth.default') + self.compute_patcher = patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.compute_v1.InstancesClient') self.mock_auth = self.auth_patcher.start() self.mock_compute_client = self.compute_patcher.start() # Configure auth mock to return credentials and project_id - self.mock_auth.return_value = (MagicMock(), 'test-project-123') + mock_credentials = MagicMock() + self.mock_auth.return_value = (mock_credentials, 'test-project-123') # Create GCP instance with mocked dependencies self.gcp = GCP() @@ -67,7 +68,7 @@ class TestGCP(unittest.TestCase): def test_gcp_init_failure(self): """Test GCP class initialization failure""" - with patch('google.auth.default', side_effect=Exception("Auth error")): + with patch('krkn.scenario_plugins.node_actions.gcp_node_scenarios.google.auth.default', side_effect=Exception("Auth error")): with self.assertRaises(Exception): GCP()