forked from Dynatrace/dynatrace-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add k8s enrichment and prometheus e2e tests (Dynatrace#171)
* WIP * WIP * wip * Refactor e2e workflow * Fix kind versions * Fix image * Fix kubeconfig * Add docs * Only test traces * Re-add test label * Add prometheus scrape test * Refine message * Add prometheus test to workflow * go mod tidy * go mod tidy * PR suggestions * Assert node exporter metrics * Add comment
- Loading branch information
1 parent
122b666
commit 9232724
Showing
31 changed files
with
1,842 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
name: E2E-Test | ||
on: workflow_dispatch | ||
|
||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
run-e2e-test: | ||
name: Run E2E Tests | ||
|
||
docker-build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
|
@@ -19,7 +22,7 @@ jobs: | |
go-version: "~1.21.3" | ||
check-latest: true | ||
cache-dependency-path: internal/tools/go.sum | ||
|
||
- name: Cache tools | ||
uses: actions/cache@v4 | ||
with: | ||
|
@@ -39,51 +42,89 @@ jobs: | |
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
|
||
- name: Build and push to local registry | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./bin | ||
file: Dockerfile | ||
push: false | ||
load: true | ||
tags: localhost:5000/collector:e2e-test | ||
tags: dynatrace-otel-collector:e2e-test | ||
|
||
- name: Install Chainsaw | ||
uses: kyverno/[email protected] | ||
- name: export image to tar | ||
run: | | ||
docker save dynatrace-otel-collector:e2e-test > /tmp/dynatrace-otel-collector.tar | ||
- name: Create Kind Cluster | ||
uses: ./.github/actions/create-cluster | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
kind-version: "v0.18.0" | ||
k8s-version: "v1.27.3" | ||
runtime_tag: "latest" | ||
cluster-name: "test-cluster" | ||
|
||
- name: Load Image into Kind | ||
shell: bash | ||
name: dynatrace-otel-collector | ||
path: /tmp/dynatrace-otel-collector.tar | ||
|
||
k8s-e2e-test-matrix: | ||
env: | ||
KUBECONFIG: /tmp/kube-config-collector-e2e-testing | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
usecase: | ||
- testbed/integration/k8senrichment | ||
- testbed/integration/prometheus | ||
runs-on: ubuntu-latest | ||
needs: docker-build | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "~1.21.3" | ||
check-latest: true | ||
cache-dependency-path: internal/tools/go.sum | ||
|
||
- name: Cache tools | ||
uses: actions/cache@v4 | ||
with: | ||
path: .tools | ||
key: ci-tools-${{ runner.os }}-${{ hashFiles('internal/tools/go.sum') }} | ||
|
||
- name: Touch tools | ||
run: | | ||
echo "Loading image into Kind" | ||
kind load docker-image localhost:5000/collector:e2e-test --name test-cluster | ||
mkdir -p .tools | ||
touch .tools/* | ||
- name: Setup Prometheus Node Exporter | ||
uses: ./.github/actions/deploy-prometheus | ||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
with: | ||
node_image: "kindest/node:v1.27.11" | ||
kubectl_version: "v1.27.11" | ||
cluster_name: kind | ||
|
||
- name: Deploy Collector | ||
uses: ./.github/actions/deploy-collector | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
collector-version: "latest" | ||
DT_API_ENDPOINT: ${{ secrets.DT_API_ENDPOINT }} | ||
DT_API_TOKEN: ${{ secrets.DT_API_TOKEN }} | ||
|
||
- name: Run E2E Tests | ||
env: | ||
DT_API_ENDPOINT: ${{ secrets.DT_API_ENDPOINT }} | ||
DT_API_TOKEN: ${{ secrets.DT_API_TOKEN }} | ||
name: dynatrace-otel-collector | ||
path: /tmp | ||
|
||
- name: Load Docker image | ||
run: | | ||
docker load --input /tmp/dynatrace-otel-collector.tar | ||
- name: Kind load image | ||
run: | | ||
kind load docker-image dynatrace-otel-collector:e2e-test --name kind | ||
- name: Load Image into Kind | ||
shell: bash | ||
run: | | ||
kind load docker-image dynatrace-otel-collector:e2e-test --name kind | ||
- name: Run e2e tests | ||
run: | | ||
echo "Running E2E Tests" | ||
chainsaw version | ||
chainsaw test --test-dir ./testbed/chainsaw/ --config ./.chainsaw.yaml | ||
cd ${{ matrix.usecase }} | ||
go test -v --tags=e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.