Commit 2d4c8db
authored
test(discovery): run discovery tests against both Go module and sd-agent (#47622)
### What does this PR do?
Refactors discovery module tests to run against both the Go discovery module and the Rust sd-agent binary. Tests are converted from standalone test functions into a `discoveryTestSuite` (using testify's suite package), which is parameterized with a setup function for each implementation. This ensures both the Go and Rust discovery modules are exercised by the same test cases.
Key changes:
- Rename `setupDiscoveryModule` to `setupGoDiscoveryModule` and add `setupRustDiscoveryModule` which starts the sd-agent binary and communicates via Unix socket
- Introduce `discoveryTestSuite` struct and `TestDiscovery` entry point that runs the suite for both Go and Rust
- Convert all `TestServices*` functions to suite methods so they run against both implementations
- Thread `*testDiscoveryModule` (including its HTTP client) through `getServices` and `makeRequest` instead of passing a bare URL
- Remove the standalone `TestRustBinary` smoke test (now redundant since real tests run against sd-agent)
- Keep `TestIgnoreComm` as a standalone test since ignore-comms is Go-module-only
### Motivation
The Rust sd-agent is intended to be a drop-in replacement for the Go discovery module. Running the same test suite against both implementations ensures behavioral parity and catches regressions in either.
### Describe how you validated your changes
Ran the test suite locally with both Go and Rust discovery modules.
### Additional Notes
The `TestIgnoreComm` test remains standalone because the ignore-comms feature is currently only implemented in the Go discovery module.
Co-authored-by: vincent.whitchurch <vincent.whitchurch@datadoghq.com>1 parent a739c72 commit 2d4c8db
File tree
3 files changed
+136
-80
lines changed- pkg/discovery/module
3 files changed
+136
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | | - | |
| 62 | + | |
59 | 63 | | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
74 | 132 | | |
75 | 133 | | |
76 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
77 | 154 | | |
78 | 155 | | |
79 | | - | |
| 156 | + | |
80 | 157 | | |
81 | 158 | | |
82 | 159 | | |
| |||
94 | 171 | | |
95 | 172 | | |
96 | 173 | | |
97 | | - | |
| 174 | + | |
98 | 175 | | |
99 | 176 | | |
100 | 177 | | |
| |||
418 | 495 | | |
419 | 496 | | |
420 | 497 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| |||
0 commit comments