Skip to content

Commit

Permalink
chore(examples): updating elastic examples
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Aug 13, 2024
1 parent e61672a commit 3a592b3
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

TOKEN=$TRACETEST_TOKEN
ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
type: DataStore
spec:
id: current
name: elasticapm
type: elasticapm
elasticapm:
addresses:
- https://es01:9200
username: elastic
password: changeme
index: traces-apm-default
insecureSkipVerify: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
type: PollingProfile
spec:
id: jBPzxDCSg
name: elastic
strategy: periodic
default: true
periodic:
retryDelay: 4s
timeout: 10m
16 changes: 16 additions & 0 deletions examples/tracetest-elasticapm-with-elastic-agent/resources/run.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: Test
spec:
id: W656Q0c4g
name: Test API
description: Test the App.
pollingProfile: elastic
trigger:
type: http
httpRequest:
url: http://app:8080
method: GET
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http" service.name="sample-app" name="GET /"]
assertions:
- attr:http.response.status_code = 200
- attr:tracetest.span.duration < 500ms

0 comments on commit 3a592b3

Please sign in to comment.