This project contains a test runner and configuration which are used for testing GCP's OpenTelemetry exporters, resource detectors, propagators, etc. These tests are run in pull requests to the other GoogleCloudPlatform/opentelemtry-operations-* repos.
The code in this repository is only for testing purposes! This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.
Build the docker image locally:
docker build . -t opentelemetry-operations-e2e-testing:local
Run the image with a test server, e.g. with the python instrumented test server from a recent build:
PROJECT_ID="opentelemetry-ops-e2e"
GOOGLE_APPLICATION_CREDENTIALS="${HOME}/.config/gcloud/application_default_credentials.json"
# Using a recent python build for example. Alternatively, use a locally built
# test server.
INSTRUMENTED_TEST_SERVER="us-central1-docker.pkg.dev/opentelemetry-ops-e2e/e2e-testing/opentelemetry-operations-python-e2e-test-server:45ccd1d"
# Pull the image if it doesn't exist locally
docker pull ${INSTRUMENTED_TEST_SERVER}
docker run \
-e "GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS}" \
-v "${GOOGLE_APPLICATION_CREDENTIALS}:${GOOGLE_APPLICATION_CREDENTIALS}:ro" \
-v /var/run/docker.sock:/var/run/docker.sock \
-e PROJECT_ID=${PROJECT_ID} \
--rm \
opentelemetry-operations-e2e-testing:local \
local \
--image=${INSTRUMENTED_TEST_SERVER}
Since running in cloud functions require you to upload a zipped file containing the source code, steps to trigger test runs in a cloud function environment are slightly different from running in a local environment.
Build the docker image locally:
docker build . -t opentelemetry-operations-e2e-testing:local
Make sure you have the proper environment variables setup:
PROJECT_ID="opentelemetry-ops-e2e"
GOOGLE_APPLICATION_CREDENTIALS="${HOME}/.config/gcloud/application_default_credentials.json"
Run the image with a test server provided through the zip file. The following docker command makes the following assumptions:
function-source.zip
function-deployment
within your current directory (from where you run this command)
java11
environment.
com.google.cloud.opentelemetry.endtoend.CloudFunctionHandler
.docker run \
-e PROJECT_ID=${PROJECT_ID} \
-e GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS} \
-v "${GOOGLE_APPLICATION_CREDENTIALS}:${GOOGLE_APPLICATION_CREDENTIALS}:ro" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)/function-deployment/function-source.zip:/function-source.zip" \
-it \
--rm \
opentelemetry-operations-e2e-testing:local \
cloud-functions-gen2 \
--runtime=java11 \
--functionsource="/function-source.zip" \
--entrypoint=com.google.cloud.opentelemetry.endtoend.CloudFunctionHandler
NOTE: If you are using Java, you can also use a generated JAR to deploy the function. However, you would still need zip the JAR and the JAR should be at the root of the zip. For more information look at the How to guides for Google Cloud Functions.
See docs/contributing.md
for details.
Apache 2.0; see LICENSE
for details.
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.