From dbc109808d9384751313de94d74689ef7eaea3e1 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 3 Jul 2020 15:55:51 +0200 Subject: [PATCH] Better error message when trying to remove a container from a compose application --- azure/backend.go | 3 ++- azure/backend_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/azure/backend.go b/azure/backend.go index 25ff9809e..c4fc75699 100644 --- a/azure/backend.go +++ b/azure/backend.go @@ -267,7 +267,8 @@ func (cs *aciContainerService) Logs(ctx context.Context, containerName string, r func (cs *aciContainerService) Delete(ctx context.Context, containerID string, _ bool) error { groupName, containerName := getGroupAndContainerName(containerID) if groupName != containerID { - return errors.New(fmt.Sprintf("cannot delete service %q from compose app %q, you must delete the entire compose app with docker compose down", containerName, groupName)) + msg := "cannot delete service %q from compose application %q, you can delete the entire compose app with docker compose down --project-name %s" + return errors.New(fmt.Sprintf(msg, containerName, groupName, groupName)) } cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName) if err != nil { diff --git a/azure/backend_test.go b/azure/backend_test.go index c70904894..9e4bc2ef6 100644 --- a/azure/backend_test.go +++ b/azure/backend_test.go @@ -50,7 +50,7 @@ func (suite *BackendSuiteTest) TestErrorMessageDeletingContainerFromComposeAppli err := service.Delete(context.TODO(), "compose-app_service1", false) Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("cannot delete service \"service1\" from compose app \"compose-app\", you must delete the entire compose app with docker compose down")) + Expect(err.Error()).To(Equal("cannot delete service \"service1\" from compose application \"compose-app\", you can delete the entire compose app with docker compose down --project-name compose-app")) } func (suite *BackendSuiteTest) TestErrorMessageRunSingleContainerNameWithComposeSeparator() {