(t *testing.T)
| 194 | } |
| 195 | |
| 196 | func TestJSONWithPsFormat(t *testing.T) { |
| 197 | tmpHome := t.TempDir() |
| 198 | |
| 199 | fn := filepath.Join(tmpHome, ConfigFileName) |
| 200 | js := `{ |
| 201 | "auths": { "https://index.docker.io/v1/": { "auth": "am9lam9lOmhlbGxv", "email": "user@example.com" } }, |
| 202 | "psFormat": "table {{.ID}}\\t{{.Label \"com.docker.label.cpu\"}}" |
| 203 | }` |
| 204 | if err := os.WriteFile(fn, []byte(js), 0o600); err != nil { |
| 205 | t.Fatal(err) |
| 206 | } |
| 207 | |
| 208 | config, err := Load(tmpHome) |
| 209 | assert.NilError(t, err) |
| 210 | |
| 211 | if config.PsFormat != `table {{.ID}}\t{{.Label "com.docker.label.cpu"}}` { |
| 212 | t.Fatalf("Unknown ps format: %s\n", config.PsFormat) |
| 213 | } |
| 214 | |
| 215 | // Now save it and make sure it shows up in new form |
| 216 | configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) |
| 217 | if !strings.Contains(configStr, `"psFormat":`) || |
| 218 | !strings.Contains(configStr, "{{.ID}}") { |
| 219 | t.Fatalf("Should have save in new form: %s", configStr) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | func TestJSONWithCredentialStore(t *testing.T) { |
| 224 | tmpHome := t.TempDir() |
nothing calls this directly
no test coverage detected
searching dependent graphs…