By default, system tests will build a weblog image that ships the latest production version of the specified tracer language library.
But we often want to run system tests against unmerged changes. The general approach is to identify the git commit hash that contains your changes and use this commit hash to download a targeted build of the tracer. Note: ensure that the commit is pushed to a remote branch first, and when taking the commit hash, ensure you use the full hash. You can identify the commit hash using git log
or from the github UI.
- Add a file
agent-image
inbinaries/
. The content must be a valid docker image name containing the datadog agent, likedatadog/agent
ordatadog/agent-dev:master-py3
.
- Tracer: There are two ways for running the C++ library tests with a custom tracer:
- Create a file
cpp-load-from-git
inbinaries/
. Content examples:https://github.com/DataDog/dd-trace-cpp@main
https://github.com/DataDog/dd-trace-cpp@<COMMIT HASH>
- Clone the dd-trace-cpp repo inside
binaries
- Profiling: add a ddprof release tar to the binaries folder. Call the
install_ddprof
.
- Add a file
datadog-dotnet-apm-<VERSION>.tar.gz
inbinaries/
.<VERSION>
must be a valid version number.- One way to get that file is from an Azure pipeline (either a recent one from master if the changes you want to test were merged recently, or the one from your PR if it's open)
Create a file golang-load-from-go-get
under the binaries
directory that specifies the target build. The content of this file will be installed by the weblog or parametric app via go get
when the test image is built.
- Content example:
gopkg.in/DataDog/dd-trace-go.v1@main
Test the main branchgopkg.in/DataDog/dd-trace-go.v1@v1.67.0
Test the 1.67.0 releasegopkg.in/DataDog/dd-trace-go.v1@<commit_hash>
Test un-merged changes
Follow these steps to run Parametric tests with a custom Java Tracer version:
To run a custom Tracer version from a local branch:
- Clone the repo and checkout to the branch you'd like to test:
git clone git@github.com:DataDog/dd-trace-java.git
cd dd-trace-java
By default you will be on the master
branch, but if you'd like to run system-tests on the changes you made to your local branch, git checkout
to that branch before proceeding.
- Build Java Tracer artifacts
./gradlew :dd-java-agent:shadowJar :dd-trace-api:jar
- Copy both artifacts into the
system-tests/binaries/
folder:
- The Java tracer agent artifact
dd-java-agent-*.jar
fromdd-java-agent/build/libs/
- Its public API
dd-trace-api-*.jar
fromdd-trace-api/build/libs/
into
Note, you should have only TWO jar files in system-tests/binaries
. Do NOT copy sources or javadoc jars.
- Run Parametric tests from the
system-tests/parametric
folder:
TEST_LIBRARY=java ./run.sh test_span_sampling.py::test_single_rule_match_span_sampling_sss001
To run a custom tracer version from a remote branch:
- Find your remote branch on Github and navigate to the
ci/circleci: build_lib
test. - Open the details of the test in CircleCi and click on the
Artifacts
tab. - Download the
libs/dd-java-agent-*-SNAPSHOT.jar
andlibs/dd-trace-api-*-SNAPSHOT.jar
and move them into thesystem-tests/binaries/
folder. - Follow Step 4 from above to run the Parametric tests.
Follow these steps to run the OpenTelemetry drop-in test with a custom drop-in version:
- Download the custom version from https://repo1.maven.org/maven2/io/opentelemetry/javaagent/instrumentation/opentelemetry-javaagent-r2dbc-1.0/
- Copy the downloaded
opentelemetry-javaagent-r2dbc-1.0-{version}.jar
into thesystem-tests/binaries/
folder
Then run the OpenTelemetry drop-in test from the repo root folder:
./build.sh java
TEST_LIBRARY=java ./run.sh INTEGRATIONS -k Test_Otel_Drop_In
There are three ways to run system-tests with a custom node tracer.
- Using a custom tracer existing in a remote branch.
- Create a file
nodejs-load-from-npm
inbinaries/
- In the file, add the path to the branch of the custom tracer. The content will be installed by npm install.
- Content Examples:
DataDog/dd-trace-js#master
DataDog/dd-trace-js#<commit-hash>
- Run any scenario normally with
./build.sh nodejs
and./run.sh
and your remote changes will be in effect
- Create a file
- Using a custom tracer existing in a local branch.
- Create a file
nodejs-load-from-local
inbinaries/
- In the file, add the relative path to the
dd-trace-js
repo. - Content Examples:
- If the
dd-trace-js
repo is in the same directory as thesystem-tests
repo, add../dd-trace-js
to the file.
- If the
- This method will disable installing with npm install dd-trace and will instead get the content of the file, and use it as a location of the
dd-trace-js
repo and then mount it as a volume and npm link to it. This also removes the need to rebuild the weblog image since the code is mounted at runtime.
- Create a file
- Cloning a custom tracer in
binaries
- Clone the
dd-trace-js
repo insidebinaries
. - Checkout the remote branch with the custom tracer in the
dd-trace-js
repo that was just cloned. - Run any scenario normally with
./build.sh nodejs
and./run.sh
and your remote changes will be in effect
- Clone the
- Place
datadog-setup.php
anddd-library-php-[X.Y.Z+commitsha]-aarch64-linux-gnu.tar.gz
(or thex86_64
if you're not on ARM) in/binaries
folder- You can download those from the
build_packages/package extension
job artifacts, from a CI run of your branch.
- You can download those from the
- Copy it in the binaries folder
Then run the tests from the repo root folder:
./build.sh -i runner
TEST_LIBRARY=php ./run.sh PARAMETRIC
orTEST_LIBRARY=php ./run.sh PARAMETRIC -k <my_test>
⚠️ If you are seeing DNS resolution issues when running the tests locally, add the following config to the Docker daemon:
"dns-opts": [
"single-request"
],
- Add a file
binaries/python-load-from-pip
, the content will be installed by pip. Content example:
ddtrace @ git+https://github.com/DataDog/dd-trace-py.git
- Add a
.tar.gz
or a.whl
file inbinaries
, pip will install it - Clone the dd-trace-py repo inside
binaries
You can also run:
echo “ddtrace @ git+https://github.com/DataDog/dd-trace-py.git@<name-of-your-branch>” > binaries/python-load-from-pip
- Create an file
ruby-load-from-bundle-add
inbinaries/
, the content will be installed bybundle add
. Content example:gem 'datadog', git: "https://github.com/Datadog/dd-trace-rb", branch: "master", require: 'datadog/auto_instrument'
- Clone the dd-trace-rb repo inside
binaries
- copy a file
waf_rule_set
inbinaries/
Most of the ways to run system-tests with a custom tracer version involve modifying the binaries directory. Modifying the binaries will alter the tracer version used across your local computer. Once you're done testing with the custom tracer, ensure you remove it. For example for Python:
rm -rf binaries/python-load-from-pip
Hint for components who allows to have the repo in binaries
, use the command mount --bind src dst
to mount your local repo => any build of system tests will uses it.