From 811fbccded03efdbc69ae17794c94a9a9c8ae196 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 29 Apr 2019 22:38:33 +0100 Subject: [PATCH] fix case sensitivity of removed image check --- agent/engine/docker_image_manager.go | 2 +- agent/engine/docker_image_manager_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/engine/docker_image_manager.go b/agent/engine/docker_image_manager.go index 5f465054c85..c7e1b65b923 100644 --- a/agent/engine/docker_image_manager.go +++ b/agent/engine/docker_image_manager.go @@ -538,7 +538,7 @@ func (imageManager *dockerImageManager) deleteImage(ctx context.Context, imageID seelog.Infof("Removing Image: %s", imageID) err := imageManager.client.RemoveImage(ctx, imageID, dockerclient.RemoveImageTimeout) if err != nil { - if strings.Contains(err.Error(), imageNotFoundForDeletionError) { + if strings.Contains(strings.ToLower(err.Error()), imageNotFoundForDeletionError) { seelog.Errorf("Image already removed from the instance: %v", err) } else { seelog.Errorf("Error removing Image %v - %v", imageID, err) diff --git a/agent/engine/docker_image_manager_test.go b/agent/engine/docker_image_manager_test.go index c21d9a23f94..c93774df666 100644 --- a/agent/engine/docker_image_manager_test.go +++ b/agent/engine/docker_image_manager_test.go @@ -1118,7 +1118,7 @@ func TestDeleteImageNotFoundError(t *testing.T) { } imageState, _ := imageManager.getImageState(imageInspected.ID) client.EXPECT().RemoveImage(gomock.Any(), container.Image, dockerclient.RemoveImageTimeout).Return( - errors.New("no such image: " + container.Image)) + errors.New("No such image: " + container.Image)) ctx, cancel := context.WithCancel(context.TODO()) defer cancel() imageManager.deleteImage(ctx, container.Image, imageState)