From a87300d1df123bde4046c65c0266eb09321a81fc Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 13 Oct 2020 15:04:01 +0200 Subject: [PATCH] set filesystem name to make it more visible on AWS web console Signed-off-by: Nicolas De Loof --- ecs/awsResources.go | 1 + ecs/cloudformation_test.go | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ecs/awsResources.go b/ecs/awsResources.go index eb45b1cec..af5a55374 100644 --- a/ecs/awsResources.go +++ b/ecs/awsResources.go @@ -200,6 +200,7 @@ func (b *ecsAPIService) parseExternalVolumes(ctx context.Context, project *types return nil, err } if id == "" { + tags["Name"] = fmt.Sprintf("%s_%s", project.Name, vol.Name) logrus.Debug("no EFS filesystem found, create a fresh new one") id, err = b.aws.CreateFileSystem(ctx, tags) if err != nil { diff --git a/ecs/cloudformation_test.go b/ecs/cloudformation_test.go index d1e959e89..23a089a80 100644 --- a/ecs/cloudformation_test.go +++ b/ecs/cloudformation_test.go @@ -384,10 +384,6 @@ volumes: } func TestCreateVolume(t *testing.T) { - tags := map[string]string{ - compose.ProjectTag: t.Name(), - compose.VolumeTag: "db-data", - } testVolume(t, ` services: test: @@ -395,16 +391,19 @@ services: volumes: db-data: {} `, useDefaultVPC, func(m *MockAPIMockRecorder) { - m.FindFileSystem(gomock.Any(), tags).Return("", nil) - m.CreateFileSystem(gomock.Any(), tags).Return("fs-123abc", nil) + m.FindFileSystem(gomock.Any(), map[string]string{ + compose.ProjectTag: t.Name(), + compose.VolumeTag: "db-data", + }).Return("", nil) + m.CreateFileSystem(gomock.Any(), map[string]string{ + compose.ProjectTag: t.Name(), + compose.VolumeTag: "db-data", + "Name": fmt.Sprintf("%s_%s", t.Name(), "db-data"), + }).Return("fs-123abc", nil) }) } func TestReusePreviousVolume(t *testing.T) { - tags := map[string]string{ - compose.ProjectTag: t.Name(), - compose.VolumeTag: "db-data", - } testVolume(t, ` services: test: @@ -412,7 +411,10 @@ services: volumes: db-data: {} `, useDefaultVPC, func(m *MockAPIMockRecorder) { - m.FindFileSystem(gomock.Any(), tags).Return("fs-123abc", nil) + m.FindFileSystem(gomock.Any(), map[string]string{ + compose.ProjectTag: t.Name(), + compose.VolumeTag: "db-data", + }).Return("fs-123abc", nil) }) }