Skip to content

Commit 07efc9f

Browse files
committed
added integration test
1 parent 8706a3e commit 07efc9f

16 files changed

Lines changed: 475 additions & 0 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if test_scenario['values']['openshift'] == 'true' %}
2+
# see https://github.com/stackabletech/issues/issues/566
3+
---
4+
apiVersion: kuttl.dev/v1beta1
5+
kind: TestStep
6+
commands:
7+
- script: kubectl patch namespace $NAMESPACE -p '{"metadata":{"labels":{"pod-security.kubernetes.io/enforce":"privileged"}}}'
8+
timeout: 120
9+
{% endif %}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
kind: Role
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
metadata:
5+
name: test-role
6+
rules:
7+
{% if test_scenario['values']['openshift'] == "true" %}
8+
- apiGroups: ["security.openshift.io"]
9+
resources: ["securitycontextconstraints"]
10+
resourceNames: ["privileged"]
11+
verbs: ["use"]
12+
{% endif %}
13+
---
14+
apiVersion: v1
15+
kind: ServiceAccount
16+
metadata:
17+
name: test-sa
18+
---
19+
kind: RoleBinding
20+
apiVersion: rbac.authorization.k8s.io/v1
21+
metadata:
22+
name: test-rb
23+
subjects:
24+
- kind: ServiceAccount
25+
name: test-sa
26+
roleRef:
27+
kind: Role
28+
name: test-role
29+
apiGroup: rbac.authorization.k8s.io
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
metadata:
5+
name: test-airflow-postgresql
6+
timeout: 480
7+
---
8+
apiVersion: apps/v1
9+
kind: StatefulSet
10+
metadata:
11+
name: airflow-postgresql
12+
status:
13+
readyReplicas: 1
14+
replicas: 1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestStep
4+
commands:
5+
- script: >-
6+
helm install airflow-postgresql
7+
--namespace $NAMESPACE
8+
--version 16.4.2
9+
-f helm-bitnami-postgresql-values.yaml
10+
oci://registry-1.docker.io/bitnamicharts/postgresql
11+
--wait
12+
timeout: 600
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% if test_scenario['values']['executor'] == 'celery' %}
2+
---
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestAssert
5+
metadata:
6+
name: test-airflow-redis
7+
timeout: 360
8+
---
9+
apiVersion: apps/v1
10+
kind: StatefulSet
11+
metadata:
12+
name: airflow-redis-master
13+
status:
14+
readyReplicas: 1
15+
replicas: 1
16+
---
17+
apiVersion: apps/v1
18+
kind: StatefulSet
19+
metadata:
20+
name: airflow-redis-replicas
21+
status:
22+
readyReplicas: 1
23+
replicas: 1
24+
{% endif %}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% if test_scenario['values']['executor'] == 'celery' %}
2+
---
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestStep
5+
commands:
6+
- script: >-
7+
helm install airflow-redis
8+
--namespace $NAMESPACE
9+
--version 17.11.3
10+
-f helm-bitnami-redis-values.yaml
11+
--repo https://charts.bitnami.com/bitnami redis
12+
--wait
13+
timeout: 600
14+
{% endif %}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
5+
---
6+
apiVersion: v1
7+
kind: ConfigMap
8+
metadata:
9+
name: vector-aggregator-discovery
10+
{% endif %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
2+
---
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: vector-aggregator-discovery
7+
data:
8+
ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }}
9+
{% endif %}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
metadata:
5+
name: test-available-condition
6+
timeout: 600
7+
commands:
8+
- script: kubectl -n $NAMESPACE wait --for=condition=available airflowclusters.airflow.stackable.tech/airflow --timeout 301s
9+
---
10+
apiVersion: kuttl.dev/v1beta1
11+
kind: TestAssert
12+
metadata:
13+
name: test-airflow-cluster
14+
timeout: 1200
15+
---
16+
apiVersion: apps/v1
17+
kind: StatefulSet
18+
metadata:
19+
name: airflow-webserver-default
20+
spec:
21+
template:
22+
spec:
23+
terminationGracePeriodSeconds: 120
24+
status:
25+
readyReplicas: 1
26+
replicas: 1
27+
---
28+
apiVersion: apps/v1
29+
kind: StatefulSet
30+
metadata:
31+
name: airflow-webserver-external-unstable
32+
status:
33+
readyReplicas: 1
34+
replicas: 1
35+
---
36+
apiVersion: apps/v1
37+
kind: StatefulSet
38+
metadata:
39+
name: airflow-webserver-cluster-internal
40+
status:
41+
readyReplicas: 1
42+
replicas: 1
43+
{% if test_scenario['values']['executor'] == 'celery' %}
44+
---
45+
apiVersion: apps/v1
46+
kind: StatefulSet
47+
metadata:
48+
name: airflow-worker-default
49+
spec:
50+
template:
51+
spec:
52+
terminationGracePeriodSeconds: 300
53+
status:
54+
readyReplicas: 2
55+
replicas: 2
56+
{% endif %}
57+
---
58+
apiVersion: apps/v1
59+
kind: StatefulSet
60+
metadata:
61+
name: airflow-scheduler-default
62+
spec:
63+
template:
64+
spec:
65+
terminationGracePeriodSeconds: 120
66+
status:
67+
readyReplicas: 1
68+
replicas: 1
69+
---
70+
apiVersion: policy/v1
71+
kind: PodDisruptionBudget
72+
metadata:
73+
name: airflow-webserver
74+
status:
75+
expectedPods: 3
76+
currentHealthy: 3
77+
disruptionsAllowed: 1
78+
{% if test_scenario['values']['executor'] == 'celery' %}
79+
---
80+
apiVersion: policy/v1
81+
kind: PodDisruptionBudget
82+
metadata:
83+
name: airflow-worker
84+
status:
85+
expectedPods: 2
86+
currentHealthy: 2
87+
disruptionsAllowed: 1
88+
{% endif %}
89+
---
90+
apiVersion: policy/v1
91+
kind: PodDisruptionBudget
92+
metadata:
93+
name: airflow-scheduler
94+
status:
95+
expectedPods: 1
96+
currentHealthy: 1
97+
disruptionsAllowed: 1
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
metadata:
4+
name: install-airflow-db
5+
timeout: 480
6+
---
7+
apiVersion: v1
8+
kind: Secret
9+
metadata:
10+
name: test-airflow-credentials
11+
type: Opaque
12+
stringData:
13+
adminUser.username: airflow
14+
adminUser.firstname: Airflow
15+
adminUser.lastname: Admin
16+
adminUser.email: airflow@airflow.com
17+
adminUser.password: airflow
18+
connections.secretKey: thisISaSECRET_1234
19+
connections.sqlalchemyDatabaseUri: postgresql+psycopg2://airflow:airflow@airflow-postgresql/airflow
20+
connections.celeryResultBackend: db+postgresql://airflow:airflow@airflow-postgresql/airflow
21+
connections.celeryBrokerUrl: redis://:redis@airflow-redis-master:6379/0
22+
---
23+
apiVersion: airflow.stackable.tech/v1alpha1
24+
kind: AirflowCluster
25+
metadata:
26+
name: airflow
27+
spec:
28+
image:
29+
{% if test_scenario['values']['airflow'].find(",") > 0 %}
30+
custom: "{{ test_scenario['values']['airflow'].split(',')[1] }}"
31+
productVersion: "{{ test_scenario['values']['airflow'].split(',')[0] }}"
32+
{% else %}
33+
productVersion: "{{ test_scenario['values']['airflow'] }}"
34+
{% endif %}
35+
pullPolicy: IfNotPresent
36+
clusterConfig:
37+
loadExamples: true
38+
credentialsSecret: test-airflow-credentials
39+
webservers:
40+
config:
41+
listenerClass: external-stable
42+
roleGroups:
43+
default:
44+
replicas: 1
45+
external-unstable:
46+
replicas: 1
47+
config:
48+
listenerClass: external-unstable
49+
cluster-internal:
50+
replicas: 1
51+
config:
52+
listenerClass: cluster-internal
53+
celeryExecutors:
54+
config:
55+
listenerClass: external-stable
56+
roleGroups:
57+
default:
58+
replicas: 2
59+
schedulers:
60+
config:
61+
listenerClass: external-unstable
62+
roleGroups:
63+
default:
64+
replicas: 1

0 commit comments

Comments
 (0)