Skip to content

Commit 7cd9465

Browse files
authored
Add test for embedded nfsiostat (DataDog#23280)
1 parent d655bde commit 7cd9465

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

nfsstat/tests/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
'start_commands': [
2020
'apt-get update',
2121
'apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y docker.io',
22+
# Remove default binary to ensure the check uses the embedded one
23+
'rm -f /usr/local/sbin/nfsiostat',
2224
],
2325
'docker_volumes': ['/var/run/docker.sock:/var/run/docker.sock'],
2426
}
2527

28+
CONFIG_BUNDLED_BINARY = {
29+
"init_config": {},
30+
"instances": [{}],
31+
}
32+
2633
METRICS = [
2734
'system.nfs.ops',
2835
'system.nfs.rpc_bklog',

nfsstat/tests/test_e2e.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from datadog_checks.dev.utils import get_metadata_metrics
77

8-
from .common import CONFIG, METRICS
8+
from .common import CONFIG, CONFIG_BUNDLED_BINARY, METRICS
99

1010

1111
@pytest.mark.e2e
@@ -17,3 +17,11 @@ def test_e2e(dd_agent_check):
1717

1818
aggregator.assert_all_metrics_covered()
1919
aggregator.assert_metrics_using_metadata(get_metadata_metrics())
20+
21+
22+
@pytest.mark.e2e
23+
def test_e2e_bundled_binary_no_mounts(dd_agent_check):
24+
"""Verify the agent's bundled nfsiostat binary exists and the check handles no NFS mounts gracefully."""
25+
aggregator = dd_agent_check(CONFIG_BUNDLED_BINARY)
26+
27+
aggregator.assert_all_metrics_covered()

0 commit comments

Comments
 (0)