Skip to content

Commit 4b7b81c

Browse files
committed
Update tests to cover container port naming
Signed-off-by: Angel Misevski <[email protected]>
1 parent 5682d20 commit 4b7b81c

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

pkg/library/container/testdata/component/converts-all-fields.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ output:
6666
- "test"
6767
- "args"
6868
ports:
69-
- name: "3100-wss"
69+
- name: "test-endpoint-1"
7070
containerPort: 3100
7171
protocol: TCP
72-
- name: "8080-http"
72+
- name: "test-endpoint-2"
7373
containerPort: 8080
7474
protocol: TCP
7575
volumeMounts:

pkg/library/container/testdata/container/endpoints-common-port.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ output:
3535
- name: "DEVWORKSPACE_COMPONENT_NAME"
3636
value: "testing-container-1"
3737
ports:
38-
- name: "3100-http"
38+
- name: "test-endpoint-1"
3939
containerPort: 3100
4040
protocol: TCP
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Uses endpoint name as port name if it it fits pod spec"
2+
3+
input:
4+
components:
5+
- name: testing-container-1
6+
container:
7+
image: testing-image-1
8+
memoryRequest: "-1" # isolate test to not include this field
9+
memoryLimit: "-1" # isolate test to not include this field
10+
cpuRequest: "-1" # isolate test to not include this field
11+
cpuLimit: "-1" # isolate test to not include this field
12+
mountSources: false
13+
endpoints:
14+
- name: "short-name" # Should use endpoint name if <=15 chars long (as supported by pod spec)
15+
targetPort: 8080
16+
protocol: http
17+
- name: "longer-endpoint-name" # Should fallback to "<port>-<protocol>" for names too long for pod spec
18+
targetPort: 8081
19+
protocol: http
20+
21+
output:
22+
podAdditions:
23+
containers:
24+
- name: testing-container-1
25+
image: testing-image-1
26+
imagePullPolicy: Always
27+
resources:
28+
requests:
29+
memory: "-1"
30+
cpu: "-1"
31+
limits:
32+
memory: "-1"
33+
cpu: "-1"
34+
env:
35+
- name: "DEVWORKSPACE_COMPONENT_NAME"
36+
value: "testing-container-1"
37+
ports:
38+
- name: "short-name"
39+
containerPort: 8080
40+
protocol: TCP
41+
- name: "8081-http"
42+
containerPort: 8081
43+
protocol: TCP

0 commit comments

Comments
 (0)