-
Notifications
You must be signed in to change notification settings - Fork 11
160 lines (156 loc) · 5.01 KB
/
e2e.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: E2E
on:
pull_request:
branches:
- main
- release-*
push:
branches:
- main
- release-*
env:
GO_VERSION: '1.19'
KIND_VERSION: 'v0.14.0'
KIND_IMAGE: 'kindest/node:v1.22.2'
KIND_CLUSTER_NAME: 'e2e-test'
jobs:
CollaSet:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Update Go Modules
run: |
go mod tidy
go mod download
- name: Setup Kind Cluster
uses: helm/[email protected]
with:
node_image: ${{ env.KIND_IMAGE }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
config: ./test/e2e/scripts/kind-conf.yaml
version: ${{ env.KIND_VERSION }}
- name: Build Image
run: |
mkdir -p /tmp/kind
make kind-kube-config
make docker-build
make sync-kind-image
- name: Install Operating
run: |
set -ex
kubectl cluster-info
make deploy
for ((i=1;i<10;i++));
do
set +e
PODS=$(kubectl get pod -n kusionstack-system | grep -c '1/1')
set -e
if [ "$PODS" -eq 1 ]; then
break
fi
sleep 3
done
set -e
PODS=$(kubectl get pod -n kusionstack-system | grep -c '1/1')
if [ "$PODS" -eq 1 ]; then
echo "Wait for Kusionstack-manager ready successfully"
else
echo "Timeout to wait for Kusionstack-manager ready"
fi
- name: Run e2e Tests
run: |
make ginkgo
set -e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 15m -v --focus='\[apps\] CollaSet' test/e2e
restartCount=$(kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers | awk '{print $4}')
if [ "${restartCount}" -eq "0" ];then
echo "Kusionstack-manager has not restarted"
else
kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers
echo "Kusionstack-manager has restarted, abort!!!"
kubectl get pod -n kusionstack-system --no-headers -l control-plane=controller-manager | awk '{print $1}' | xargs kubectl logs -p -n kusionstack-system
exit 1
fi
OperationJob:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Update Go Modules
run: |
go mod tidy
go mod download
- name: Setup Kind Cluster
uses: helm/[email protected]
with:
node_image: ${{ env.KIND_IMAGE }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
config: ./test/e2e/scripts/kind-conf.yaml
version: ${{ env.KIND_VERSION }}
- name: Setup Kube-config
run: |
mkdir -p /tmp/kind
make kind-kube-config
- name: Install Operating
run: |
set -ex
kubectl cluster-info
make docker-build
make sync-kind-image
make deploy
for ((i=1;i<10;i++));
do
set +e
PODS=$(kubectl get pod -n kusionstack-system | grep -c '1/1')
set -e
if [ "$PODS" -eq 1 ]; then
break
fi
sleep 3
done
set -e
PODS=$(kubectl get pod -n kusionstack-system | grep -c '1/1')
if [ "$PODS" -eq 1 ]; then
echo "Wait for Kusionstack-manager ready successfully"
else
echo "Timeout to wait for Kusionstack-manager ready"
fi
- name: Run e2e Tests
run: |
make ginkgo
set -e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 15m -v --focus='\[apps\] OperationJob' test/e2e
- name: Check Operating Manager
run: |
restartCount=$(kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers | awk '{print $4}')
if [ "${restartCount}" -eq "0" ];then
echo "Kusionstack-manager has not restarted"
else
kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers
echo "Kusionstack-manager has restarted, abort!!!"
kubectl get pod -n kusionstack-system --no-headers -l control-plane=controller-manager | awk '{print $1}' | xargs kubectl logs -p -n kusionstack-system
exit 1
fi