-
Notifications
You must be signed in to change notification settings - Fork 33
79 lines (65 loc) · 2.21 KB
/
logzio-logs-collector-test.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
name: Test `logzio-logs-collector` chart
on:
pull_request:
branches:
- master
paths:
- 'charts/logzio-logs-collector/Chart.yaml'
- 'charts/logzio-logs-collector/templates/**'
- 'charts/logzio-logs-collector/values.yaml'
jobs:
test-helm-chart:
name: Test Helm Chart on Kind
runs-on: ubuntu-latest
steps:
- name: Generate random id
id: random_id
run: echo "::set-output name=rand::$(echo $RANDOM)"
- name: Set ENV_ID
run: echo "ENV_ID=logs-test-run-${{ steps.random_id.outputs.rand }}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Set up Helm
uses: azure/[email protected]
- name: Set up kubectl
uses: azure/setup-kubectl@v4
- name: Install Kind
run: |
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.11.1/kind-Linux-amd64"
chmod +x ./kind
mv ./kind /usr/local/bin/kind
- name: Create Kind cluster
run: |
kind create cluster --name kind-${{ github.run_id }}
kubectl cluster-info
- name: Deploy Helm Chart
run: |
cd charts/logzio-logs-collector
helm upgrade --install \
--set secrets.env_id=${{ env.ENV_ID }} \
--set secrets.logzioLogsToken=${{ secrets.LOGZIO_LOGS_TOKEN }} \
--set secrets.logzioRegion=us \
--set secrets.logType=${{ env.ENV_ID }} \
logzio-logs-collector .
- name: Run log generator
run: |
kubectl apply -f tests/resources/logsgen.yaml
kubectl rollout status deployment/log-generator --timeout=300s
- name: sleep
run: sleep 120
- name: Run Go Tests
env:
LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }}
run: |
go get go.uber.org/zap
go test -v ./tests/logs_e2e_test.go ./tests/common.go
- name: Cleanup Environment
run: |
helm uninstall logzio-logs-collector
- name: Delete Kind cluster
if: always()
run: kind delete cluster --name kind-${{ github.run_id }}