-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Skip caching binaries when --no-kubernetes is set #21139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
8329aea
c4b385f
2338a97
97f8852
801ea3b
57dfa41
81a1198
ac7ef42
99bf5f7
de520ae
85dc9bf
f4817ca
389ec44
a0b3b30
860101a
cbd40f5
acfd8b7
dd59be3
9d0cf67
c4345f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,11 +22,15 @@ import ( | |
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "path/filepath" | ||
| "runtime" | ||
| "strings" | ||
| "testing" | ||
|
|
||
| "k8s.io/minikube/pkg/minikube/constants" | ||
| "k8s.io/minikube/pkg/minikube/localpath" | ||
| ) | ||
|
|
||
| // TestNoKubernetes tests starting minikube without Kubernetes, | ||
|
|
@@ -52,6 +56,7 @@ func TestNoKubernetes(t *testing.T) { | |
| {"StartWithK8s", validateStartWithK8S}, | ||
| {"StartWithStopK8s", validateStartWithStopK8s}, | ||
| {"Start", validateStartNoK8S}, | ||
| {"VerifyNok8sNoK8sDownloads", VerifyNoK8sDownloadCache}, | ||
| {"VerifyK8sNotRunning", validateK8SNotRunning}, | ||
| {"ProfileList", validateProfileListNoK8S}, | ||
| {"Stop", validateStopNoK8S}, | ||
|
|
@@ -76,6 +81,32 @@ func TestNoKubernetes(t *testing.T) { | |
| }) | ||
| } | ||
|
|
||
| // VerifyNoK8sDownloadCache verifies that starting minikube with --no-kubernetes does not create a download cache. | ||
| func VerifyNoK8sDownloadCache(ctx context.Context, t *testing.T, profile string) { | ||
| defer PostMortemLogs(t, profile) | ||
|
|
||
| cachePath := filepath.Join(localpath.MiniPath(), "cache", "linux", runtime.GOARCH, "v0.0.0") | ||
|
||
|
|
||
| // 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) | ||
| } | ||
| } | ||
|
|
||
| // validateStartNoK8sWithVersion expect an error when starting a minikube cluster without kubernetes and with a kubernetes version. | ||
| func validateStartNoK8sWithVersion(ctx context.Context, t *testing.T, profile string) { | ||
| defer PostMortemLogs(t, profile) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question is why Other tests generated any folder with "v0.0.0" ?
how about instead of this, When it fails we can list the minikube home and check why it is there in first place.
Before minikube test starts, we purge and have we have separte minikube home for the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be way better approach i had some issue with it so i was experimenting with thing i will look more into it thanks , yes the other tests should also not generate the folder with "v0.0.0" i was just experimenting with things if that fixes it and also one more issue i am facing is the tests are passing on my system since my last 3 commit
