(t testing.TB, configDir string)
| 175 | } |
| 176 | |
| 177 | func initializeContextDir(t testing.TB, configDir string) { |
| 178 | dockerUserDir := ".docker/contexts" |
| 179 | userDir, err := os.UserHomeDir() |
| 180 | assert.NilError(t, err, "Failed to get user home directory") |
| 181 | userContextsDir := filepath.Join(userDir, dockerUserDir) |
| 182 | if checkExists(userContextsDir) { |
| 183 | dstContexts := filepath.Join(configDir, "contexts") |
| 184 | assert.NilError(t, cp.Copy(userContextsDir, dstContexts), "Failed to copy contexts directory") |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func checkExists(path string) bool { |
| 189 | _, err := os.Stat(path) |
no test coverage detected