Skip to content

Commit 4e8a2d9

Browse files
committed
add test to check for FlowSynchronizationException
1 parent f0b66a4 commit 4e8a2d9

11 files changed

Lines changed: 1325 additions & 0 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% if test_scenario['values']['openshift'] == 'true' %}
2+
---
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestStep
5+
commands:
6+
- script: kubectl patch namespace $NAMESPACE -p '{"metadata":{"labels":{"pod-security.kubernetes.io/enforce":"privileged"}}}'
7+
timeout: 120
8+
{% endif %}
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: TestAssert
4+
timeout: 1200
5+
---
6+
apiVersion: apps/v1
7+
kind: StatefulSet
8+
metadata:
9+
name: nifi-node-default
10+
status:
11+
readyReplicas: 2
12+
replicas: 2
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
---
2+
apiVersion: authentication.stackable.tech/v1alpha1
3+
kind: AuthenticationClass
4+
metadata:
5+
name: nifi-users
6+
spec:
7+
provider:
8+
static:
9+
userCredentialsSecret:
10+
name: nifi-user-credentials
11+
---
12+
apiVersion: v1
13+
kind: Secret
14+
metadata:
15+
name: nifi-user-credentials
16+
stringData:
17+
admin: admin
18+
---
19+
apiVersion: v1
20+
kind: Secret
21+
metadata:
22+
name: nifi-sensitive-property-key
23+
stringData:
24+
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
25+
---
26+
apiVersion: v1
27+
kind: ConfigMap
28+
metadata:
29+
name: nifi-flow-trigger
30+
data:
31+
flow.json: |
32+
{
33+
"encodingVersion": {
34+
"majorVersion": 2,
35+
"minorVersion": 0
36+
},
37+
"maxTimerDrivenThreadCount": 10,
38+
"registries": [],
39+
"parameterContexts": [],
40+
"parameterProviders": [],
41+
"controllerServices": [],
42+
"reportingTasks": [],
43+
"flowAnalysisRules": [],
44+
"rootGroup": {
45+
"identifier": "root-group-0000-0000-000000000001",
46+
"instanceIdentifier": "root-inst-0000-0000-000000000001",
47+
"name": "NiFi Flow",
48+
"comments": "",
49+
"position": { "x": 0.0, "y": 0.0 },
50+
"processGroups": [
51+
{
52+
"identifier": "child-group-000-0000-000000000001",
53+
"instanceIdentifier": "child-inst-0000-0000-000000000001",
54+
"name": "ChildGroup",
55+
"comments": "",
56+
"position": { "x": 400.0, "y": 0.0 },
57+
"processGroups": [],
58+
"remoteProcessGroups": [],
59+
"processors": [],
60+
"inputPorts": [],
61+
"outputPorts": [],
62+
"connections": [],
63+
"labels": [],
64+
"funnels": [],
65+
"controllerServices": [
66+
{
67+
"identifier": "cs-http-ctx-0000-0000-000000000001",
68+
"instanceIdentifier": "cs-http-inst-0000-0000-00000000child",
69+
"name": "StandardHttpContextMap",
70+
"comments": "",
71+
"type": "org.apache.nifi.http.StandardHttpContextMap",
72+
"bundle": {
73+
"group": "org.apache.nifi",
74+
"artifact": "nifi-http-context-map-nar",
75+
"version": "{{ test_scenario['values']['nifi-latest'] }}"
76+
},
77+
"properties": {
78+
"Request Expiration": "2 min",
79+
"Maximum Outstanding Requests": "5000"
80+
},
81+
"propertyDescriptors": {},
82+
"controllerServiceApis": [
83+
{
84+
"type": "org.apache.nifi.http.HttpContextMap",
85+
"bundle": {
86+
"group": "org.apache.nifi",
87+
"artifact": "nifi-standard-services-api-nar",
88+
"version": "{{ test_scenario['values']['nifi-latest'] }}"
89+
}
90+
}
91+
],
92+
"scheduledState": "ENABLED",
93+
"bulletinLevel": "WARN",
94+
"componentType": "CONTROLLER_SERVICE",
95+
"groupIdentifier": "child-group-000-0000-000000000001"
96+
}
97+
],
98+
"defaultFlowFileExpiration": "0 sec",
99+
"defaultBackPressureObjectThreshold": 10000,
100+
"defaultBackPressureDataSizeThreshold": "1 GB",
101+
"scheduledState": "ENABLED",
102+
"executionEngine": "INHERITED",
103+
"maxConcurrentTasks": 1,
104+
"statelessFlowTimeout": "1 min",
105+
"flowFileConcurrency": "UNBOUNDED",
106+
"flowFileOutboundPolicy": "STREAM_WHEN_AVAILABLE",
107+
"componentType": "PROCESS_GROUP"
108+
}
109+
],
110+
"remoteProcessGroups": [],
111+
"processors": [],
112+
"inputPorts": [],
113+
"outputPorts": [],
114+
"connections": [],
115+
"labels": [],
116+
"funnels": [],
117+
"controllerServices": [
118+
{
119+
"identifier": "cs-http-ctx-0000-0000-000000000001",
120+
"instanceIdentifier": "cs-http-inst-0000-0000-000000000root",
121+
"name": "StandardHttpContextMap",
122+
"comments": "",
123+
"type": "org.apache.nifi.http.StandardHttpContextMap",
124+
"bundle": {
125+
"group": "org.apache.nifi",
126+
"artifact": "nifi-http-context-map-nar",
127+
"version": "{{ test_scenario['values']['nifi-latest'] }}"
128+
},
129+
"properties": {
130+
"Request Expiration": "1 min",
131+
"Maximum Outstanding Requests": "5000"
132+
},
133+
"propertyDescriptors": {},
134+
"controllerServiceApis": [
135+
{
136+
"type": "org.apache.nifi.http.HttpContextMap",
137+
"bundle": {
138+
"group": "org.apache.nifi",
139+
"artifact": "nifi-standard-services-api-nar",
140+
"version": "{{ test_scenario['values']['nifi-latest'] }}"
141+
}
142+
}
143+
],
144+
"scheduledState": "ENABLED",
145+
"bulletinLevel": "WARN",
146+
"componentType": "CONTROLLER_SERVICE",
147+
"groupIdentifier": "root-group-0000-0000-000000000001"
148+
}
149+
],
150+
"defaultFlowFileExpiration": "0 sec",
151+
"defaultBackPressureObjectThreshold": 10000,
152+
"defaultBackPressureDataSizeThreshold": "1 GB",
153+
"scheduledState": "ENABLED",
154+
"executionEngine": "INHERITED",
155+
"maxConcurrentTasks": 1,
156+
"statelessFlowTimeout": "1 min",
157+
"flowFileConcurrency": "UNBOUNDED",
158+
"flowFileOutboundPolicy": "STREAM_WHEN_AVAILABLE",
159+
"componentType": "PROCESS_GROUP"
160+
}
161+
}
162+
---
163+
apiVersion: nifi.stackable.tech/v1alpha1
164+
kind: NifiCluster
165+
metadata:
166+
name: nifi
167+
spec:
168+
image:
169+
{% if test_scenario['values']['nifi-latest'].find(",") > 0 %}
170+
custom: "{{ test_scenario['values']['nifi-latest'].split(',')[1] }}"
171+
productVersion: "{{ test_scenario['values']['nifi-latest'].split(',')[0] }}"
172+
{% else %}
173+
custom: null
174+
productVersion: "{{ test_scenario['values']['nifi-latest'] }}"
175+
{% endif %}
176+
pullPolicy: IfNotPresent
177+
clusterConfig:
178+
authentication:
179+
- authenticationClass: nifi-users
180+
sensitiveProperties:
181+
keySecret: nifi-sensitive-property-key
182+
nodes:
183+
roleConfig:
184+
listenerClass: cluster-internal
185+
configOverrides:
186+
nifi.properties:
187+
nifi.web.https.sni.required: "false"
188+
nifi.web.https.sni.host.check: "false"
189+
podOverrides:
190+
spec:
191+
initContainers:
192+
- name: init-flow
193+
image: oci.stackable.tech/sdp/testing-tools/nifi:0.3.0-stackable0.0.0-dev
194+
command:
195+
- /bin/bash
196+
- -c
197+
args:
198+
- gzip --stdout /stackable/nifi/flow/flow.json > /stackable/data/database/flow.json.gz
199+
volumeMounts:
200+
- name: nifi-flow
201+
mountPath: /stackable/nifi/flow
202+
- name: database-repository
203+
mountPath: /stackable/data/database
204+
volumes:
205+
- name: nifi-flow
206+
configMap:
207+
name: nifi-flow-trigger
208+
roleGroups:
209+
default:
210+
replicas: 2
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: TestAssert
4+
timeout: 1200
5+
---
6+
apiVersion: apps/v1
7+
kind: StatefulSet
8+
metadata:
9+
name: test-nifi
10+
status:
11+
readyReplicas: 1
12+
replicas: 1
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: StatefulSet
4+
metadata:
5+
name: test-nifi
6+
labels:
7+
app: test-nifi
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: test-nifi
13+
template:
14+
metadata:
15+
labels:
16+
app: test-nifi
17+
spec:
18+
serviceAccountName: test-nifi-sa
19+
securityContext:
20+
fsGroup: 1000
21+
containers:
22+
- name: test-nifi
23+
image: oci.stackable.tech/sdp/testing-tools/nifi:0.3.0-stackable0.0.0-dev
24+
command: ["sleep", "infinity"]
25+
resources:
26+
requests:
27+
memory: "128Mi"
28+
cpu: "100m"
29+
limits:
30+
memory: "128Mi"
31+
cpu: "400m"
32+
volumeMounts:
33+
- name: tls
34+
mountPath: /stackable/tls
35+
volumes:
36+
- name: tls
37+
ephemeral:
38+
volumeClaimTemplate:
39+
metadata:
40+
annotations:
41+
secrets.stackable.tech/class: tls
42+
secrets.stackable.tech/scope: pod
43+
spec:
44+
storageClassName: secrets.stackable.tech
45+
accessModes:
46+
- ReadWriteOnce
47+
resources:
48+
requests:
49+
storage: "1"
50+
---
51+
apiVersion: v1
52+
kind: ServiceAccount
53+
metadata:
54+
name: test-nifi-sa
55+
---
56+
apiVersion: rbac.authorization.k8s.io/v1
57+
kind: Role
58+
metadata:
59+
name: test-nifi-pod-manager
60+
rules:
61+
- apiGroups: [""]
62+
resources: ["pods"]
63+
verbs: ["get", "list", "delete"]
64+
- apiGroups: [""]
65+
resources: ["pods/exec"]
66+
verbs: ["create"]
67+
- apiGroups: [""]
68+
resources: ["pods/log"]
69+
verbs: ["get"]
70+
- apiGroups: [""]
71+
resources: ["configmaps"]
72+
verbs: ["get"]
73+
---
74+
apiVersion: rbac.authorization.k8s.io/v1
75+
kind: RoleBinding
76+
metadata:
77+
name: test-nifi-pod-manager
78+
subjects:
79+
- kind: ServiceAccount
80+
name: test-nifi-sa
81+
roleRef:
82+
kind: Role
83+
name: test-nifi-pod-manager
84+
apiGroup: rbac.authorization.k8s.io
85+
{% if test_scenario['values']['openshift'] == 'true' %}
86+
---
87+
kind: Role
88+
apiVersion: rbac.authorization.k8s.io/v1
89+
metadata:
90+
name: use-integration-tests-scc
91+
rules:
92+
- apiGroups: ["security.openshift.io"]
93+
resources: ["securitycontextconstraints"]
94+
resourceNames: ["privileged"]
95+
verbs: ["use"]
96+
---
97+
kind: RoleBinding
98+
apiVersion: rbac.authorization.k8s.io/v1
99+
metadata:
100+
name: use-integration-tests-scc
101+
subjects:
102+
- kind: ServiceAccount
103+
name: test-nifi-sa
104+
roleRef:
105+
kind: Role
106+
name: use-integration-tests-scc
107+
apiGroup: rbac.authorization.k8s.io
108+
{% 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+
timeout: 300
5+
commands:
6+
- script: >-
7+
kubectl exec -n $NAMESPACE test-nifi-0 --
8+
python /tmp/test_cluster_healthy.py
9+
-u admin -p admin
10+
-n $NAMESPACE -c 2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestStep
4+
commands:
5+
- script: kubectl cp -n $NAMESPACE ./test_cluster_healthy.py test-nifi-0:/tmp
6+
- script: kubectl cp -n $NAMESPACE ./test_trigger_reconnect.py test-nifi-0:/tmp
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+
timeout: 900
5+
commands:
6+
- script: >-
7+
kubectl exec -n $NAMESPACE test-nifi-0 --
8+
python /tmp/test_trigger_reconnect.py
9+
-u admin -p admin
10+
-n $NAMESPACE -c 2
11+
--stable-seconds 30
12+
--timeout-seconds 180

0 commit comments

Comments
 (0)