Skip to content

Commit 19e1a60

Browse files
committed
Add check that initcontainer is attached by operator
1 parent 259a31a commit 19e1a60

File tree

7 files changed

+8
-0
lines changed

7 files changed

+8
-0
lines changed

tests/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ test: build-initcontainer build-testapp check-language-arg
7676
helm install test-deployment ${REPO_ROOT}/tests/${INITCONTAINER_LANGUAGE}/chart/
7777
sleep 3
7878
kubectl wait --for=condition=Ready -n default --all pods
79+
# If jq is installed, check for the initcontainer to be visible on the pod spec
80+
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)
7981
minikube service test-app-${INITCONTAINER_LANGUAGE}-service -n default
8082

8183
# View test app container logs

tests/dotnet/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-dotnet ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
77
- sleep 5
88
- kubectl wait --for=condition=Ready -n default --all pods
9+
- 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)
910
- sleep 15 # give the agent time to connect
1011
- curl --fail-with-body $(minikube service test-app-dotnet-service --url -n default)/WeatherForecast
1112
tests:

tests/java/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-java ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
77
- sleep 120
88
- kubectl wait --for=condition=Ready -n default --all pods
9+
- 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)
910
- curl --fail-with-body $(minikube service test-app-java-service --url -n default)
1011
tests:
1112
nrqls:

tests/nodejs/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-nodejs ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
77
- sleep 5
88
- kubectl wait --for=condition=Ready -n default --all pods
9+
- 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)
910
- curl --fail-with-body $(minikube service test-app-nodejs-service --url -n default)
1011
tests:
1112
nrqls:

tests/php/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-php ./chart/ --set=scenarioTag="${SCENARIO_TAG}" ${TEST_APP_HELM_CHART_ARGS} -n default
77
- sleep 5
88
- kubectl wait --for=condition=Ready -n default --all pods --timeout=2m
9+
- 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)
910
- curl --fail-with-body $(minikube service test-app-php-service --url -n default)
1011
- sleep 5
1112
- curl --fail-with-body $(minikube service test-app-php-service --url -n default)

tests/python/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-python ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
77
- sleep 5
88
- kubectl wait --for=condition=Ready -n default --all pods --timeout=2m
9+
- 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)
910
- curl --fail-with-body $(minikube service test-app-python-service --url -n default)
1011
tests:
1112
nrqls:

tests/ruby/test-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scenarios:
66
- helm install test-ruby ./chart/ --set=scenarioTag="${SCENARIO_TAG}" -n default
77
- sleep 5
88
- kubectl wait --for=condition=Ready -n default --all pods
9+
- 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)
910
- curl --fail-with-body $(minikube service test-app-ruby-service --url -n default)/
1011
tests:
1112
nrqls:

0 commit comments

Comments
 (0)