mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-05 13:11:30 +00:00
Fix unit tests when there is more than one tag within the test image
This commit is contained in:
+11
-6
@@ -13,6 +13,11 @@ func TestContainerTagImageDelete(t *testing.T) {
|
||||
|
||||
srv := &Server{runtime: runtime}
|
||||
|
||||
initialImages, err := srv.Images(false, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := srv.runtime.repositories.Set("utest", "tag1", unitTestImageName, false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -25,8 +30,8 @@ func TestContainerTagImageDelete(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(images) != 3 {
|
||||
t.Errorf("Excepted 3 images, %d found", len(images))
|
||||
if len(images) != len(initialImages)+2 {
|
||||
t.Errorf("Excepted %d images, %d found", len(initialImages)+2, len(images))
|
||||
}
|
||||
|
||||
if _, err := srv.ImageDelete("utest/docker:tag2", true); err != nil {
|
||||
@@ -38,8 +43,8 @@ func TestContainerTagImageDelete(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(images) != 2 {
|
||||
t.Errorf("Excepted 2 images, %d found", len(images))
|
||||
if len(images) != len(initialImages)+1 {
|
||||
t.Errorf("Excepted %d images, %d found", len(initialImages)+1, len(images))
|
||||
}
|
||||
|
||||
if _, err := srv.ImageDelete("utest:tag1", true); err != nil {
|
||||
@@ -51,8 +56,8 @@ func TestContainerTagImageDelete(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(images) != 1 {
|
||||
t.Errorf("Excepted 1 image, %d found", len(images))
|
||||
if len(images) != len(initialImages) {
|
||||
t.Errorf("Excepted %d image, %d found", len(initialImages), len(images))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user