Skip to content

Commit d9ee720

Browse files
SoManyHsallisaurus
authored andcommitted
Test V2 Logging conversion
1 parent ee03263 commit d9ee720

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ func TestParseV1V2_Version1_HappyPath(t *testing.T) {
4545
"max-file": aws.String("50"),
4646
"max-size": aws.String("50k"),
4747
}
48+
logging := &ecs.LogConfiguration{
49+
LogDriver: logDriver,
50+
Options: logOpts,
51+
}
4852
memory := int64(953) // 1000000000 in Mib
4953
mountPoints := []*ecs.MountPoint{
5054
{
@@ -155,8 +159,7 @@ redis:
155159
assert.Equal(t, hostname, web.Hostname, "Expected Hostname to match")
156160
assert.Equal(t, webImage, web.Image, "Expected Image to match")
157161
assert.Equal(t, links, web.Links, "Expected Links to match")
158-
assert.Equal(t, logDriver, web.LogConfiguration.LogDriver, "Expected LogDriver to match")
159-
assert.Equal(t, logOpts, web.LogConfiguration.Options, "Expected LogConfiguration options to match")
162+
assert.Equal(t, logging, web.LogConfiguration, "Expected LogConfiguration to match")
160163
assert.Equal(t, memory, web.Memory, "Expected memory to match")
161164
assert.Equal(t, mountPoints, web.MountPoints, "Expected MountPoints to match")
162165
assert.Equal(t, ports, web.PortMappings, "Expected PortMappings to match")
@@ -174,12 +177,12 @@ func TestParseV1V2_Version2Files(t *testing.T) {
174177

175178
capAdd := []string{"ALL"}
176179
capDrop := []string{"NET_ADMIN", "SYS_ADMIN"}
177-
ports := []*ecs.PortMapping{
178-
{
179-
ContainerPort: aws.Int64(80),
180-
HostPort: aws.Int64(80),
181-
Protocol: aws.String("tcp"),
182-
},
180+
logOpts := map[string]*string{
181+
"syslog-address": aws.String("tcp://192.168.0.42:123"),
182+
}
183+
logging := &ecs.LogConfiguration{
184+
LogDriver: aws.String("syslog"),
185+
Options: logOpts,
183186
}
184187
memoryReservation := int64(476) // 500000000 / miB
185188
memory := int64(512)
@@ -200,6 +203,13 @@ func TestParseV1V2_Version2Files(t *testing.T) {
200203
SourceVolume: aws.String("volume-2"),
201204
},
202205
}
206+
ports := []*ecs.PortMapping{
207+
{
208+
ContainerPort: aws.Int64(80),
209+
HostPort: aws.Int64(80),
210+
Protocol: aws.String("tcp"),
211+
},
212+
}
203213
shmSize := int64(1024) // 1 gb = 1024 miB
204214
tmpfs := []*ecs.Tmpfs{
205215
{
@@ -230,6 +240,10 @@ services:
230240
tmpfs:
231241
- /run:size=1gb
232242
- /tmp:size=65536k,ro,rw
243+
logging:
244+
driver: syslog
245+
options:
246+
syslog-address: "tcp://192.168.0.42:123"
233247
mysql:
234248
image: mysql
235249
volumes:
@@ -266,6 +280,7 @@ volumes:
266280
assert.Equal(t, wordpressImage, wordpress.Image, "Expected wordpress Image to match")
267281
assert.Equal(t, capAdd, wordpress.CapAdd, "Expected CapAdd to match")
268282
assert.Equal(t, capDrop, wordpress.CapDrop, "Expected CapDrop to match")
283+
assert.Equal(t, logging, wordpress.LogConfiguration, "Expected Log Configuration to match")
269284

270285
assert.Equal(t, memoryReservation, wordpress.MemoryReservation, "Expected memoryReservation to match")
271286
assert.Equal(t, memory, wordpress.Memory, "Expected Memory to match")

0 commit comments

Comments
 (0)