Commit 046c450
authored
chore(ssi): create shared testing library (#43867)
### What does this PR do?
This commit creates a shared testing library for Single Step Instrumentation in Kubernetes. This will enable us to have test helpers in the agent end to end tests as well as other repositories like injector-dev.
### Motivation
When testing SSI, I find myself needing similar logic each time. Given a Kubernetes pod spec, does it have the things we expect? The default pod and container spec is not test friendly. One easy example is environment variables that exist in a list. Another example is a container image string that we need to know the registry or tag.
The very clear place I need this library is for e2e tests. See my draft PR here that got too big: #43422. Another place I would like to use them is in[ injector-dev](https://github.com/DataDog/injector-dev/blob/main/tests/helm/a-group-of-services/scenario_test.go).
### Describe how you validated your changes
This code was already being used to test SSI in our integration test. I expanded the usage in my draft PR for e2e tests so I know it covers that use case as well.
I used [this guide](https://datadoghq.dev/datadog-agent/how-to/go/modules/) to create this PR. In addition, I ran the following commands:
```bash
dda inv -- -e modules.validate -f # Format the modules.yaml
dda inv modules.add-all-replace # Ensure the local replacements are added
dda inv tidy # Ensure all modules have been tidied including our new one
```
### Additional Notes
I added basic unit tests to "test the tests". They're not exhaustive, but I figured as long as they exist they provide an easy path to extend them if our testing library needs modification.
Co-authored-by: mark.spicer <mark.spicer@datadoghq.com>1 parent 7476aa1 commit 046c450
180 files changed
Lines changed: 1217 additions & 404 deletions
File tree
- .github
- comp
- api/api/def
- core
- agenttelemetry
- def
- fx
- impl
- configsync
- config
- flare
- builder
- types
- hostname/hostnameinterface
- ipc
- def
- httphelpers
- impl
- mock
- log
- def
- fx
- impl-trace
- impl
- mock
- secrets
- def
- fx
- impl
- mock
- noop-impl
- utils
- status
- statusimpl
- tagger
- def
- fx-remote
- generic_store
- impl-remote
- origindetection
- subscriber
- tags
- telemetry
- types
- utils
- telemetry
- def
- forwarder
- defaultforwarder
- orchestrator/orchestratorinterface
- logs/agent/config
- netflow/payload
- otelcol
- collector-contrib
- def
- impl
- converter
- def
- impl
- ddflareextension
- def
- impl
- types
- ddprofilingextension
- def
- impl
- logsagentpipeline
- logsagentpipelineimpl
- otlp
- components
- exporter
- datadogexporter
- logsagentexporter
- serializerexporter
- metricsclient
- processor/infraattributesprocessor
- statsprocessor
- testutil
- status
- def
- impl
- serializer
- logscompression
- metricscompression
- trace
- agent/def
- compression
- def
- impl-gzip
- impl-zstd
- pkg
- aggregator/ckey
- api
- clusteragent/admission/mutate/autoinstrumentation
- collector/check/defaults
- config
- create
- env
- helper
- mock
- model
- nodetreemodel
- remote
- setup
- structure
- teeconfig
- utils
- viperconfig
- errors
- fips
- gohai
- linters/components/pkgconfigusage
- logs
- client
- diagnostic
- message
- metrics
- pipeline
- processor
- sds
- sender
- sources
- status
- statusinterface
- utils
- types
- util/testutils
- metrics
- networkdevice/profile
- networkpath/payload
- network
- driver
- payload
- obfuscate
- opentelemetry-mapping-go
- inframetadata
- gohai/internal/gohaitest
- otlp
- attributes
- logs
- metrics
- rum
- orchestrator
- model
- util
- process/util/api
- proto
- remoteconfig/state
- security
- seclwin
- secl
- serializer
- ssi/testutils
- status/health
- tagger/types
- tagset
- telemetry
- trace
- util
- backoff
- buf
- cache
- cgroups
- common
- compression
- containers/image
- defaultpaths
- executable
- filesystem
- flavor
- fxutil
- grpc
- hostinfo
- hostname/validate
- http
- jsonquery
- json
- log
- setup
- option
- otel
- pointer
- prometheus
- quantile
- sketchtest
- scrubber
- sort
- startstop
- statstracker
- system
- socket
- testutil
- utilizationtracker
- uuid
- winutil
- version
- test
- e2e-framework
- fakeintake
- new-e2e
- otel
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
| 655 | + | |
655 | 656 | | |
656 | 657 | | |
657 | 658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
0 commit comments