diff --git a/examples/tracetest-azure-app-insights-collector/Dockerfile.tracetest b/examples/tracetest-azure-app-insights-collector/Dockerfile.tracetest new file mode 100644 index 0000000000..883f239155 --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/Dockerfile.tracetest @@ -0,0 +1,11 @@ +FROM alpine + +WORKDIR /app +ARG TRACETEST_IMAGE_VERSION=v1.4.0 + +RUN apk --update add bash jq curl +RUN curl -L https://raw.githubusercontent.com/kubeshop/tracetest/main/install-cli.sh | bash -s -- $TRACETEST_IMAGE_VERSION + +WORKDIR /resources + +ENTRYPOINT ["echo", "Tracetest CLI installed"] diff --git a/examples/tracetest-azure-app-insights-collector/resources/apply.sh b/examples/tracetest-azure-app-insights-collector/resources/apply.sh new file mode 100644 index 0000000000..4ed133869b --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/resources/apply.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +TOKEN=$TRACETEST_TOKEN +ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID +ARM_ID=$APP_INSIGHTS_ARM_ID +ACCESS_TOKEN=$APP_INSIGHTS_ACCESS_TOKEN + +apply() { + echo "Configuring TraceTest" + tracetest configure --token $TOKEN --environment $ENVIRONMENT_ID + + echo "Applying Resources" + tracetest apply datastore -f /resources/datastore.yaml + tracetest apply pollingprofile -f /resources/pollingprofile.yaml + tracetest apply test -f /resources/test.yaml +} + +apply diff --git a/examples/tracetest-azure-app-insights-collector/resources/datastore.yaml b/examples/tracetest-azure-app-insights-collector/resources/datastore.yaml new file mode 100644 index 0000000000..e94dc41110 --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/resources/datastore.yaml @@ -0,0 +1,9 @@ +--- +type: DataStore +spec: + id: current + name: azureappinsights + type: azureappinsights + azureappinsights: + connectionType: collector + useAzureActiveDirectoryAuth: false diff --git a/examples/tracetest-azure-app-insights-collector/resources/pollingprofile.yaml b/examples/tracetest-azure-app-insights-collector/resources/pollingprofile.yaml new file mode 100644 index 0000000000..36e51f6e09 --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/resources/pollingprofile.yaml @@ -0,0 +1,9 @@ +--- +type: PollingProfile +spec: + id: azure + name: azure + strategy: periodic + periodic: + retryDelay: 4s + timeout: 10m diff --git a/examples/tracetest-azure-app-insights-collector/resources/run.sh b/examples/tracetest-azure-app-insights-collector/resources/run.sh new file mode 100644 index 0000000000..05d0f41724 --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/resources/run.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +TOKEN=$TRACETEST_TOKEN +ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID + +run() { + echo "Configuring Tracetest" + tracetest configure --token $TOKEN --environment $ENVIRONMENT_ID + + echo "Running Trace-Based Tests..." + tracetest run test -f /resources/test.yaml +} + +run diff --git a/examples/tracetest-azure-app-insights-collector/resources/test.yaml b/examples/tracetest-azure-app-insights-collector/resources/test.yaml new file mode 100644 index 0000000000..207ffdb009 --- /dev/null +++ b/examples/tracetest-azure-app-insights-collector/resources/test.yaml @@ -0,0 +1,18 @@ +type: Test +spec: + id: W656Q0c4g + name: Test API + description: Test the App. + trigger: + type: http + httpRequest: + method: GET + url: http://app:8080 + headers: + - key: Content-Type + value: application/json + specs: + - selector: span[tracetest.span.type="http" name="GET /"] + assertions: + - attr:http.status_code = 200 + - attr:tracetest.span.duration < 500ms