1
+ # End to end integration test which deploys the Tomcat operator to a Kubernetes
2
+ # (Kind) cluster and creates custom resources to verify the operator's functionality
1
3
name : Tomcat integration test
2
4
on :
3
5
push:
@@ -74,125 +76,4 @@ jobs:
74
76
if : ${{ failure() }}
75
77
run : |
76
78
kubectl get all -n tomcat-test -o yaml
77
- kubectl logs curl
78
-
79
- tomcat_local_apply_setup_test :
80
- runs-on : ubuntu-latest
81
- env :
82
- KIND_CL_NAME : tomcat-local-apply
83
- steps :
84
- - name : Checkout
85
- uses : actions/checkout@v2
86
-
87
- - name : clean resident local docker
88
- if : ${{ env.ACT }}
89
- continue-on-error : true
90
- run : |
91
- for DIMG in "$KIND_CL_NAME-control-plane "; do
92
- docker stop $DIMG ; docker rm $DIMG ;
93
- done ;
94
- sleep 1
95
-
96
- - name : Create Kubernetes KinD Cluster
97
- uses : container-tools/kind-action@v1.5.0
98
- with :
99
- cluster_name : tomcat-local-apply
100
- registry : false
101
-
102
- # for DIMG in "tomcat-local-apply-control-plane kind-registry tomcat_local_apply_setup_test "; do docker stop $DIMG ; docker rm $DIMG ; done ; sleep 1
103
-
104
- - name : Set up Java and Maven
105
- uses : actions/setup-java@v2
106
- with :
107
- # java-version: ${{ matrix.java }}
108
- java-version : 15
109
- distribution : adopt-hotspot
110
-
111
- - name : cache
112
- uses : actions/cache@v2
113
- if : ${{ !env.ACT }}
114
- with :
115
- path : ~/.m2/repository
116
- key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
117
- restore-keys : |
118
- ${{ runner.os }}-maven-
119
-
120
- - name : Set up Maven for local ACT
121
- uses : stCarolas/setup-maven@v4
122
- if : ${{ env.ACT }}
123
- with :
124
- maven-version : 3.8.1
125
-
126
- - name : build jib
127
- run : |
128
- mvn -B package jib:dockerBuild jib:buildTar -Djib-maven-image=tomcat-operator --file tomcat/pom.xml -DskipTests
129
- kind load image-archive tomcat/target/jib-image.tar --name=${{ env.KIND_CL_NAME }}
130
-
131
- - name : Apply CRDs
132
- run : kubectl apply -f tomcat/k8s/crd.yaml
133
-
134
- - name : install tomcat operator
135
- run : |
136
- kubectl apply -f tomcat/k8s/operator.yaml
137
-
138
- - name : create ns tomcatoperator-sample
139
- run : kubectl create ns tomcatoperator-sample
140
-
141
- - name : debug local kind
142
- if : ${{ env.ACT }}
143
- run : |
144
- kubectl get pods -n tomcat-operator -l app=tomcat-operator -o yaml | tee -a debug.log
145
-
146
- - name : wait for operators ready
147
- run : |
148
- LOOP=0 &&\
149
- while [[ $(kubectl get pods -n tomcat-operator -l app=tomcat-operator -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do \
150
- echo "waiting for pod" &&\
151
- kubectl logs -n tomcat-operator -l app=tomcat-operator &&\
152
- (( LOOP++ )) &&\
153
- if [[ $LOOP -gt 10 ]]; then exit 1; fi &&\
154
- echo "loop number $LOOP" &&\
155
- sleep 5; \
156
- done
157
-
158
- - name : install sample operators
159
- run : |
160
- for sample in $(ls tomcat/k8s/*sample*); do
161
- kubectl -n tomcatoperator-sample apply -f $sample;
162
- done
163
-
164
- - name : check pod correctly started
165
- run : |
166
- LOOP=0 &&\
167
- while [[ $(kubectl get pods -n tomcatoperator-sample -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True True True True True True" ]]; do \
168
- echo "waiting for pod" &&\
169
- kubectl logs -n tomcat-operator -l app=tomcat-operator &&\
170
- kubectl get pods -n tomcatoperator-sample &&\
171
- (( LOOP++ )) &&\
172
- if [[ $LOOP -gt 10 ]]; then exit 1; fi &&\
173
- echo "loop number $LOOP" &&\
174
- sleep 10; \
175
- done
176
- #Waiting 5 seconds for Tomcat to unpack the downloaded war
177
- sleep 5;
178
-
179
- - name : Get webapps
180
- run : |
181
- kubectl get tomcats,webapps -A -o yaml | tee -a debug
182
- kubectl -n tomcatoperator-sample -c tomcat logs -l app=test-tomcat1 | grep startup
183
-
184
- - name : check code
185
- run : |
186
- kubectl -n tomcatoperator-sample run sample1 --labels=app=curl --image=curlimages/curl:7.78.0 --restart=Never --timeout=30s --command -- curl -s -v http://test-tomcat1/mysample/;
187
- kubectl -n tomcatoperator-sample run sample2 --labels=app=curl --image=curlimages/curl:7.78.0 --restart=Never --timeout=30s --command -- curl -s -v http://test-tomcat2/othercontext/;
188
- LOOP=0 &&\
189
- while [[ $(kubectl get pods -n tomcatoperator-sample -l app=curl -o 'jsonpath={..status.phase}') != "Succeeded Succeeded" ]]; do \
190
- echo "waiting for pod" &&\
191
- kubectl logs -n tomcatoperator-sample -l app=curl &&\
192
- (( LOOP++ )) &&\
193
- if [[ $LOOP -gt 5 ]]; then exit 1; fi &&\
194
- echo "loop number $LOOP" &&\
195
- sleep 5; \
196
- done
197
- if [[ $(kubectl logs -n tomcatoperator-sample sample1 --tail=500 | grep tomcat.gif | wc -l) -ne 1 ]]; then exit 1; fi
198
- if [[ $(kubectl logs -n tomcatoperator-sample sample2 --tail=500 | grep dog.jpeg | wc -l) -ne 1 ]]; then exit 1; fi
79
+ kubectl logs curl
0 commit comments