forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 21
107 lines (105 loc) · 5.15 KB
/
e2e-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
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
name: e2e-tests
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
jobs:
kubernetes-test:
strategy:
matrix:
k8s-version: ["v1.26.0", "v1.25.3", "v1.24.7", "v1.23.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Cache Go
id: go-cache
uses: actions/cache@v3
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Build Collector
run: make otelcontribcol
- name: Build Docker Image
run: |
make docker-otelcontribcol
docker tag otelcontribcol:latest otel/opentelemetry-collector-contrib-dev:$GITHUB_SHA
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.9.0
- name: Set up chart-testing
uses: helm/[email protected]
- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.k8s-version }}
kubectl_version: ${{ matrix.k8s-version }}
- name: Check kind
run: |
kubectl cluster-info --context kind-chart-testing
kubectl get node
docker ps -a --filter label=io.x-k8s.kind.cluster=chart-testing
- name: Kind load image
run: |
kind load docker-image otel/opentelemetry-collector-contrib-dev:$GITHUB_SHA --name chart-testing
- name: Add Dependencies
shell: bash
run: |
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
- uses: actions/checkout@v3
with:
repository: 'open-telemetry/opentelemetry-helm-charts'
path: opentelemetry-helm-charts
- name: Helm install collector
run: helm install test --set image.tag=$GITHUB_SHA -f .github/workflows/e2e/k8s/collector-helm-values.yml opentelemetry-helm-charts/charts/opentelemetry-collector
- name: check collector status
run: |
kubectl wait --for=condition=Ready --timeout=60s pod/test-opentelemetry-collector-0
- name: start telemetrygen job for trace, metric, log
run: |
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f -
- name: check telemetrygen job status
run: |
kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-traces-job
kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-metrics-job
kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-logs-job
- name: start telemetrygen statefulset for trace, metric, log
run: |
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f -
- name: start telemetrygen deployment for trace, metric, log
run: |
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f -
- name: start telemetrygen daemonset for trace, metric, log
run: |
sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f -
sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f -
- name: wait telemetrygen statefulset/deployment/daemonset to generate trace and metric, log
run: |
sleep 30
- name: copy telemetry trace, metric, log data output
run: |
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/trace.json processor/k8sattributesprocessor/testdata/trace.json
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/metric.json processor/k8sattributesprocessor/testdata/metric.json
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/log.json processor/k8sattributesprocessor/testdata/log.json
- name: run e2e test to check output
run: |
cd processor/k8sattributesprocessor
go test -v --tags=e2e