fix common test mistake (#1031)

* fix common test mistake

* configfile.enabled

* VPN auto permissions fix

* trigger common-test install

* more thorough fix

* fix test to use sonarr instead of homerr

* use a super simple container

* try tweaking a bit to allow run as nonroot

* try fixing tests

* fix tests... again...

* fix... AGAIN...
This commit is contained in:
Kjeld Schouten-Lebbing 2021-09-25 19:23:43 +02:00 committed by GitHub
parent 63c8c0e80d
commit d9dffc7952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 79 deletions

View File

@ -22,4 +22,4 @@ name: common-test
sources:
- https://github.com/truecharts/apps/tree/master/charts/library/common-test
type: application
version: 3.1.3
version: 3.1.4

View File

@ -1,64 +0,0 @@
image:
repository: b4bz/homer
tag: latest
pullPolicy: IfNotPresent
service:
main:
ports:
main:
port: 8080
ingress:
main:
enabled: true
persistence:
config:
enabled: true
mountPath: /config
type: emptyDir
accessMode: ReadWriteOnce
size: 1Gi
skipuninstall: false
hostPathMounts:
- name: "hpmmountempty"
enabled: true
type: emptyDir
mountPath: "/test1"
hostPath: ""
readOnly: false
- name: "hpmmountnonempty"
enabled: true
emptyDir:
enabled: false
mountPath: "/test2"
hostPath: "/tmp"
readOnly: false
- name: "hpmmountpermissions"
enabled: true
setPermissions: true
emptyDir:
enabled: false
mountPath: "/test3"
hostPath: "/tmp"
readOnly: false
- enabled: true
setPermissions: true
emptyDir:
enabled: false
mountPath: "/test4"
hostPath: "/tmp"
readOnly: false
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true

View File

@ -1,7 +1,7 @@
image:
repository: b4bz/homer
tag: latest@sha256:0f59f17700daccb51632372bcc20623f32b47f6cd0945c8c0b1f13608abc0045
repository: traefik/whoami
pullPolicy: IfNotPresent
tag: v1.6.1@sha256:16012fe4680ce69348d98627c7d42c1ea5ffde7bc4d66aaae426bd8d05af0d84
service:
main:

View File

@ -1,4 +1,14 @@
image:
repository: ghcr.io/truecharts/homer
tag: latest@sha256:afa37f010ca951421e688b81a7ff3ef3bd58afe3d839c3f0f0870fccac17dfe7
repository: traefik/whoami
pullPolicy: IfNotPresent
tag: v1.6.1@sha256:16012fe4680ce69348d98627c7d42c1ea5ffde7bc4d66aaae426bd8d05af0d84
args:
- --port
- '8080'
service:
main:
ports:
main:
port: 8080

View File

@ -27,9 +27,9 @@ before chart installation.
command:
- "/bin/sh"
- "-c"
- "echo 'Automatically correcting permissions...';{{ if .Values.addons.vpn.configFile }}chown -R 568:568 /vpn/vpn.conf; chmod -R g+w /vpn/vpn.conf;{{ end }}{{ range $_, $hpm := $hostPathMounts }}chown -R :{{ $group }} {{ $hpm.mountPath | squote }}; chmod -R g+w {{ $hpm.mountPath | squote }};{{ end }}"
- "echo 'Automatically correcting permissions...';{{ if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}chown -R 568:568 /vpn/vpn.conf; chmod -R g+w /vpn/vpn.conf;{{ end }}{{ range $_, $hpm := $hostPathMounts }}chown -R :{{ $group }} {{ $hpm.mountPath | squote }}; chmod -R g+w {{ $hpm.mountPath | squote }};{{ end }}"
volumeMounts:
{{- if .Values.addons.vpn.configFile }}
{{- if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}
- name: vpnconfig
mountPath: /vpn/vpn.conf
{{- end }}

View File

@ -63,7 +63,7 @@ func (suite *ContainerTestSuite) TestArgs() {
values []string
expectedArgs []string
}{
"Default": {values: nil, expectedArgs: nil},
"Default": {values: nil, expectedArgs: []string{"--port","8080"}},
"SingleString": {values: []string{"args=sleep infinity"}, expectedArgs: []string{"sleep infinity"}},
"StringList": {values: []string{"args={sleep,infinity}"}, expectedArgs: []string{"sleep", "infinity"}},
}
@ -115,7 +115,7 @@ func (suite *ContainerTestSuite) TestEnv() {
},
expectedEnv: map[string]string{
"DYN_ENV": "common-test-admin",
"S6_READ_ONLY_ROOT": "1", "
"S6_READ_ONLY_ROOT": "1",
"STATIC_ENV": "value_of_env",
"STATIC_EXPLICIT_ENV_FROM": "spec.nodeName",
"STATIC_IMPLICIT_ENV_FROM": "spec.nodeName",
@ -201,11 +201,11 @@ func (suite *ContainerTestSuite) TestPorts() {
expectedPort int
expectedProtocol string
}{
"Default": {values: nil, expectedPortName: "main", expectedPort: 0, expectedProtocol: "TCP"},
"Default": {values: nil, expectedPortName: "main", expectedPort: 8080, expectedProtocol: "TCP"},
"CustomName": {values: []string{"service.main.ports.main.enabled=false", "service.main.ports.server.enabled=true", "service.main.ports.server.port=8080"}, expectedPortName: "server", expectedPort: 8080, expectedProtocol: "TCP"},
"ProtocolHTTP": {values: []string{"service.main.ports.main.protocol=HTTP"}, expectedPortName: "main", expectedPort: 0, expectedProtocol: "TCP"},
"ProtocolHTTPS": {values: []string{"service.main.ports.main.protocol=HTTP"}, expectedPortName: "main", expectedPort: 0, expectedProtocol: "TCP"},
"ProtocolUDP": {values: []string{"service.main.ports.main.protocol=UDP"}, expectedPortName: "main", expectedPort: 0, expectedProtocol: "UDP"},
"ProtocolHTTP": {values: []string{"service.main.ports.main.protocol=HTTP"}, expectedPortName: "main", expectedPort: 8080, expectedProtocol: "TCP"},
"ProtocolHTTPS": {values: []string{"service.main.ports.main.protocol=HTTP"}, expectedPortName: "main", expectedPort: 8080, expectedProtocol: "TCP"},
"ProtocolUDP": {values: []string{"service.main.ports.main.protocol=UDP"}, expectedPortName: "main", expectedPort: 8080, expectedProtocol: "UDP"},
}
for name, tc := range tests {
suite.Suite.Run(name, func() {
@ -223,7 +223,7 @@ func (suite *ContainerTestSuite) TestPorts() {
suite.Assertions.EqualValues(tc.expectedProtocol, containerPorts[0].Path("protocol").Data())
if tc.expectedPort == 0 {
suite.Assertions.Empty(containerPorts[0].Path("containerPort").Data())
suite.Assertions.Empty(containerPorts[8080].Path("containerPort").Data())
} else {
suite.Assertions.EqualValues(tc.expectedPort, containerPorts[0].Path("containerPort").Data())
}

View File

@ -110,6 +110,7 @@ func (suite *IngressTestSuite) TestPathServices() {
"Default": {
values: []string{"ingress.main.enabled=true"},
expectedServiceName: "common-test",
expectedServicePort: 8080,
},
"CustomService": {
values: []string{

View File

@ -81,7 +81,7 @@ func (suite *PersistenceVolumeClaimTestSuite) TestMetaData() {
"app.kubernetes.io/managed-by": "Helm",
"app.kubernetes.io/name": "common-test",
"app.kubernetes.io/version":"latest",
"helm.sh/chart": "common-test-3.1.3",
"helm.sh/chart": "common-test-3.1.4",
}
tests := map[string]struct {