@@ -20,8 +20,18 @@ import (
20
20
21
21
// testFinchConfigFile makes sure that DOCKER_CONFIG is properly set to ~/.finch so that related information
22
22
// is written to ~/.finch/config.json file.
23
- var testFinchConfigFile = func (o * option.Option ) {
23
+ var testFinchConfigFile = func (o * option.Option , installed bool ) {
24
24
ginkgo .Describe ("finch config file" , func () {
25
+ var vmType string
26
+
27
+ ginkgo .BeforeEach (func () {
28
+ if runtime .GOOS == "windows" {
29
+ vmType = "wsl2"
30
+ } else {
31
+ vmType = "vz"
32
+ }
33
+ })
34
+
25
35
ginkgo .It ("should store login credentials" , func () {
26
36
filename := "htpasswd"
27
37
registryImage := "public.ecr.aws/docker/library/registry:2"
@@ -74,5 +84,14 @@ var testFinchConfigFile = func(o *option.Option) {
74
84
gomega .Expect (err ).ShouldNot (gomega .HaveOccurred ())
75
85
gomega .Expect (string (configContent )).ShouldNot (gomega .ContainSubstring (registry ))
76
86
})
87
+
88
+ ginkgo .It ("should refresh config.json if creds_helpers is not set in finch.yaml, but config.json is configured with credsStore" , func () {
89
+ resetVM (o )
90
+ resetDisks (o , installed )
91
+ writeFile (finchConfigFilePath , []byte (fmt .Sprintf ("cpus: 6\n memory: 4GiB\n vmType: %s\n rosetta: true" , vmType )))
92
+ writeFile (finchConfigJSONPath , []byte (`{"credsStore":"ecr-login"}` ))
93
+ command .New (o , virtualMachineRootCmd , "init" ).WithoutCheckingExitCode ().WithTimeoutInSeconds (160 ).Run ()
94
+ gomega .Expect (string (readFile (finchConfigJSONPath ))).Should (gomega .Equal (`{"auths":{}}` ))
95
+ })
77
96
})
78
97
}
0 commit comments