This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
146 lines (143 loc) · 6.06 KB
/
test-persistence.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Test-Persistence
on:
push:
pull_request:
jobs:
test-persistence:
name: Test NiFi Helm Chart Persistence
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.28.0'
kubernetes version: 'v1.25.4'
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get install -y jq
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add dysnix https://dysnix.github.io/charts/
helm repo update
helm dep up
- name: Install Nifi
run: helm install nifi . -f tests/02-persistence-enabled-values.yaml
- name: Check deployment status
run: |
kubectl rollout status --watch statefulset/nifi --timeout=5m
- name: Get First .processGroupFlow.uri
id: first-pgfuri
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if NIFI_ACCESS_TOKEN=$(kubectl exec nifi-0 -c server -- curl -d username=username -d password=changemechangeme -sk https://localhost:8443/nifi-api/access/token)
then
PGFURI=$(kubectl exec nifi-0 -c server -- curl -H "Authorization: Bearer $NIFI_ACCESS_TOKEN" -sk https://localhost:8443/nifi-api/flow/process-groups/root | jq --raw-output .processGroupFlow.uri)
echo "::set-output name=PGFURI::$PGFURI"
exit 0
fi
sleep 30
done
echo NiFi did not provide an access token for 300 seconds!
exit 1
- name: Delete chart
run: |
helm delete nifi
kubectl wait --for=delete pod/nifi-0 --timeout=120s
- name: Install NiFi
run: helm install nifi . -f tests/02-persistence-enabled-values.yaml
- name: Check deployment status
run: |
kubectl rollout status --watch statefulset/nifi --timeout=5m
- name: Get Second .processGroupFlow.uri
id: second-pgfuri
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if NIFI_ACCESS_TOKEN=$(kubectl exec nifi-0 -c server -- curl -d username=username -d password=changemechangeme -sk https://localhost:8443/nifi-api/access/token)
then
PGFURI=$(kubectl exec nifi-0 -c server -- curl -H "Authorization: Bearer $NIFI_ACCESS_TOKEN" -sk https://localhost:8443/nifi-api/flow/process-groups/root | jq --raw-output .processGroupFlow.uri)
echo "::set-output name=PGFURI::$PGFURI"
exit 0
fi
sleep 30
done
echo NiFi did not provide an access token for 300 seconds!
exit 1
- name: Compare 2 x root processGroupFlow .processGroupFlow.uri
run: |
echo Should be the same if persistence is enabled
test ${{ steps.first-pgfuri.outputs.PGFURI }} = ${{ steps.second-pgfuri.outputs.PGFURI }}
test-non-persistence:
name: Test NiFi Helm Chart Non-Persistence
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.28.0'
kubernetes version: 'v1.25.4'
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get install -y jq
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add dysnix https://dysnix.github.io/charts/
helm repo update
helm dep up
- name: Install Nifi
run: helm install nifi . -f tests/02-persistence-disabled-values.yaml
- name: Check deployment status
run: |
kubectl rollout status --watch statefulset/nifi --timeout=5m
- name: Get First .processGroupFlow.uri
id: first-pgfuri
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if NIFI_ACCESS_TOKEN=$(kubectl exec nifi-0 -c server -- curl -d username=username -d password=changemechangeme -sk https://localhost:8443/nifi-api/access/token)
then
PGFURI=$(kubectl exec nifi-0 -c server -- curl -H "Authorization: Bearer $NIFI_ACCESS_TOKEN" -sk https://localhost:8443/nifi-api/flow/process-groups/root | jq --raw-output .processGroupFlow.uri)
echo "::set-output name=PGFURI::$PGFURI"
exit 0
fi
sleep 30
done
echo NiFi did not provide an access token for 300 seconds!
exit 1
- name: Delete chart
run: |
helm delete nifi
kubectl wait --for=delete pod/nifi-0 --timeout=120s
- name: Install NiFi
run: helm install nifi . -f tests/02-persistence-disabled-values.yaml
- name: Check deployment status
run: |
kubectl rollout status --watch statefulset/nifi --timeout=5m
- name: Get Second .processGroupFlow.uri
id: second-pgfuri
run: |
for n in [ 0 1 2 3 4 5 6 7 8 9 ]
do
if NIFI_ACCESS_TOKEN=$(kubectl exec nifi-0 -c server -- curl -d username=username -d password=changemechangeme -sk https://localhost:8443/nifi-api/access/token)
then
PGFURI=$(kubectl exec nifi-0 -c server -- curl -H "Authorization: Bearer $NIFI_ACCESS_TOKEN" -sk https://localhost:8443/nifi-api/flow/process-groups/root | jq --raw-output .processGroupFlow.uri)
echo "::set-output name=PGFURI::$PGFURI"
exit 0
fi
sleep 30
done
echo NiFi did not provide an access token for 300 seconds!
exit 1
- name: Compare 2 x root processGroupFlow .processGroupFlow.uri
run: |
echo Should not be the same if persistence is not enabled
test ${{ steps.first-pgfuri.outputs.PGFURI }} != ${{ steps.second-pgfuri.outputs.PGFURI }}