85 lines
3.4 KiB
YAML
85 lines
3.4 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: @@JOB_NAME@@
|
|
namespace: remora-testbed
|
|
labels:
|
|
app.kubernetes.io/name: remora-deployment-test
|
|
spec:
|
|
backoffLimit: 0
|
|
activeDeadlineSeconds: 300
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: remora-deployment-test
|
|
spec:
|
|
restartPolicy: Never
|
|
automountServiceAccountToken: false
|
|
enableServiceLinks: false
|
|
dnsPolicy: None
|
|
dnsConfig:
|
|
nameservers: [10.96.0.53]
|
|
searches: [remora-testbed.svc.cluster.local, svc.cluster.local, cluster.local]
|
|
options:
|
|
- {name: ndots, value: "5"}
|
|
initContainers:
|
|
- name: smoke
|
|
image: @@CURL_IMAGE@@
|
|
imagePullPolicy: Never
|
|
command: [sh, -ec]
|
|
args:
|
|
- |
|
|
retry="--retry 30 --retry-all-errors --retry-delay 1"
|
|
expect_status() {
|
|
name="$1"
|
|
expected="$2"
|
|
shift 2
|
|
actual="$(curl $retry --silent --output /dev/null --write-out '%{http_code}' "$@")"
|
|
if test "$actual" != "$expected"; then
|
|
printf '%s returned HTTP %s, expected %s\n' "$name" "$actual" "$expected" >&2
|
|
return 1
|
|
fi
|
|
}
|
|
expect_body() {
|
|
name="$1"
|
|
pattern="$2"
|
|
shift 2
|
|
if ! curl $retry --fail --silent "$@" | grep -q "$pattern"; then
|
|
printf '%s did not contain the expected response marker\n' "$name" >&2
|
|
return 1
|
|
fi
|
|
}
|
|
expect_status "API readiness" 200 http://remora-remora-api-metrics:9090/health/ready
|
|
expect_status "Web readiness" 200 http://remora-remora-web/health/ready
|
|
expect_body "API metrics" remora_background_runs_total http://remora-remora-api-metrics:9090/metrics
|
|
expect_body "Web runtime configuration" '"apiUrl":"/bff/api/"' http://remora-remora-web/runtime-config.js
|
|
expect_status "API authentication" 401 http://remora-remora/v1/jobs
|
|
if test -n "@@INGRESS_URL@@"; then
|
|
expect_body "Ingress WebClient" '<title>Remora</title>' --header 'Host: qualification-ingress' --header 'Accept: text/html' @@INGRESS_URL@@/
|
|
expect_status "Ingress API authentication" 401 --header 'Host: qualification-ingress' @@INGRESS_URL@@/v1/jobs
|
|
fi
|
|
if curl --connect-timeout 2 --max-time 5 --insecure --silent --fail https://remora-remora-worker:8443/internal/v1/jobs/x/claim >/dev/null 2>&1; then
|
|
exit 1
|
|
fi
|
|
resources:
|
|
requests: {cpu: 10m, memory: 16Mi}
|
|
limits: {cpu: 250m, memory: 64Mi}
|
|
containers:
|
|
- name: tests
|
|
image: @@TEST_IMAGE@@
|
|
imagePullPolicy: Never
|
|
envFrom:
|
|
- configMapRef:
|
|
name: @@PROFILE_NAME@@
|
|
env:
|
|
- {name: REMORA_DEPLOYMENT_API_URL, value: "http://remora-remora/v1"}
|
|
- {name: REMORA_EXPECTED_JOB_ID, value: "@@EXPECTED_JOB_ID@@"}
|
|
volumeMounts:
|
|
- {name: profile, mountPath: /run/remora-fixture, readOnly: true}
|
|
resources:
|
|
requests: {cpu: 100m, memory: 128Mi}
|
|
limits: {cpu: "2", memory: 1Gi}
|
|
volumes:
|
|
- name: profile
|
|
configMap:
|
|
name: @@PROFILE_NAME@@-file
|