From cc39d2428f16a837be5f26bafaff1d61d8e80cbf Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Tue, 27 May 2025 13:33:59 -0600 Subject: [PATCH] fix: plugin installer test with no Internet Signed-off-by: Terry Howe --- pkg/plugin/installer/vcs_installer_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index fbb5d354e..491d58a3f 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -19,6 +19,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "testing" "github.com/Masterminds/vcs" @@ -119,6 +120,8 @@ func TestVCSInstallerNonExistentVersion(t *testing.T) { if err := Install(i); err == nil { t.Fatalf("expected error for version does not exists, got none") + } else if strings.Contains(err.Error(), "Could not resolve host: github.com") { + t.Skip("Unable to run test without Internet access") } else if err.Error() != fmt.Sprintf("requested version %q does not exist for plugin %q", version, source) { t.Fatalf("expected error for version does not exists, got (%v)", err) } @@ -146,7 +149,11 @@ func TestVCSInstallerUpdate(t *testing.T) { // Install plugin before update if err := Install(i); err != nil { - t.Fatal(err) + if strings.Contains(err.Error(), "Could not resolve host: github.com") { + t.Skip("Unable to run test without Internet access") + } else { + t.Fatal(err) + } } // Test FindSource method for positive result