Skip to content

Commit 4819c92

Browse files
SoManyHsallisaurus
authored andcommitted
Test VolumesFrom conversion
1 parent d9ee720 commit 4819c92

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

ecs-cli/modules/cli/compose/project/project_parseV1V2_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ func TestParseV1V2_Version1_HappyPath(t *testing.T) {
7474
securityOpts := []string{"label:type:test_virt"}
7575
shmSize := int64(128)
7676
user := "user"
77+
volumesFrom := []*ecs.VolumeFrom{
78+
{
79+
ReadOnly: aws.Bool(true),
80+
SourceContainer: aws.String("web"),
81+
},
82+
}
7783
workingDir := "/var"
7884

7985
composeV1FileString := `web:
@@ -115,7 +121,9 @@ func TestParseV1V2_Version1_HappyPath(t *testing.T) {
115121
- ./code
116122
working_dir: /var
117123
redis:
118-
image: redis`
124+
image: redis
125+
volumes_from:
126+
- web:ro`
119127

120128
// Setup docker-compose file
121129
tmpfile, err := ioutil.TempFile("", "test")
@@ -142,6 +150,7 @@ redis:
142150
assert.NoError(t, err, "Unexpected error retrieving redis config")
143151

144152
assert.Equal(t, redisImage, redis.Image, "Expected image to match")
153+
assert.Equal(t, volumesFrom, redis.VolumesFrom, "Expected VolumesFrom to match")
145154

146155
// verify web ContainerConfig
147156
web, err := getContainerConfigByName("web", actualConfigs)
@@ -223,6 +232,12 @@ func TestParseV1V2_Version2Files(t *testing.T) {
223232
Size: aws.Int64(64),
224233
},
225234
}
235+
volumesFrom := []*ecs.VolumeFrom{
236+
{
237+
ReadOnly: aws.Bool(false),
238+
SourceContainer: aws.String("mysql"),
239+
},
240+
}
226241

227242
composeV2FileString := `version: '2'
228243
services:
@@ -244,6 +259,8 @@ services:
244259
driver: syslog
245260
options:
246261
syslog-address: "tcp://192.168.0.42:123"
262+
volumes_from:
263+
- mysql:rw
247264
mysql:
248265
image: mysql
249266
volumes:
@@ -287,6 +304,7 @@ volumes:
287304
assert.Equal(t, ports, wordpress.PortMappings, "Expected ports to match")
288305
assert.Equal(t, shmSize, wordpress.ShmSize, "Expected shmSize to match")
289306
assert.ElementsMatch(t, tmpfs, wordpress.Tmpfs, "Expected tmpfs to match")
307+
assert.Equal(t, volumesFrom, wordpress.VolumesFrom, "Expected VolumesFrom to match")
290308

291309
// verify mysql ContainerConfig
292310
mysql, err := getContainerConfigByName("mysql", actualConfigs)

0 commit comments

Comments
 (0)