diff --git a/tests/Makefile b/tests/Makefile index ce85885..fe4bd80 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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 yq is installed, check for the initcontainer to be visible on the pod spec + command -v yq && kubectl get pods --output yaml | yq '.items[].spec.initContainers[].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 diff --git a/tests/dotnet/test-specs.yml b/tests/dotnet/test-specs.yml index b87f46f..8690650 100644 --- a/tests/dotnet/test-specs.yml +++ b/tests/dotnet/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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: diff --git a/tests/java/test-specs.yml b/tests/java/test-specs.yml index 0911d80..8a985e7 100644 --- a/tests/java/test-specs.yml +++ b/tests/java/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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: diff --git a/tests/nodejs/test-specs.yml b/tests/nodejs/test-specs.yml index 146cf41..76edbc8 100644 --- a/tests/nodejs/test-specs.yml +++ b/tests/nodejs/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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: diff --git a/tests/php/test-specs.yml b/tests/php/test-specs.yml index 697dcd4..b5f9a84 100644 --- a/tests/php/test-specs.yml +++ b/tests/php/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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) diff --git a/tests/python/test-specs.yml b/tests/python/test-specs.yml index 25720cc..fd5c522 100644 --- a/tests/python/test-specs.yml +++ b/tests/python/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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: diff --git a/tests/ruby/test-specs.yml b/tests/ruby/test-specs.yml index d373e4a..acd6d68 100644 --- a/tests/ruby/test-specs.yml +++ b/tests/ruby/test-specs.yml @@ -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 yaml | yq '.items[].spec.initContainers[].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: