Apply default image tags for all runtimes

Move the docker-specific logic up to the ImageManager to allow code sharing
among different implementations.
This commit is contained in:
Yu-Ju Hong
2016-09-21 16:20:07 -07:00
parent 50e438a3c1
commit e6a6513552
7 changed files with 99 additions and 75 deletions

View File

@@ -211,3 +211,21 @@ func TestSerializedPuller(t *testing.T) {
}
}
}
func TestApplyDefaultImageTag(t *testing.T) {
for _, testCase := range []struct {
Input string
Output string
}{
{Input: "root", Output: "root:latest"},
{Input: "root:tag", Output: "root:tag"},
{Input: "root@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", Output: "root@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
} {
image, err := applyDefaultImageTag(testCase.Input)
if err != nil {
t.Errorf("applyDefaultImageTag(%s) failed: %v", testCase.Input, err)
} else if image != testCase.Output {
t.Errorf("Expected image reference: %q, got %q", testCase.Output, image)
}
}
}