From 8da2f5613ab1ff565726b0a9e99c4f59c06fc408 Mon Sep 17 00:00:00 2001 From: Vitaly Antonenko Date: Mon, 7 Oct 2024 16:18:25 +0300 Subject: [PATCH] test: move ACC test back to LXD, fix microk8s setup for LXD --- .github/workflows/test_integration.yml | 10 +++++++++- internal/provider/resource_kubernetes_cloud_test.go | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index 5f2e9e73..25109c90 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -69,6 +69,14 @@ jobs: channel: ${{ matrix.action-operator.cloud-channel }} juju-channel: ${{ matrix.action-operator.juju }} lxd-channel: ${{ matrix.action-operator.lxd-channel }} + - name: In case of LXD setup also microk8s + if: ${{ matrix.action-operator.cloud == 'lxd' }} + run: | + sudo snap install microk8s --channel=1.28-strict/stable + sudo usermod -a -G microk8s ubuntu + sudo microk8s.enable dns storage + sudo microk8s.enable dns local-storage + sudo -g microk8s -E microk8s status --wait-ready --timeout=600 - name: Create additional networks when testing with LXD if: ${{ matrix.action-operator.cloud == 'lxd' }} run: | @@ -88,7 +96,7 @@ jobs: echo "EOF" >> $GITHUB_ENV echo "TEST_MANAGEMENT_BR=10.150.40.0/24" >> $GITHUB_ENV echo "TEST_PUBLIC_BR=10.170.80.0/24" >> $GITHUB_ENV - - name: "Set additional enviroment for microk8s" + - name: "Set additional environment for microk8s" if: ${{ matrix.action-operator.cloud == 'microk8s' }} run: | echo "MICROK8S_CONFIG<<-EOT" >> $GITHUB_ENV diff --git a/internal/provider/resource_kubernetes_cloud_test.go b/internal/provider/resource_kubernetes_cloud_test.go index 14c09601..0ea89cc8 100644 --- a/internal/provider/resource_kubernetes_cloud_test.go +++ b/internal/provider/resource_kubernetes_cloud_test.go @@ -1,3 +1,6 @@ +// Copyright 2023 Canonical Ltd. +// Licensed under the Apache License, Version 2.0, see LICENCE file for details. + package provider import ( @@ -10,8 +13,8 @@ import ( ) func TestAcc_ResourceKubernetesCloud(t *testing.T) { - if testingCloud != MicroK8sTesting { - t.Skip(t.Name() + " only runs with MicroK8s") + if testingCloud != LXDCloudTesting { + t.Skip(t.Name() + " only runs with LXD") } cloudName := acctest.RandomWithPrefix("tf-test-k8scloud") cloudConfig := os.Getenv("MICROK8S_CONFIG")