forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] [processor/k8sattributes] Rework Kubernetes e2e tests (open-t…
…elemetry#20427) Update Kubernetes end-to-end tests applying the following enhancements: - Make it possible to run tests locally. Keep only kind cluster and pre-built image as the test prerequisites. - Remove dependency on the helm chart, install only required k8s objects from pre-defined manifests. - Remove the OTLP json files as a medium and send OTLP metrics/traces/logs directly to the consumers spun up in the test. - Remove statically set `k8s.containet.restart_count` attribute to reduce flakiness. Let the processor use the latest container instead. - Combine separate tests for traces, metrics and logs into one to reduce execution time. - Make the test faster by waiting for predefined number of metrics/traces/logs instead of static sleep time.
- Loading branch information
Showing
23 changed files
with
892 additions
and
642 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 |
---|---|---|
|
@@ -10,7 +10,9 @@ on: | |
|
||
jobs: | ||
kubernetes-test: | ||
strategy: | ||
env: | ||
KUBECONFIG: /tmp/kube-config-otelcol-e2e-testing | ||
strategy: | ||
matrix: | ||
k8s-version: ["v1.26.0", "v1.25.3", "v1.24.7", "v1.23.13"] | ||
runs-on: ubuntu-latest | ||
|
@@ -30,78 +32,19 @@ jobs: | |
- 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 | ||
cluster_name: kind | ||
- 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 | ||
kind load docker-image otelcontribcol:latest --name kind | ||
- name: run e2e tests | ||
run: | | ||
cd processor/k8sattributesprocessor | ||
go test -v --tags=e2e |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.