Skip to content

Commit

Permalink
Add check that initcontainer is attached by operator
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed Jan 23, 2025
1 parent 259a31a commit 19e1a60
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ test: build-initcontainer build-testapp check-language-arg
helm install test-deployment ${REPO_ROOT}/tests/${INITCONTAINER_LANGUAGE}/chart/
sleep 3
kubectl wait --for=condition=Ready -n default --all pods
# If jq is installed, check for the initcontainer to be visible on the pod spec
command -v jq && kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $$(echo "Operator failed to attach initcontainer." >&2; exit 1)
minikube service test-app-${INITCONTAINER_LANGUAGE}-service -n default

# View test app container logs
Expand Down
1 change: 1 addition & 0 deletions tests/dotnet/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-dotnet ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
- sleep 5
- kubectl wait --for=condition=Ready -n default --all pods
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- sleep 15 # give the agent time to connect
- curl --fail-with-body $(minikube service test-app-dotnet-service --url -n default)/WeatherForecast
tests:
Expand Down
1 change: 1 addition & 0 deletions tests/java/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-java ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
- sleep 120
- kubectl wait --for=condition=Ready -n default --all pods
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- curl --fail-with-body $(minikube service test-app-java-service --url -n default)
tests:
nrqls:
Expand Down
1 change: 1 addition & 0 deletions tests/nodejs/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-nodejs ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
- sleep 5
- kubectl wait --for=condition=Ready -n default --all pods
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- curl --fail-with-body $(minikube service test-app-nodejs-service --url -n default)
tests:
nrqls:
Expand Down
1 change: 1 addition & 0 deletions tests/php/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-php ./chart/ --set=scenarioTag="${SCENARIO_TAG}" ${TEST_APP_HELM_CHART_ARGS} -n default
- sleep 5
- kubectl wait --for=condition=Ready -n default --all pods --timeout=2m
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- curl --fail-with-body $(minikube service test-app-php-service --url -n default)
- sleep 5
- curl --fail-with-body $(minikube service test-app-php-service --url -n default)
Expand Down
1 change: 1 addition & 0 deletions tests/python/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-python ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
- sleep 5
- kubectl wait --for=condition=Ready -n default --all pods --timeout=2m
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- curl --fail-with-body $(minikube service test-app-python-service --url -n default)
tests:
nrqls:
Expand Down
1 change: 1 addition & 0 deletions tests/ruby/test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scenarios:
- helm install test-ruby ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
- sleep 5
- kubectl wait --for=condition=Ready -n default --all pods
- kubectl get pods --output json | jq '.items[].spec.initContainers | select( . != null )[].name' | grep -q "newrelic-instrumentation-" || $(echo "Operator failed to attach initcontainer." >&2; exit 1)
- curl --fail-with-body $(minikube service test-app-ruby-service --url -n default)/
tests:
nrqls:
Expand Down

0 comments on commit 19e1a60

Please sign in to comment.