فهرست منبع

set filesystem name to make it more visible on AWS web console

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 5 سال پیش
والد
کامیت
a87300d1df
2فایلهای تغییر یافته به همراه14 افزوده شده و 11 حذف شده
  1. 1 0
      ecs/awsResources.go
  2. 13 11
      ecs/cloudformation_test.go

+ 1 - 0
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 {

+ 13 - 11
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)
 	})
 }