From d05266769a2c13442d9f84f99c931b793665a3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sun, 15 Dec 2024 23:04:51 -0500 Subject: [PATCH] tests: Skip virt tests in Github Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Github Actions runners have some weird issues with nested virtualization. Signed-off-by: Stéphane Graber --- internal/acctest/checks.go | 5 +++++ internal/instance/resource_instance_test.go | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/acctest/checks.go b/internal/acctest/checks.go index dc96fb5..bad8f98 100644 --- a/internal/acctest/checks.go +++ b/internal/acctest/checks.go @@ -2,6 +2,7 @@ package acctest import ( "fmt" + "os" "strings" "testing" @@ -69,6 +70,10 @@ func PreCheckAPIExtensions(t *testing.T, extensions ...string) { // PreCheckVirtualization skips the test if the Incus server does not // support virtualization. func PreCheckVirtualization(t *testing.T) { + if os.Getenv("GITHUB_ACTIONS") == "true" { + t.Skipf("Test %q skipped. Virtualization tests can't run in Github Actions.", t.Name()) + } + p := testProvider() server, err := p.InstanceServer("", "", "") if err != nil { diff --git a/internal/instance/resource_instance_test.go b/internal/instance/resource_instance_test.go index 25a944c..2635a83 100644 --- a/internal/instance/resource_instance_test.go +++ b/internal/instance/resource_instance_test.go @@ -556,7 +556,10 @@ func TestAccInstance_fileUploadContent_VM(t *testing.T) { instanceName := petname.Generate(2, "-") resource.Test(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(t) }, + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckVirtualization(t) + }, ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories, Steps: []resource.TestStep{ {