Skip to content
Snippets Groups Projects
Verified Commit aa1516b9 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

Add basic tests on checker-deposit chart

Refs. swh/infra/sysadm-environment#4886
parent ac5f3d27
No related branches found
No related tags found
No related merge requests found
{{ if .Values.checker_deposit.enabled -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: checker-deposit-utils
namespace: {{ $.Values.namespace }}
data:
pre-stop-idempotent.sh: |
#!/bin/bash
# pre-stop hook can be triggered multiple times but we want it to be applied only
# once so container can warm-shutdown properly.
# When celery receives multiple times the sigterm signal, this ends up doing an
# immediate shutdown which prevents long-standing tasks to finish properly.
set -ex
WITNESS_FILE=/tmp/already-stopped
# Seed awk with the number of nanoseconds since epoch
# and have it generate a number between 0 and 1
sleep $(date +%s%N | awk '{srand($1); print rand()}')
if [ ! -e $WITNESS_FILE ]; then
touch $WITNESS_FILE
kill 1
fi
{{ end }}
{{ if .Values.checker_deposit.enabled -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: checker-deposit-utils
namespace: {{ $.Values.namespace }}
data:
pre-stop-idempotent.sh: |
#!/bin/bash
# pre-stop hook can be triggered multiple times but we want it to be applied only
# once so container can warm-shutdown properly.
# When celery receives multiple times the sigterm signal, this ends up doing an
# immediate shutdown which prevents long-standing tasks to finish properly.
set -ex
WITNESS_FILE=/tmp/already-stopped
# Seed awk with the number of nanoseconds since epoch
# and have it generate a number between 0 and 1
sleep $(date +%s%N | awk '{srand($1); print rand()}')
if [ ! -e $WITNESS_FILE ]; then
touch $WITNESS_FILE
kill 1
fi
---
apiVersion: v1
kind: ConfigMap
......
suite: test checker_deposit configmap deployment
templates:
- checker-deposit/configmap.yaml
tests:
- it: checker-deposit configmap should be deployed when activated
values:
- values/checker-deposit.yaml
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: checker-deposit-template
namespace: swh
- it: checker-deposit configmap namespace should be overridable
values:
- values/checker-deposit.yaml
set:
namespace: mynamespace
asserts:
- equal:
path: metadata.namespace
value: mynamespace
- hasDocuments:
count: 1
suite: test checker_deposit configmap utils deployment
templates:
- checker-deposit/configmap-utils.yaml
tests:
- it: checker-deposit configmap utils should be deployed when activated
values:
- values/checker-deposit.yaml
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: checker-deposit-utils
namespace: swh
- it: checker deposit configmap utils namespace should be overridable
values:
- values/checker-deposit.yaml
set:
namespace: mynamespace
asserts:
- equal:
path: metadata.namespace
value: mynamespace
- hasDocuments:
count: 1
suite: test global checker deposit deployment
templates:
- checker-deposit/deployment.yaml
- checker-deposit/configmap.yaml
- checker-deposit/configmap-utils.yaml
- checker-deposit/keda-autoscaling.yaml
tests:
- it: Checker deposit is not deployed by default
values:
- ../values.yaml
asserts:
- hasDocuments:
count: 0
checker_deposit:
enabled: true
storage:
host: storage.example.org
port: 5002
deposit:
host: deposit.example.org
amqp:
host: scheduler.example.org
autoScaling:
maxReplicaCount: 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment