@@ -21,7 +21,7 @@ func Test_convertSidecar(t *testing.T) {
21
21
mockCredsParam := aws .String ("mockCredsParam" )
22
22
circularDependencyErr := fmt .Errorf ("circular container dependency chain includes the following containers: " )
23
23
testCases := map [string ]struct {
24
- inPort string
24
+ inPort * string
25
25
inEssential bool
26
26
inLabels map [string ]string
27
27
inDependsOn map [string ]string
@@ -32,12 +32,12 @@ func Test_convertSidecar(t *testing.T) {
32
32
wantedErr error
33
33
}{
34
34
"invalid port" : {
35
- inPort : "b/a/d/P/o/r/t" ,
35
+ inPort : aws . String ( "b/a/d/P/o/r/t" ) ,
36
36
37
37
wantedErr : fmt .Errorf ("cannot parse port mapping from b/a/d/P/o/r/t" ),
38
38
},
39
39
"good port without protocol" : {
40
- inPort : "2000" ,
40
+ inPort : aws . String ( "2000" ) ,
41
41
inEssential : true ,
42
42
43
43
wanted : & template.SidecarOpts {
@@ -51,7 +51,7 @@ func Test_convertSidecar(t *testing.T) {
51
51
},
52
52
},
53
53
"good port with protocol" : {
54
- inPort : "2000/udp" ,
54
+ inPort : aws . String ( "2000/udp" ) ,
55
55
inEssential : true ,
56
56
57
57
wanted : & template.SidecarOpts {
@@ -66,7 +66,7 @@ func Test_convertSidecar(t *testing.T) {
66
66
},
67
67
},
68
68
"invalid container dependency due to circularly depending on itself" : {
69
- inPort : "2000" ,
69
+ inPort : aws . String ( "2000" ) ,
70
70
inEssential : true ,
71
71
inDependsOn : map [string ]string {
72
72
"foo" : "start" ,
@@ -75,7 +75,7 @@ func Test_convertSidecar(t *testing.T) {
75
75
wantedErr : fmt .Errorf ("container foo cannot depend on itself" ),
76
76
},
77
77
"invalid container dependency due to circularly depending on another container" : {
78
- inPort : "2000" ,
78
+ inPort : aws . String ( "2000" ) ,
79
79
inEssential : true ,
80
80
inDependsOn : map [string ]string {
81
81
"frontend" : "start" ,
@@ -89,23 +89,23 @@ func Test_convertSidecar(t *testing.T) {
89
89
circDepContainers : []string {"frontend" , "foo" },
90
90
},
91
91
"invalid container dependency status" : {
92
- inPort : "2000" ,
92
+ inPort : aws . String ( "2000" ) ,
93
93
inEssential : true ,
94
94
inDependsOn : map [string ]string {
95
95
"frontend" : "never" ,
96
96
},
97
97
wantedErr : errInvalidDependsOnStatus ,
98
98
},
99
99
"invalid essential container dependency status" : {
100
- inPort : "2000" ,
100
+ inPort : aws . String ( "2000" ) ,
101
101
inEssential : true ,
102
102
inDependsOn : map [string ]string {
103
103
"frontend" : "complete" ,
104
104
},
105
105
wantedErr : errEssentialContainerStatus ,
106
106
},
107
107
"good essential container dependencies" : {
108
- inPort : "2000" ,
108
+ inPort : aws . String ( "2000" ) ,
109
109
inEssential : true ,
110
110
inDependsOn : map [string ]string {
111
111
"frontend" : "start" ,
@@ -125,15 +125,13 @@ func Test_convertSidecar(t *testing.T) {
125
125
},
126
126
},
127
127
"good nonessential container dependencies" : {
128
- inPort : "2000" ,
129
128
inEssential : false ,
130
129
inDependsOn : map [string ]string {
131
130
"frontend" : "start" ,
132
131
},
133
132
134
133
wanted : & template.SidecarOpts {
135
134
Name : aws .String ("foo" ),
136
- Port : aws .String ("2000" ),
137
135
CredsParam : mockCredsParam ,
138
136
Image : mockImage ,
139
137
Secrets : mockMap ,
@@ -145,7 +143,7 @@ func Test_convertSidecar(t *testing.T) {
145
143
},
146
144
},
147
145
"specify essential as false" : {
148
- inPort : "2000" ,
146
+ inPort : aws . String ( "2000" ) ,
149
147
inEssential : false ,
150
148
inLabels : map [string ]string {
151
149
"com.amazonaws.ecs.copilot.sidecar.description" : "wow" ,
@@ -174,7 +172,7 @@ func Test_convertSidecar(t *testing.T) {
174
172
Secrets : mockMap ,
175
173
Variables : mockMap ,
176
174
Essential : aws .Bool (tc .inEssential ),
177
- Port : aws . String ( tc .inPort ) ,
175
+ Port : tc .inPort ,
178
176
DockerLabels : tc .inLabels ,
179
177
DependsOn : tc .inDependsOn ,
180
178
},
0 commit comments