From cbe2d6832d89dc6a9a5affaf9c67f8377553af9b Mon Sep 17 00:00:00 2001 From: Tim Pansino Date: Tue, 11 Jun 2024 14:13:44 -0700 Subject: [PATCH] Fix PHP tests --- src/php/php-agent-download.sh | 18 ++++++++--------- tests/php/chart/{Chart.yml => Chart.yaml} | 0 .../{deployment.yml => deployment.yaml} | 20 ++++++++++--------- ...strumentation.yml => instrumentation.yaml} | 0 tests/php/chart/values.yaml | 1 + tests/php/chart/values.yml | 1 - 6 files changed, 21 insertions(+), 19 deletions(-) rename tests/php/chart/{Chart.yml => Chart.yaml} (100%) rename tests/php/chart/templates/{deployment.yml => deployment.yaml} (66%) rename tests/php/chart/templates/{instrumentation.yml => instrumentation.yaml} (100%) create mode 100644 tests/php/chart/values.yaml delete mode 100644 tests/php/chart/values.yml diff --git a/src/php/php-agent-download.sh b/src/php/php-agent-download.sh index 14c9b2c..6c9d920 100755 --- a/src/php/php-agent-download.sh +++ b/src/php/php-agent-download.sh @@ -1,27 +1,27 @@ -#!/bin/bash +#!/bin/sh libc=$1 version=$2 -if [ -z "$libc" ]; then - echo "'libc' argument not supplied. Defaulting to 'gnu'" - libc="gnu" -elif [[ ! $libc =~ ^(musl|gnu)$ ]]; then +if [[ -z "$libc" ]]; then + echo "'libc' argument not supplied. Defaulting to 'glibc'" + libc="glibc" +elif [[ "$libc" != "glibc" || "$libc" != "musl" ]]; then echo "error: invalid 'libc' argument provided. Exiting." exit 1 fi -if [ -z "$version" ]; then - latest=$(curl https://download.newrelic.com/php_agent/release/ | grep newrelic-php5 | cut -d '-' -f 3 | head -n 1) +if [[ -z "$version" ]]; then + latest=$(wget https://download.newrelic.com/php_agent/release/ -O - | grep newrelic-php5 | cut -d '-' -f 3 | head -n 1) url="https://download.newrelic.com/php_agent/release/newrelic-php5-${latest}-linux" else url="https://download.newrelic.com/php_agent/archive/${version}/newrelic-php5-${version}-linux" fi if [ "$libc" = 'musl' ]; then - url+="-musl.tar.gz" + url="${url}-musl.tar.gz" else - url+=".tar.gz" + url="${url}.tar.gz" fi # echo "url: $url" diff --git a/tests/php/chart/Chart.yml b/tests/php/chart/Chart.yaml similarity index 100% rename from tests/php/chart/Chart.yml rename to tests/php/chart/Chart.yaml diff --git a/tests/php/chart/templates/deployment.yml b/tests/php/chart/templates/deployment.yaml similarity index 66% rename from tests/php/chart/templates/deployment.yml rename to tests/php/chart/templates/deployment.yaml index a5ba4fa..33985de 100644 --- a/tests/php/chart/templates/deployment.yml +++ b/tests/php/chart/templates/deployment.yaml @@ -15,25 +15,27 @@ spec: annotations: instrumentation.newrelic.com/inject-php: "true" instrumentation.newrelic.com/php-exec-cmd: "apache2-foreground" - spec: - containers: - - name: test-app-php - image: e2e/test-app-php:e2e - imagePullPolicy: Never - ports: - - containerPort: 80 - env: + spec: + containers: + - name: test-app-php + image: e2e/test-app-php:e2e + imagePullPolicy: Never + ports: + - containerPort: 80 + env: - name: NEW_RELIC_APP_NAME value: k8s-e2e-test-app-php - name: NEW_RELIC_LABELS - value: 'testkey:{{ .Values.scenarioTag | default "NOTSET" }}' + value: "testKey:{{ .Values.scenarioTag | default "NOTSET" }}" --- apiVersion: v1 kind: Service metadata: name: test-app-php-service spec: + type: NodePort ports: - port: 80 + targetPort: 80 selector: app: test-app-php diff --git a/tests/php/chart/templates/instrumentation.yml b/tests/php/chart/templates/instrumentation.yaml similarity index 100% rename from tests/php/chart/templates/instrumentation.yml rename to tests/php/chart/templates/instrumentation.yaml diff --git a/tests/php/chart/values.yaml b/tests/php/chart/values.yaml new file mode 100644 index 0000000..44eb261 --- /dev/null +++ b/tests/php/chart/values.yaml @@ -0,0 +1 @@ +scenarioTag: "" \ No newline at end of file diff --git a/tests/php/chart/values.yml b/tests/php/chart/values.yml deleted file mode 100644 index c890919..0000000 --- a/tests/php/chart/values.yml +++ /dev/null @@ -1 +0,0 @@ -scenarioTag: ""