Skip to content

Commit

Permalink
Multitenant test fixes
Browse files Browse the repository at this point in the history
Fixed configuration for multitenant tests
Added/modified CI to run and tests cluster also in multitenant configuration
  • Loading branch information
blaskoa committed Jan 25, 2024
1 parent 640cc2b commit 37d004a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Package and lint

name: Test helm chart
on:
push:
branches:
- '**'
tags-ignore:
- 'v*'
jobs:
ci:
package-lint:
runs-on: ubuntu-latest
strategy:
matrix:
variant-values: ['ci-multitenant-values.yaml', 'ci-edge-values.yaml']
steps:
- uses: actions/checkout@v3
- name: Setup helm CLI
Expand All @@ -32,7 +34,21 @@ jobs:
- uses: actions/setup-python@v3
- uses: gabe565/setup-helm-docs-action@v1
- uses: pre-commit/[email protected]
- name: Create kind cluster
test-cluster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup helm CLI
uses: azure/setup-helm@v3
with:
# 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 .- name: Create kind cluster
uses: helm/[email protected]
- name: Install chart prerequisites
env:
Expand All @@ -50,10 +66,10 @@ jobs:
kubectl apply -f lic-secret.yaml
- name: Install helm chart
env:
TENANT_1_ID: ${{ secrets.TENANT_1_ID }}
TENANT_1_SECRET: ${{ secrets.TENANT_1_SECRET }}
TENANT_2_SECRET: ${{ secrets.TENANT_2_SECRET }}
run: |
helm install smartface . -f ci-values.yaml --set tests.authentication.tenant1.clientId="$TENANT_1_ID" --set tests.authentication.tenant1.clientSecret="$TENANT_1_SECRET"
helm install smartface . -f ci-values.yaml --set tests.authentication.tenant1.clientSecret="$TENANT_1_SECRET" --set tests.authentication.tenant2.clientSecret="$TENANT_2_SECRET" -f ${{ matrix.variant-values }}
kubectl rollout status deployment sf-api --timeout=300s
kubectl wait --for=condition=complete job/sf-wl-update-log-population --timeout=300s
- name: Test helm chart
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added
- Added test pods supporting `helm test` command
- There are multiple test pods, some of which run based on what is possible to test in the selected chart configuration

### Breaking change
- deployment of SmartFace Station is now disabled by default. To reenable previous behavior with deploying SmartFace Station please set the `station.enabled` value to `true`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ metadata:
| tests.image.pullPolicy | string | `"IfNotPresent"` | Docker image pull policy |
| tests.image.registry | string | `nil` | The Docker registry, overrides `global.image.registry` |
| tests.image.repository | string | `"innovatrics/smartface/sf-cloud-func-tests"` | Docker image repository |
| tests.image.tag | string | `"v5_4.24.0.5415-dev"` | Countly publisher follows different versioning, so the chart app needs to be overridden |
| tests.image.tag | string | `"v5_4.24.0.5447-dev"` | Overrides the image tag whose default is the chart's appVersion |
| tests.nodeSelector | object | `{}` | |
| tests.podAnnotations | object | `{}` | Annotations for test pods |
| tests.podLabels | object | `{}` | Additional labels for test pods |
Expand Down
8 changes: 8 additions & 0 deletions ci-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ configurations:
authority: "https://smartface-test.eu.auth0.com"
audience: "https://api.ghaction.smartfacecloud.com"
oauthTokenUrl: "https://smartface-test.eu.auth0.com/oauth/token"
tests:
authentication:
tenant1:
name: "tenant-1"
clientId: "ZwZ71smcNTpCLHdqJNkMeLy2kM6cDwQY"
tenant2:
name: "tenant-2"
clientId: "guwK5NNDOj8hzYXfnJFVq4ZtuLx8RUTZ"
api:
resources: null
authApi:
Expand Down
2 changes: 1 addition & 1 deletion templates/tests/multitenant-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- if and .Values.authApi.enabled .Values.graphqlApi.enableAuth .Values.features.multitenancy -}}
{{- $name := include "smartface.multitenantTests.name" . -}}
{{- $apiUrl := printf "http://%s.%s.svc.cluster.local:%d" (include "smartface.authApi.name" .) .Release.Namespace (.Values.authApi.servicePort | int) -}}
{{- $apiMetricsUrl := printf "http://%s.%s.svc.cluster.local:%d" (include "smartface.authApi.name" .) .Release.Namespace (.Values.metrics.port | int) -}}
{{- $apiMetricsUrl := printf "http://%s.%s.svc.cluster.local:%d/metrics" (include "smartface.authApi.name" .) .Release.Namespace (.Values.metrics.port | int) -}}
{{- $configName := ( .Values.configurations.apiAuth.existingConfigMapName | default (include "smartface.auth.name" . )) }}
apiVersion: v1
kind: Pod
Expand Down
4 changes: 2 additions & 2 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@ tests:
registry: null
# -- Docker image repository
repository: innovatrics/smartface/sf-cloud-func-tests
# -- Countly publisher follows different versioning, so the chart app needs to be overridden
tag: v5_4.24.0.5415-dev
# -- Overrides the image tag whose default is the chart's appVersion
tag: v5_4.24.0.5447-dev
# -- Overrides the image tag with an image digest
digest: null
# -- Docker image pull policy
Expand Down

0 comments on commit 37d004a

Please sign in to comment.