From 52119c4a7e02a161c6c32cacb03724c99c4d1c21 Mon Sep 17 00:00:00 2001 From: Pablo Collins Date: Wed, 22 Apr 2026 11:16:08 -0400 Subject: [PATCH 1/3] Add smoke tests, update releasing doc --- RELEASING.md | 23 +++++--- tests/smoke/smoke-test-docker-image.sh | 72 ++++++++++++++++++++++++++ tests/smoke/smoke-test-package.sh | 46 ++++++++++++++++ 3 files changed, 133 insertions(+), 8 deletions(-) create mode 100755 tests/smoke/smoke-test-docker-image.sh create mode 100755 tests/smoke/smoke-test-package.sh diff --git a/RELEASING.md b/RELEASING.md index 4216b65b..b86e13de 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -19,16 +19,23 @@ How to release a new version of the `splunk-opentelemetry` project: - bump our version in `__about__.py` - update additional version string locations - update CHANGELOG.md -7) Push the changes to the Github Splunk OTel Python repo -8) Open a PR and merge after approval -9) Navigate to the GitLab mirror and verify that the mirror has pulled the version you just merged by checking the - version number in the `__about__.py` file -10) When ready to release, create a new tag like `v3.4.5` on main in GitLab +7) Smoke test the local changes before releasing: + ``` + SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-package.sh + ``` +8) Push the changes to the Github Splunk OTel Python repo +9) Open a PR and merge after approval +10) Navigate to the GitLab mirror and verify that the mirror has pulled the version you just merged by checking the + version number in the `__about__.py` file +11) When ready to release, create a new tag like `v3.4.5` on main in GitLab - a tag of the format `vX.Y.Z` will trigger the CI pipeline to build and publish the package to PyPI and the Docker image to Quay -11) Monitor the release pipeline in GitLab to ensure it completes successfully -12) Post release, verify that the new package is available on PyPI and the Docker image is available on Quay -13) Smoke test the release locally by installing the new package and running it with a small app +12) Monitor the release pipeline in GitLab to ensure it completes successfully +13) Smoke test the published PyPI package and Docker image: + ``` + SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-package.sh --pypi + SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-docker-image.sh + ``` 14) Navigate to Pipelines in the GitLab repo, click the download button for the build job that just ran, and select the 'build-job' artifact - this will download a tarball of the package files diff --git a/tests/smoke/smoke-test-docker-image.sh b/tests/smoke/smoke-test-docker-image.sh new file mode 100755 index 00000000..d6a2d96f --- /dev/null +++ b/tests/smoke/smoke-test-docker-image.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Smoke test for the splunk-otel-instrumentation-python Docker image. +# Run this after a release to validate the published image at quay.io. +# +# Simulates what the Kubernetes OTel Operator does: runs the init container to +# populate /autoinstrumentation into a shared volume, then runs a Python container +# with that volume on PYTHONPATH and sends sqlite3 spans to Splunk O11y. +# +# Usage: +# SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-docker-image.sh +# SPLUNK_ACCESS_TOKEN= SPLUNK_REALM=eu0 ./tests/smoke/smoke-test-docker-image.sh +# SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-docker-image.sh --image + +: "${SPLUNK_ACCESS_TOKEN:?must be set}" + +DEFAULT_IMAGE="quay.io/signalfx/splunk-otel-instrumentation-python:latest" +IMAGE="${DEFAULT_IMAGE}" + +while [[ $# -gt 0 ]]; do + case "$1" in + --image=*) IMAGE="${1#--image=}"; shift ;; + --image) IMAGE="$2"; shift 2 ;; + *) shift ;; + esac +done + +REALM="${SPLUNK_REALM:-us1}" +SERVICE_NAME="sop-smoke-docker-image-$(date +%Y%m%d%H%M%S)" +VOLUME="smoke-autoinstrumentation-$$" + +cleanup() { + docker volume rm "$VOLUME" >/dev/null 2>&1 || true +} +trap cleanup EXIT + +echo "==> Image: ${IMAGE}" +echo "==> Pulling image..." +docker pull --platform linux/amd64 "$IMAGE" + +echo "" +echo "==> Running init container to populate /autoinstrumentation..." +docker run --rm --platform linux/amd64 \ + -v "${VOLUME}:/dest" \ + --entrypoint cp \ + "$IMAGE" \ + -r /autoinstrumentation/. /dest/ + +echo "" +echo "==> Sending spans to Splunk O11y (realm=${REALM}, service=${SERVICE_NAME})..." +docker run --rm --platform linux/amd64 \ + -v "${VOLUME}:/autoinstrumentation:ro" \ + -e PYTHONPATH=/autoinstrumentation \ + -e OTEL_SERVICE_NAME="${SERVICE_NAME}" \ + -e SPLUNK_ACCESS_TOKEN="${SPLUNK_ACCESS_TOKEN}" \ + -e SPLUNK_REALM="${REALM}" \ + -e OTEL_BSP_SCHEDULE_DELAY=200 \ + python:3.11-slim \ + /autoinstrumentation/bin/opentelemetry-instrument \ + python -c " +import sqlite3 +conn = sqlite3.connect(':memory:') +cur = conn.cursor() +for i in range(12): + cur.execute('SELECT ' + str(i)) +from opentelemetry import trace +trace.get_tracer_provider().force_flush() +" + +echo "" +echo "Done. Check APM on ${REALM} for service '${SERVICE_NAME}'." diff --git a/tests/smoke/smoke-test-package.sh b/tests/smoke/smoke-test-package.sh new file mode 100755 index 00000000..32a9106a --- /dev/null +++ b/tests/smoke/smoke-test-package.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Smoke test for the splunk-opentelemetry Python package. +# Installs the package (local checkout or PyPI) and sends spans to Splunk O11y to +# verify end-to-end instrumentation works. Run this before a release (local) or +# after a release (--pypi) to validate the published package. +# +# Usage: +# SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-package.sh # local checkout +# SPLUNK_ACCESS_TOKEN= ./tests/smoke/smoke-test-package.sh --pypi # PyPI package + +: "${SPLUNK_ACCESS_TOKEN:?must be set}" + +USE_PYPI=false +for arg in "$@"; do + [ "$arg" = "--pypi" ] && USE_PYPI=true +done + +SMOKE_VENV=/tmp/smoke-venv + +if [ "$USE_PYPI" = "true" ]; then + echo "==> Installing from PyPI..." +else + echo "==> Installing from local checkout..." +fi + +python -m venv "$SMOKE_VENV" +if [ "$USE_PYPI" = "true" ]; then + "$SMOKE_VENV/bin/pip" install --quiet splunk-opentelemetry +else + "$SMOKE_VENV/bin/pip" install --quiet . +fi + +if [ "$USE_PYPI" = "true" ]; then + echo "splunk-opentelemetry $("$SMOKE_VENV/bin/pip" show splunk-opentelemetry | grep ^Version | cut -d' ' -f2)" +fi + +export SPLUNK_ACCESS_TOKEN +export SPLUNK_REALM="${SPLUNK_REALM:-us1}" +export OTEL_SERVICE_NAME="sop-smoke-package-$(date +%Y%m%d%H%M%S)" + +"$SMOKE_VENV/bin/opentelemetry-instrument" \ + "$SMOKE_VENV/bin/python" tests/integration/trace_loop.py + +echo "Done. Check APM on ${SPLUNK_REALM} for service '${OTEL_SERVICE_NAME}'." From aad3a41014b3a8fc82b0448a8a7c05cf740e8c82 Mon Sep 17 00:00:00 2001 From: Pablo Collins Date: Wed, 22 Apr 2026 16:41:59 -0400 Subject: [PATCH 2/3] Remove venv before each run --- tests/smoke/smoke-test-package.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/smoke/smoke-test-package.sh b/tests/smoke/smoke-test-package.sh index 32a9106a..c68ac70e 100755 --- a/tests/smoke/smoke-test-package.sh +++ b/tests/smoke/smoke-test-package.sh @@ -25,6 +25,7 @@ else echo "==> Installing from local checkout..." fi +rm -rf "$SMOKE_VENV" python -m venv "$SMOKE_VENV" if [ "$USE_PYPI" = "true" ]; then "$SMOKE_VENV/bin/pip" install --quiet splunk-opentelemetry From 2e56e93ed3afda24562bd9adfe17cf7d59846e2b Mon Sep 17 00:00:00 2001 From: Pablo Collins Date: Thu, 14 May 2026 10:19:36 -0400 Subject: [PATCH 3/3] Fix step number reference --- RELEASING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index dcf9145d..59ed0183 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -40,7 +40,7 @@ How to release a new version of the `splunk-opentelemetry` project: and select the 'build-job' artifact - this will download a tarball of the package files 15) Navigate to the Splunk OTel Python repo and create a New Release - - create a new tag on publish with the tag name you created in step 10 + - create a new tag on publish with the tag name you created in step 11 - set the title to that tag name (e.g. `v2.7.0`) - unpack the tarball from step 14 and drag its contents onto the attachments section of the New Release page - Leave the defaults selected and click Publish