Skip to content

Commit

Permalink
create config.json file for test
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Mar 7, 2023
1 parent 93a8607 commit 2b41e1d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/minikube/assets/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ package assets

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/tests"
)

// mapsEqual returns true if and only if `a` contains all the same pairs as `b`.
Expand Down Expand Up @@ -153,6 +156,18 @@ func TestSelectAndPersistImages(t *testing.T) {
gcpAuth := Addons["gcp-auth"]
gcpAuthImages := gcpAuth.Images

// this test will write to ~/.minikube/profiles/minikube/config.json so need to create the file
home := tests.MakeTempDir(t)
profilePath := filepath.Join(home, "profiles", "minikube")
if err := os.MkdirAll(profilePath, 0777); err != nil {
t.Fatalf("failed to create profile directory: %v", err)
}
f, err := os.Create(filepath.Join(profilePath, "config.json"))
if err != nil {
t.Fatalf("failed to create config file: %v", err)
}
defer f.Close()

type expected struct {
numImages int
numRegistries int
Expand Down

0 comments on commit 2b41e1d

Please sign in to comment.