-
Notifications
You must be signed in to change notification settings - Fork 217
79 lines (69 loc) · 2.55 KB
/
end-to-end-tests.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
# End to end integration test which deploys the Tomcat operator to a Kubernetes
# (Kind) cluster and creates custom resources to verify the operator's functionality
name: TomcatOperator End to End test
on:
push:
branches:
- "*"
jobs:
tomcat_e2e_test:
runs-on: ubuntu-latest
env:
KIND_CL_NAME: e2e-test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: clean resident local docker
if: ${{ env.ACT }}
continue-on-error: true
run: |
for DIMG in "$KIND_CL_NAME-control-plane "; do
docker stop $DIMG ; docker rm $DIMG ;
done ;
sleep 1
- name: Create Kubernetes KinD Cluster
uses: container-tools/[email protected]
with:
cluster_name: e2e-test
registry: false
- name: Apply CRDs
run: kubectl apply -f k8s/crd.yaml
working-directory: sample-operators/tomcat-operator
- name: Set up Java and Maven
uses: actions/setup-java@v2
with:
java-version: 11
distribution: adopt-hotspot
cache: 'maven'
- name: Build SDK
run: mvn install -DskipTests
- name: build jib
working-directory: sample-operators/tomcat-operator
run: |
mvn --version
mvn -B package jib:dockerBuild jib:buildTar -Djib-maven-image=tomcat-operator -DskipTests
kind load image-archive target/jib-image.tar --name=${{ env.KIND_CL_NAME }}
- name: Apply CRDs
working-directory: sample-operators/tomcat-operator
run: kubectl apply -f k8s/crd.yaml
- name: Deploy Tomcat Operator
working-directory: sample-operators/tomcat-operator
run: |
kubectl apply -f k8s/operator.yaml
- name: Run E2E Tests
working-directory: sample-operators/tomcat-operator
run: mvn -B test -P end-to-end-tests
- name: Dump state
if: ${{ failure() }}
run: |
set +e
echo "All namespaces"
kubectl get ns
echo "All objects in tomcat-operator"
kubectl get all -n tomcat-operator -o yaml
echo "Output of tomcat-operator pod"
kubectl logs -l app=tomcat-operator -n tomcat-operator
echo "All objects in tomcat-test"
kubectl get deployment,pod,tomcat,webapp -n tomcat-test -o yaml
echo "Output of curl command"
kubectl logs curl -n tomcat-test