Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions tests/docker_ssi/test_docker_ssi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
)


_NODEJS_V6_OR_LATER = context.library == "nodejs" and context.library.version.major >= 6
_NODEJS_UNSUPPORTED_RUNTIME = context.library == "nodejs" and (
(_NODEJS_V6_OR_LATER and context.installed_language_runtime < "22.0")
or (not _NODEJS_V6_OR_LATER and context.installed_language_runtime < "17.0")
)
_NODEJS_ABORT_IRRELEVANT = context.library == "nodejs" and not _NODEJS_UNSUPPORTED_RUNTIME


@scenarios.docker_ssi
class TestDockerSSIFeatures:
"""Test the ssi in a simulated host injection environment (docker container + test agent)
Expand Down Expand Up @@ -42,7 +50,7 @@ def setup_install_supported_runtime(self):
@irrelevant(context.library == "python" and context.installed_language_runtime < "3.8.0")
@irrelevant(context.library == "java" and context.installed_language_runtime < "1.8.0_0")
@irrelevant(context.library == "php" and context.installed_language_runtime < "7.0")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library >= "python@4.0.0rc1" and context.installed_language_runtime < "3.9.0")
@irrelevant(context.library == "ruby" and context.installed_language_runtime < "2.6.0")
def test_install_supported_runtime(self):
Expand Down Expand Up @@ -77,7 +85,7 @@ def test_install_weblog_running(self):
)
@irrelevant(context.library == "java" and context.installed_language_runtime < "1.8.0_0")
@irrelevant(context.library == "php" and context.installed_language_runtime < "7.0")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library >= "python@4.0.0rc1" and context.installed_language_runtime < "3.9.0")
@irrelevant(context.library == "ruby" and context.installed_language_runtime < "2.6.0")
def test_telemetry(self):
Expand Down Expand Up @@ -106,7 +114,7 @@ def test_telemetry(self):
@irrelevant(context.library == "php" and context.installed_language_runtime >= "7.0")
@bug(context.library == "nodejs" and context.installed_language_runtime < "12.17.0", reason="INPLAT-252")
@bug(context.library == "java" and context.installed_language_runtime == "1.7.0-201", reason="INPLAT-427")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime >= "17.0")
@irrelevant(_NODEJS_ABORT_IRRELEVANT)
@irrelevant(context.library == "dotnet" and context.installed_language_runtime >= "6.0.0")
@irrelevant(context.library == "ruby" and context.installed_language_runtime >= "2.6.0")
def test_telemetry_abort(self):
Expand Down Expand Up @@ -145,7 +153,7 @@ def setup_instrumentation_source_ssi(self):
@irrelevant(context.library == "python" and context.installed_language_runtime < "3.9.0")
@irrelevant(context.library == "java" and context.installed_language_runtime < "1.8.0_0")
@irrelevant(context.library == "php" and context.installed_language_runtime < "7.1")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library >= "python@4.0.0.dev" and context.installed_language_runtime < "3.9.0")
@irrelevant(context.library < "python@4.0.0.dev" and context.installed_language_runtime < "3.8.0")
@irrelevant(context.library == "ruby" and context.installed_language_runtime < "2.6.0")
Expand All @@ -168,7 +176,7 @@ def setup_injection_metadata(self):
@irrelevant(context.library == "python" and context.installed_language_runtime < "3.8.0")
@irrelevant(context.library == "java" and context.installed_language_runtime < "1.8.0_0")
@irrelevant(context.library == "php" and context.installed_language_runtime < "7.1")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library >= "python@4.0.0rc1" and context.installed_language_runtime < "3.9.0")
def test_injection_metadata(self):
logger.info("Testing injection result variables")
Expand Down
9 changes: 8 additions & 1 deletion tests/docker_ssi/test_docker_ssi_appsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
from utils import scenarios, interfaces, weblog, features, irrelevant, context


_NODEJS_V6_OR_LATER = context.library == "nodejs" and context.library.version.major >= 6
_NODEJS_UNSUPPORTED_RUNTIME = context.library == "nodejs" and (
(_NODEJS_V6_OR_LATER and context.installed_language_runtime < "22.0")
or (not _NODEJS_V6_OR_LATER and context.installed_language_runtime < "17.0")
)


@features.appsec_service_activation_origin_metric
@scenarios.docker_ssi_appsec
class TestDockerSSIAppsecFeatures:
Expand All @@ -17,7 +24,7 @@ def setup_telemetry_source_ssi(self):

@irrelevant(context.library == "java" and context.installed_language_runtime < "1.8.0_0")
@irrelevant(context.library == "php" and context.installed_language_runtime < "7.1")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library >= "python@4.0.0.dev" and context.installed_language_runtime < "3.9.0")
@irrelevant(context.library < "python@4.0.0.dev" and context.installed_language_runtime < "3.8.0")
@irrelevant(context.library == "ruby" and context.installed_language_runtime < "2.6.0", reason="Ruby 2.6+ required")
Expand Down
9 changes: 8 additions & 1 deletion tests/docker_ssi/test_docker_ssi_crash.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
from utils import weblog, logger


_NODEJS_V6_OR_LATER = context.library == "nodejs" and context.library.version.major >= 6
_NODEJS_UNSUPPORTED_RUNTIME = context.library == "nodejs" and (
(_NODEJS_V6_OR_LATER and context.installed_language_runtime < "22.0")
or (not _NODEJS_V6_OR_LATER and context.installed_language_runtime < "17.0")
)


@scenarios.docker_ssi_crashtracking
class TestDockerSSICrash:
"""Test the ssi in a simulated host injection environment (docker container + test agent)
Expand All @@ -36,7 +43,7 @@ def setup_crash(self):

@features.ssi_crashtracking
@irrelevant(context.library == "python" and context.installed_language_runtime < "3.7.0")
@irrelevant(context.library == "nodejs" and context.installed_language_runtime < "17.0")
@irrelevant(_NODEJS_UNSUPPORTED_RUNTIME)
@irrelevant(context.library == "ruby" and context.installed_language_runtime < "2.6.0")
def test_crash(self):
"""Validate that a crash report is generated when the application crashes"""
Expand Down
2 changes: 1 addition & 1 deletion utils/build/ssi/base/install_script_ssi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -n "${DD_INSTALLER_LIBRARY_VERSION}" ]; then
fi

if [ "${DD_LANG}" == "js" ] && [ "${SSI_ENV}" == "dev" ] && [ -z "${DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS}" ]; then
# Special case for Node.js, the staging major version is 1 above the prod major (6 here)
# Special case for Node.js, the staging major version is 1 above the prod major (7 here)
export DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS="6"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
if command -v docker >/dev/null 2>&1; then
echo "Docker is installed, ensuring service is enabled and running..."
sudo systemctl enable docker.service docker.socket

if ! sudo systemctl is-active --quiet docker.service; then
echo "Docker service is not running, starting it..."
sudo systemctl start docker.service docker.socket

# Wait for Docker to be fully ready
echo "Waiting for Docker service to be ready..."
MAX_WAIT=20
Expand All @@ -34,7 +34,7 @@
sleep 1
((COUNTER++))
done

if [ $COUNTER -eq $MAX_WAIT ]; then
echo "WARNING: Docker service did not become ready after $MAX_WAIT seconds"
fi
Expand All @@ -56,8 +56,8 @@
export DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_PYTHON=4
fi

else
export DD_SITE="datadoghq.com"
else
export DD_SITE="datadoghq.com"
#The latest release of python tracer version is 2.x we want to use 3.x. Get from repo tags v3* and not rc*. We get the SHA of the tag.
#more details: https://datadoghq.atlassian.net/browse/APMSP-2259
if [ "${DD_LANG}" == "python" ]; then
Expand All @@ -75,7 +75,7 @@
fi

if [ "${DD_LANG}" == "js" ] && [ "${DD_env}" == "dev" ] && [ -z "${DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS}" ]; then
# Special case for Node.js, the staging major version is 1 above the prod major (6 here)
# Special case for Node.js, the staging major version is 1 above the prod major (7 here)
export DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS="6"
fi

Expand Down Expand Up @@ -156,10 +156,10 @@
sudo cp debug_config.yaml /etc/datadog-agent/inject/debug_config.yaml

for i in 1 2 3 4 5; do sudo datadog-installer apm instrument docker && break || sleep 1; done

# Add dd-agent user to docker group for docker socket access
sudo usermod -aG docker dd-agent || echo "Warning: Could not add dd-agent to docker group"

# Restart datadog-agent so the new group membership takes effect
sudo systemctl restart datadog-agent || echo "Warning: Could not restart datadog-agent"
- os_type: windows
Expand Down Expand Up @@ -201,7 +201,7 @@
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
$env:DD_SITE = "datadoghq.com";
$env:DD_APM_INSTRUMENTATION_ENABLED = "iis"

# Check if Install-Datadog.ps1 exists locally in binaries folder
if (Test-Path "Install-Datadog.ps1") {
Write-Host "*** Execute installation script from provided binaries ***"
Expand All @@ -210,5 +210,5 @@
Write-Host "Download installation script from datadoghq.com"
(New-Object System.Net.WebClient).DownloadFile('https://install.datadoghq.com/Install-Datadog.ps1', 'C:\Windows\SystemTemp\Install-Datadog.ps1');
}

C:\Windows\SystemTemp\Install-Datadog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if [ "${DD_env}" == "dev" ]; then
if [ "${DD_LANG}" == "python" ]; then
export DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_PYTHON=4
fi
else
export DD_SITE="datadoghq.com"
else
export DD_SITE="datadoghq.com"
#The latest release of python tracer version is 2.x we want to use 4.x. Get from repo tags v3* and not rc*. We get the SHA of the tag.
#more details: https://datadoghq.atlassian.net/browse/APMSP-2259
if [ "${DD_LANG}" == "python" ]; then
Expand All @@ -37,11 +37,11 @@ export DD_APM_INSTRUMENTATION_LIBRARIES="${DD_LANG}"

if [ -n "${DD_INSTALLER_LIBRARY_VERSION}" ]; then
export "DD_INSTALLER_REGISTRY_URL_APM_LIBRARY_$(echo "$DD_LANG" | tr "[:lower:]" "[:upper:]")_PACKAGE"='installtesting.datad0g.com'
export "DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_$(echo "$DD_LANG" | tr "[:lower:]" "[:upper:]")"="${DD_INSTALLER_LIBRARY_VERSION}"
export "DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_$(echo "$DD_LANG" | tr "[:lower:]" "[:upper:]")"="${DD_INSTALLER_LIBRARY_VERSION}"
fi

if [ "${DD_LANG}" == "js" ] && [ "${DD_env}" == "dev" ] && [ -z "${DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS}" ]; then
# Special case for Node.js, the staging major version is 1 above the prod major (6 here)
# Special case for Node.js, the staging major version is 1 above the prod major (7 here)
export DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_JS="6"
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
weblog:
name: test-app-nodejs-alpine
runtime_version: 18
runtime_version: 22
Comment thread
pabloerhard marked this conversation as resolved.
install:
- os_type: linux
copy_files:
Expand All @@ -15,6 +15,5 @@ weblog:

- name: copy-nodejs-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-alpine/Dockerfile.template
remote_path: Dockerfile.template

remote-command: sh create_and_run_app_container.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
weblog:
name: test-app-nodejs-container
runtime_version: 18
runtime_version: 22
install:
- os_type: linux
copy_files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ weblog:
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/docker-compose.yml
- name: copy-nodejs-app
local_path: lib-injection/build/docker/nodejs/sample-app
- name: copy-node20-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.node20
- name: copy-node22-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.node22
- name: copy-nodejs-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.node
- name: copy-reverseproxy-dockerfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ lang_variant:
install:
- os_type: linux
os_distro: deb
remote-command: sudo apt-get update && sudo apt-get install -y nodejs
remote-command: |
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

- os_type: linux
os_distro: rpm
os_branch: redhat
remote-command: |
sudo dnf -y module enable nodejs:20
sudo dnf -y module switch-to nodejs:20
sudo dnf install -y nodejs
sudo yum install tar -y || sudo dnf install tar -y || true
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install --no-progress 22.11.0
nvm use 22.11.0
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

- os_type: linux
os_distro: rpm
os_branch: centos_8_amd64
remote-command: |
#one of the default method for centos 8
#https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-centos-8
sudo dnf -y module enable nodejs:20
sudo dnf -y module switch-to nodejs:20
sudo dnf install -y nodejs
sudo yum install tar -y || sudo dnf install tar -y || true
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install --no-progress 22.11.0
nvm use 22.11.0
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

- os_type: linux
os_distro: rpm
Expand All @@ -35,8 +45,8 @@ lang_variant:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install --lts
nvm use node
nvm install --no-progress 22.11.0
nvm use 22.11.0
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

weblog:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/node:18
FROM public.ecr.aws/docker/library/node:22

# Create app directory
WORKDIR /usr/src/app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/node:20-slim
FROM public.ecr.aws/docker/library/node:22-slim

# Create app directory
WORKDIR /usr/src/app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/node:20-slim
FROM public.ecr.aws/docker/library/node:22-slim

# Create app directory
WORKDIR /usr/src/app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ services:
healthcheck:
test: "curl -f http://localhost:8080"

node_20:
node_22:
Comment thread
pabloerhard marked this conversation as resolved.
env_file: "scenario_app.env"
image: system-tests/node_20:latest
image: system-tests/node_22:latest
restart: always
build:
context: .
dockerfile: Dockerfile.node20
dockerfile: Dockerfile.node22
healthcheck:
test: "node health"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ http {
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';

upstream node_20_app {
server node_20:18080;
upstream node_22_app {
server node_22:18080;
}
upstream node_app {
server node:18080;
Expand All @@ -24,9 +24,9 @@ http {
return 200 "{
'app_type':'multicontainer',
'apps':[{
'runtime':'20',
'runtime':'22',
'type':'container',
'url':'/node_20/'
'url':'/node_22/'
},{
'runtime':'latest',
'type':'container',
Expand All @@ -35,8 +35,8 @@ http {
}";
}

location /node_20/ {
proxy_pass http://node_20_app/;
location /node_22/ {
proxy_pass http://node_22_app/;
proxy_redirect off;
}
location /node/ {
Expand Down
Loading