-
Notifications
You must be signed in to change notification settings - Fork 23
130 lines (107 loc) · 3.69 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
name: Tests
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: Run the build with upterm debugging enabled
(https://github.com/lhotari/action-upterm/)
required: false
default: false
push:
tags:
- v*
branches:
- main
paths:
- "**/*.go"
pull_request:
concurrency:
group: e2e-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
KUBERNETES_VERSION: 1.29.2
VCLUSTER_VERSION: 0.19
VCLUSTER_NAME: vcluster
VCLUSTER_NAMESPACE: vcluster
jobs:
unit-test:
runs-on: ubuntu-latest
name: Unit Test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Run Unit Tests
run: go test ./test/controllerstest
e2e:
runs-on: ubuntu-latest
name: E2E Test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install Prerequisites
run: |
# Install clusterctl
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.3/clusterctl-linux-amd64 -o clusterctl
chmod +x clusterctl
sudo mv clusterctl /usr/local/bin/
#Install Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# Install envsubst
GOBIN="$(pwd)/bin" go install -tags tools github.com/drone/envsubst/v2/cmd/[email protected]
# Install kubectl
curl -LO "https://dl.k8s.io/release/v${{ env.KUBERNETES_VERSION }}/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
# Install DevSpace
curl -fsSL -o /tmp/devspace https://github.com/devspace-cloud/devspace/releases/latest/download/devspace-linux-amd64
chmod +x /tmp/devspace
sudo mv /tmp/devspace /usr/local/bin/devspace
- name: Create and Start Kind Cluster
run: |
kind create cluster
echo "=== cluster-info ==="
kubectl cluster-info --context kind-kind
- name: Init
run: |
clusterctl init
echo "=== config get-contexts ==="
kubectl config get-contexts
- name: DevSpace Deploy
run: |
devspace deploy -p deploy
- name: Display Kubernetes Env
run: |
echo "=== Kubectl version ==="
kubectl version
echo "=== Kubectl config ==="
kubectl config view
echo "=== Kubectl get pods ==="
kubectl get pods -A
echo "=== Kubectl get namespaces ==="
kubectl get namespaces
echo "=== Test get crd ==="
kubectl get crd
- name: Create Vcluster Custom Resource
run: |
export CLUSTER_NAME=${{ env.VCLUSTER_NAME }}
export CLUSTER_NAMESPACE=${{ env.VCLUSTER_NAMESPACE }}
export CHART_VERSION=${{ env.VCLUSTER_VERSION }}
export HELM_VALUES=$(cat ./test/e2e/k3s-values.yaml | sed -z 's/\n/\\n/g')
kubectl create namespace ${CLUSTER_NAMESPACE}
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
- name: Validate Resource Ready
run: |
kubectl wait --for=condition=ready vcluster -n ${{ env.VCLUSTER_NAMESPACE }} ${{ env.VCLUSTER_NAME }} --timeout=100s
- name: Run E2E Tests
run: go test -mod=vendor ./test/e2e -v