diff --git a/test/integration/no_kubernetes_test.go b/test/integration/no_kubernetes_test.go index 092849edcc..096879cd5a 100644 --- a/test/integration/no_kubernetes_test.go +++ b/test/integration/no_kubernetes_test.go @@ -22,7 +22,6 @@ import ( "context" "encoding/json" "fmt" - "os" "os/exec" "path/filepath" "runtime" @@ -87,23 +86,16 @@ func VerifyNoK8sDownloadCache(ctx context.Context, t *testing.T, profile string) cachePath := filepath.Join(localpath.MiniPath(), "cache", runtime.GOOS, runtime.GOARCH, constants.NoKubernetesVersion) - // Check if the cache directory exists at all t.Logf("Checking cache directory: %s", cachePath) - if _, err := os.Stat(cachePath); err == nil { - // Directory exists - let's see what's in it for debugging - if files, err := filepath.Glob(filepath.Join(cachePath, "*")); err == nil && len(files) > 0 { - t.Logf("Files found in cache directory:") - for _, file := range files { - t.Logf(" - %s", file) - } - } else { - t.Logf("Cache directory exists but is empty") - } - t.Errorf("Cache directory %s should not exist when using --no-kubernetes", cachePath) - } else if os.IsNotExist(err) { - t.Logf("No cache directory found (as expected)") - } else { - t.Errorf("Error checking cache directory %s: %v", cachePath, err) + files, err := filepath.Glob(filepath.Join(cachePath, "*")) + if err != nil { + t.Errorf("Error reading cache directory: %v", err) + return + } + + if len(files) > 0 { + t.Logf("Files found in cache directory: %v", files) + t.Errorf("Cache directory should not contain files when using --no-kubernetes") } }