22
33Integration tests for Apache httpd Datadog module using pytest.
44
5- ## Quick Start
5+ ## All Tests
66
7- ### Setup
7+ All the commands below must be run from the root the repository, not from the ` test/integration-test ` directory:
88
9- ``` bash
10- # Install uv (Python package manager)
11- curl -LsSf https://astral.sh/uv/install.sh | sh
9+ ``` sh
10+ cd httpd-datadog
11+ ```
12+
13+ ### Pre-requisites
14+
15+ ``` sh
16+ git submodule update --init --recursive
17+ cmake --build build-rum # populates build-rum/_deps/injectbrowsersdk-src/
18+ ```
19+
20+ ### Build the Docker Image
21+
22+ ``` sh
23+ docker build -f test/integration-test/Dockerfile -t httpd-datadog-tests .
24+ ```
25+
26+ ### Run All Tests
27+
28+ ``` sh
29+ docker run --rm httpd-datadog-tests
30+ ```
31+
32+ ### Run Tests by Markers
33+
34+ The tests have the following optional markers:
35+
36+ - ` @pytest.mark.smoke ` - Basic functionality tests
37+ - ` @pytest.mark.ci ` - CI-suitable tests
38+ - ` @pytest.mark.requires_rum ` - RUM tests (auto-build module with RUM)
1239
13- # Install test dependencies
14- cd test/integration-test && uv sync
40+ So, to run only smoke tests:
1541
16- # Run smoke tests (auto-builds module variants as needed)
17- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v -m smoke
42+ ``` sh
43+ docker run --rm httpd-datadog-tests uv run pytest --bin-path=/httpd/httpd-build/bin/apachectl -v -m smoke
44+ ```
1845
19- # Run CI tests
20- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v -m ci
46+ Similarly, to run only CI tests:
2147
22- # Run RUM tests only (auto-builds with RUM support)
23- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v -m requires_rum
48+ ``` sh
49+ docker run --rm httpd-datadog-tests uv run pytest --bin-path=/httpd/httpd-build/bin/apachectl -v -m ci
50+ ```
2451
25- # Run all tests (auto-builds module variants as needed)
26- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v
52+ ### Run a Specific Test
2753
28- # Run with pre-built module (skip auto-build)
29- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v \
30- --module-path=/path/to/mod_datadog.so
54+ To run a specific test file:
3155
32- # Run specific test file
33- uv run pytest --bin-path=../../httpd/httpd-build/bin/apachectl -v \
34- scenarios/test_rum.py
56+ ``` sh
57+ docker run --rm httpd-datadog-tests uv run pytest --bin-path=/httpd/httpd-build/bin/apachectl -v scenarios/test_smoke.py
3558```
3659
37- ** Auto-Build Behavior:**
38- - The test suite automatically builds two module variants on demand:
39- - ** Without RUM** : ` build/mod_datadog/mod_datadog.so ` (for regular tests).
40- - ** With RUM** : ` build-rum/mod_datadog/mod_datadog.so ` (for ` @pytest.mark.requires_rum ` tests).
41- - Each variant is only built if tests requiring it are collected.
42- - Tests automatically use the correct variant based on markers.
43- - Build failures cause tests to fail (not skip).
44- - Use ` --module-path ` to override and skip auto-build.
60+ To run a specific test function:
4561
46- ## Command-Line Options
62+ ``` sh
63+ docker run --rm httpd-datadog-tests uv run pytest --bin-path=/httpd/httpd-build/bin/apachectl -v scenarios/test_smoke.py::test_version_symbol
64+ ```
65+
66+ ### Command-Line Options
4767
4868Required options:
4969- ` --bin-path ` - Path to apachectl binary (e.g., ` /usr/sbin/apachectl ` )
5070
51- Optional:
52- - ` --module-path ` - Path to mod_datadog.so (skips auto-build if provided)
71+ Optional options :
72+ - ` --module-path ` - Path to ` mod_datadog.so ` (skips auto-build if provided)
5373- ` --log-dir ` - Directory for test logs (defaults to temp directory)
5474
55- ## Test Markers
56-
57- - ` @pytest.mark.smoke ` - Basic functionality tests
58- - ` @pytest.mark.ci ` - CI-suitable tests
59- - ` @pytest.mark.requires_rum ` - RUM tests (auto-build module with RUM)
6075
6176## RUM Tests
6277
@@ -80,7 +95,7 @@ DatadogRum On
8095- Child ` <Location> ` overrides parent.
8196- Auto-builds module with ` -DHTTPD_DATADOG_ENABLE_RUM=ON ` when RUM tests are detected.
8297
83- ## Docker Testing
98+ ### Docker Testing
8499
85100``` sh
86101docker run --rm -v " $PWD :/workspace" -w /workspace \
@@ -95,16 +110,18 @@ docker run --rm -v "$PWD:/workspace" -w /workspace \
95110 "
96111```
97112
98- ## Troubleshooting
113+ ### Troubleshooting
99114
100115** RUM build fails:** Check CMake output for missing dependencies (inject-browser-sdk is fetched automatically via CMake FetchContent)
101116
102117** Tests hang:** Port 8136 in use
118+
103119``` sh
104120lsof -i :8136
105121```
106122
107123** Module issues:**
124+
108125``` sh
109126ldd /path/to/mod_datadog.so
110127apachectl -f /path/to/config.conf -t
0 commit comments