Files
library-charts/library/common-test/tests/service/node_port_test.yaml
Stavros Kois 910b9827ed Ns set explicitly (#489)
**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
2023-07-08 12:41:04 +03:00

189 lines
5.2 KiB
YAML

suite: service nodePort test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass with type nodePort
set:
service:
my-service:
enabled: true
primary: true
type: NodePort
ports:
port-name:
enabled: true
primary: true
port: 12345
nodePort: 30000
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: &serviceDoc 1
isKind:
of: Service
- documentIndex: *serviceDoc
isAPIVersion:
of: v1
- documentIndex: *serviceDoc
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *serviceDoc
equal:
path: spec
value:
type: NodePort
publishNotReadyAddresses: false
ports:
- name: port-name
port: 12345
protocol: TCP
targetPort: 12345
nodePort: 30000
selector:
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/name: common-test
pod.name: my-workload
- it: should pass with type NodePort and hostnetwork enabled
set:
service:
my-service:
enabled: true
primary: true
type: NodePort
ports:
port-name:
enabled: true
primary: true
port: 12345
nodePort: 30000
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec:
hostNetwork: true
asserts:
- documentIndex: &serviceDoc 1
isKind:
of: Service
- documentIndex: *serviceDoc
isAPIVersion:
of: v1
- documentIndex: *serviceDoc
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *serviceDoc
equal:
path: spec
value:
type: ClusterIP
publishNotReadyAddresses: false
ports:
- name: port-name
port: 12345
protocol: TCP
targetPort: 12345
selector:
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/name: common-test
pod.name: my-workload
- documentIndex: *serviceDoc
isNull:
path: spec.ports[0].nodePort
- it: should pass with type NodePort and available options set
set:
some_ip: 172.16.20.35
some_family: IPv6
some_policy: Local
some_other_ip: 10.200.34.53
some_affinity: ClientIP
some_timeout: 100
some_port: 12344
some_target_port: 12346
some_protocol: http
some_nodePort: 30001
service:
my-service:
enabled: true
primary: true
type: NodePort
clusterIP: "{{ .Values.some_ip }}"
externalTrafficPolicy: "{{ .Values.some_policy }}"
publishNotReadyAddresses: true
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- "{{ .Values.some_family }}"
externalIPs:
- "{{ .Values.some_other_ip }}"
- 10.200.34.54
sessionAffinity: "{{ .Values.some_affinity }}"
sessionAffinityConfig:
clientIP:
timeoutSeconds: "{{ .Values.some_timeout }}"
ports:
port-name:
enabled: true
primary: true
port: 12345
nodePort: 30000
port-name2:
enabled: true
port: "{{ .Values.some_port }}"
targetPort: "{{ .Values.some_target_port }}"
protocol: "{{ .Values.some_protocol }}"
nodePort: "{{ .Values.some_nodePort }}"
workload:
my-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: *serviceDoc
equal:
path: spec
value:
type: NodePort
clusterIP: 172.16.20.35
externalTrafficPolicy: Local
ipFamilyPolicy: PreferDualStack
publishNotReadyAddresses: true
ipFamilies:
- IPv4
- IPv6
externalIPs:
- 10.200.34.53
- 10.200.34.54
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 100
ports:
- name: port-name
port: 12345
protocol: TCP
targetPort: 12345
nodePort: 30000
- name: port-name2
port: 12344
protocol: TCP
targetPort: 12346
nodePort: 30001
selector:
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/name: common-test
pod.name: my-workload