From 0039cd9cd2f40a13ca2e4919d9016ef0a24f2e14 Mon Sep 17 00:00:00 2001 From: Adam Blasko Date: Mon, 13 Nov 2023 10:14:27 +0100 Subject: [PATCH] Adding simple test Added CI implementation --- .github/workflows/ci.yaml | 24 ++++++++++++++++++++++++ templates/tests/watchlist-api-test.yaml | 19 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 templates/tests/watchlist-api-test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be7571f..f3b3886 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,8 @@ jobs: # this is needed only temporarily - see https://github.com/helm/helm/issues/12423 version: 3.12.3 token: ${{ secrets.GITHUB_TOKEN }} + - name: Install kubectl + uses: azure/setup-kubectl@v3 - name: Build helm dependencies run: | helm dependency build . @@ -30,3 +32,25 @@ jobs: - uses: actions/setup-python@v3 - uses: gabe565/setup-helm-docs-action@v1 - uses: pre-commit/action@v3.0.0 + - name: Create kind cluster + uses: helm/kind-action@v1.8.0 + - name: Install chart prerequisites + env: + REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }} + LICENSE_BASE64: ${{ secrets.LICENSE_BASE64 }} + run: | + kubectl create secret docker-registry --dry-run=client sf-gitlab-registry-creds \ + --docker-server=registry.gitlab.com \ + --docker-username=sf-distribution \ + --docker-password=$(REGISTRY_PASS) -o yaml > docker-secret.yaml + echo $(LICENSE_BASE64) | base64 -d > iengine.lic + kubectl create secret generic --dry-run=client iface-lic \ + --from-file=iengine.lic -o yaml > lic-secret.yaml + kubectl apply -f docker-secret.yaml + kubectl apply -f lic-secret.yaml + - name: Install helm chart + run: | + helm install smartface . + - name: Test helm chart + run: | + helm test smartface diff --git a/templates/tests/watchlist-api-test.yaml b/templates/tests/watchlist-api-test.yaml new file mode 100644 index 0000000..bf96707 --- /dev/null +++ b/templates/tests/watchlist-api-test.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "wl-test" + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test + image: registry.gitlab.com/innovatrics/smartface/sf-cloud-func-test:2 + args: ['--filter', 'SkipOnPlatform!=Cloud'] + env: + - name: "SF_TEST_API_URL" + value: "http://{{ include "smartface.api.name" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.api.servicePort }}" + restartPolicy: Never + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }}