Skip to content

Commit

Permalink
test: create separate helm charts for each test case (#25)
Browse files Browse the repository at this point in the history
Signed-off-by: Yoep Kortekaas <[email protected]>
  • Loading branch information
Kortekaasy authored Nov 16, 2023
1 parent d625cd5 commit 1fb0438
Show file tree
Hide file tree
Showing 22 changed files with 296 additions and 151 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ jobs:
uses: helm/[email protected]
- name: Install and test helm charts
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'push'
run: ct install --target-branch ${{ env.TARGET_BRANCH }} --since ${{ env.SINCE }}
run: |
for TEST_DIR in tests/ci/*
do
echo "Running test $(pwd)/${TEST_DIR}"
ct install --target-branch ${{ env.TARGET_BRANCH }} --charts $(pwd)/${TEST_DIR}
done
- if: github.event_name == 'push' && github.ref_name == 'main'
name: Run chart-releaser
uses: helm/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore chart locks produced by ct testing
tests/ci/*/Chart.lock

# Ignore chart archives produced by ct testing
tests/ci/*/charts
2 changes: 1 addition & 1 deletion charts/zot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ appVersion: v2.0.0-rc6
description: A Helm chart for Kubernetes
name: zot
type: application
version: 0.1.34
version: 0.1.35
35 changes: 0 additions & 35 deletions charts/zot/ci/mount-config-secrets-values.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions charts/zot/ci/static-cluster-ip-values.yaml

This file was deleted.

48 changes: 0 additions & 48 deletions charts/zot/ci/tls-values.yaml

This file was deleted.

1 change: 1 addition & 0 deletions charts/zot/templates/tests/test-connection-fails.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
{{- include "zot.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
spec:
containers:
- name: wget
Expand Down
64 changes: 1 addition & 63 deletions charts/zot/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,74 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: servercert
data:
certificate: |-
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN6akNDQWJhZ0F3SUJBZ0lVR3pFR1pjY3VU
Y2tDeU9KYzVSTExrZVpYZGJFd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0RERUtNQWdHQTFVRUF3d0JL
akFlRncweU16QTNNVGN4TmpBNU1UZGFGdzB6TXpBM01UUXhOakE1TVRkYQpNQ0V4RXpBUkJnTlZC
QXNNQ2xSbGMzUlRaWEoyWlhJeENqQUlCZ05WQkFNTUFTb3dnZ0VpTUEwR0NTcUdTSWIzCkRRRUJB
UVVBQTRJQkR3QXdnZ0VLQW9JQkFRQ2dLVVlPMS9pemJTK1QvSTBOZE9xUENSM1AzWEY2YlFPdnYw
YzYKU1FnVCtyU3B6K2tacnYrd2orQTlDYVUyTnVxZ1k1dEl5aHltWDZOLzVGWGw3RnMyOGhZdFZu
ZXI0SXN1WDBPQwo3WUhINTMwdGd5a1VzM3BwYzZqSjlqQjNLOEVaN2tKaGUxdGxTRytsaUUwMFFs
Yk5nbnJOR2JPS1ltaGxrTTBWClJtNzlTbytqNmVZUlZPZHhJNkFDdWplNTJiYXlFN2p3ZndyeEIx
a1ZMWEFGQU12enFOWkRiNzNZSWM2bE1jOWoKcmcxOUFkQklFbjBkc1FxQ3V3VDhoYXdwbldNR0kv
Mi9ySWduWTZHOEVqN1hsMnBYSlhvZmsxZTlHb25uQTZ0NwpnYWl5VmQ4ZUtYUjQxNnpIb3FGN1Z6
RkZNcU4rSGs1VUlLeVJ2OVZ0T1dVOHdVNEZBZ01CQUFHakV6QVJNQThHCkExVWRFUVFJTUFhSEJI
OEFBQUV3RFFZSktvWklodmNOQVFFTEJRQURnZ0VCQUduZnJmbFFkTVpYNEEw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hOT2RQd1BlbDdaZEM1Z1RwTmNjSE9obUpmSmwxMEVwc2NGRmI4MDlldk1C
CmEweFcvSlUySFkzVnozc0RHUDdkZHE4bFJQdGY3UmJ1TitPYndvME1RY2FHbDNNRlcvamlPWHNC
SnBZenQ0REoKRnE2Mmg1NFk5NVZCZmMrVnppaVJTcEtpWVVTMGhUYmRiWUxhcDZTWktoWlUwZS9T
MHFnSkM2SFFud0tCZ0E5cgpOMEZuaVVPcUhpV2NsS3JZeS9XZmh0RWpuRUdZcStNR1I0KzhkcVJl
bXBBRnFMWWxvUk9yM0xoVzEyb0hGbHYxClc5ME9tenVoaDZkeHpCaU5pRWx6VG9RRWNjWDBoWkFp
dnJpdzdYbVlmdXFtMEVUVWhmSWl6QldON1ROYi83RFQKVGptRTVyR3o4RTBpQlFFT2RlbXRUWGI4
TUxkS3FnZkt6NEdERVZTNUFvR0JBTDJOdHUyT0FlbS82Q0VadUZoegpsSzFnRXlYUzBjaXUxMmx1
UVhib3JEd3p3enErYWJWL3IwdlQveGtZS1BDUzVQMFVMUWhzQUd6N0tpck10clZCCkQvM3F5aXV6
UlU1cDg2SmlIa0c1Z1JHa2Y0TStsK0FMNjhaSytoY2FqWEJyN1VjM2ZKb3dpK3Z6NGlwaThERDYK
QVpHc2dMWlhjUWVjMkJJYWUrTHphalV6Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "zot.fullname" . }}-test-connection"
labels:
{{- include "zot.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
spec:
containers:
- name: wget
Expand Down
23 changes: 23 additions & 0 deletions tests/ci/default/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/default/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: default
description: Test chart for zot default values
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: 0.1.35
repository: "file://../../../charts/zot"
File renamed without changes.
23 changes: 23 additions & 0 deletions tests/ci/mount-config-secrets/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/mount-config-secrets/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: mount-config-secrets
description: Test chart for zot mount-config secrets values
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: 0.1.35
repository: "file://../../../charts/zot"
36 changes: 36 additions & 0 deletions tests/ci/mount-config-secrets/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
zot:
mountConfig: true
configFiles:
config.json: |-
{
"storage": { "rootDirectory": "/var/lib/registry" },
"http": {
"address": "0.0.0.0",
"port": "5000",
"auth": { "htpasswd": { "path": "/secret/htpasswd" } },
"accessControl": {
"repositories": {
"**": {
"policies": [{
"users": ["user"],
"actions": ["read"]
}],
"defaultPolicy": []
}
},
"adminPolicy": {
"users": ["admin"],
"actions": ["read", "create", "update", "delete"]
}
}
},
"log": { "level": "debug" }
}
mountSecret: true
secretFiles:
# Example htpasswd with 'admin:admin' & 'user:user' user:pass pairs
htpasswd: |-
admin:$2y$05$vmiurPmJvHylk78HHFWuruFFVePlit9rZWGA/FbZfTEmNRneGJtha
user:$2y$05$L86zqQDfH5y445dcMlwu6uHv.oXFgT6AiJCwpv3ehr7idc0rI3S2G
authHeader: "dXNlcjp1c2Vy"
23 changes: 23 additions & 0 deletions tests/ci/static-cluster-ip/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/static-cluster-ip/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: static-cluster-ip
description: Test chart for zot static cluster ip values
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: 0.1.35
repository: "file://../../../charts/zot"
4 changes: 4 additions & 0 deletions tests/ci/static-cluster-ip/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
zot:
service:
type: ClusterIP
clusterIP: 10.96.0.15
23 changes: 23 additions & 0 deletions tests/ci/tls/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
10 changes: 10 additions & 0 deletions tests/ci/tls/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: tls
description: Test chart for zot tls values
type: application
version: 0.1.0
appVersion: "0.1.0"
dependencies:
- name: zot
version: 0.1.35
repository: "file://../../../charts/zot"
Loading

0 comments on commit 1fb0438

Please sign in to comment.