(t *testing.T)
| 221 | } |
| 222 | |
| 223 | func TestJSONWithCredentialStore(t *testing.T) { |
| 224 | tmpHome := t.TempDir() |
| 225 | |
| 226 | fn := filepath.Join(tmpHome, ConfigFileName) |
| 227 | js := `{ |
| 228 | "auths": { "https://index.docker.io/v1/": { "auth": "am9lam9lOmhlbGxv", "email": "user@example.com" } }, |
| 229 | "credsStore": "crazy-secure-storage" |
| 230 | }` |
| 231 | if err := os.WriteFile(fn, []byte(js), 0o600); err != nil { |
| 232 | t.Fatal(err) |
| 233 | } |
| 234 | |
| 235 | config, err := Load(tmpHome) |
| 236 | assert.NilError(t, err) |
| 237 | |
| 238 | if config.CredentialsStore != "crazy-secure-storage" { |
| 239 | t.Fatalf("Unknown credential store: %s\n", config.CredentialsStore) |
| 240 | } |
| 241 | |
| 242 | // Now save it and make sure it shows up in new form |
| 243 | configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) |
| 244 | if !strings.Contains(configStr, `"credsStore":`) || |
| 245 | !strings.Contains(configStr, "crazy-secure-storage") { |
| 246 | t.Fatalf("Should have save in new form: %s", configStr) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | func TestJSONWithCredentialHelpers(t *testing.T) { |
| 251 | tmpHome := t.TempDir() |
nothing calls this directly
no test coverage detected
searching dependent graphs…