datadog_agent_config_corpus/lib.rs
1//! Reads recorded Datadog Agent configuration for tests of Agent Data Plane (ADP) compatibility.
2//!
3//! The Agent and ADP read configuration in Go and Rust respectively. Their conversions can differ:
4//! a value sent to ADP as a string may be read by the Agent as a map. These tests need examples from
5//! the Agent's own code, not assumed values or copies of its conversion logic.
6//!
7//! The **config recorder**, a Go program in `lib/datadog-agent/config-recorder/`, runs that code
8//! with specified inputs. For each test **case**, it records the values and sources sent over the
9//! Agent's config stream, plus results from methods such as `GetInt` and `GetStringMap`. These
10//! methods are called **getters**. Their results show what Agent components read from configuration.
11//! The saved collection of cases is the **corpus**, checked in as `config-recorder/corpus.jsonl`.
12//!
13//! This crate lets Rust tests use those recordings without running Go or Docker. [`read`] validates
14//! the file and returns a [`Corpus`] with typed inputs, stream settings, and getter results. It fills
15//! in omitted fields according to the format rules and reports invalid records as [`Violation`]s.
16//! It does not run ADP or compare ADP's behavior with the Agent's.
17//!
18//! The format is defined in `config-recorder/docs/record.md`, with input values in `case.md` and
19//! getter selection and result encoding in `getter-map.md`. The reader follows these documents
20//! independently of the Go writer, so a writer bug is not copied into both implementations.
21//! Unit tests also check that the saved recordings match the current schema and recorder inputs.
22#![deny(missing_docs)]
23
24mod getter;
25mod json;
26mod lists;
27mod model;
28mod reader;
29
30pub use getter::{GetterResult, GoFloat, GoValue, Number};
31pub use lists::{Getter, Group, Level, Source, REVIEWED_AT_AGENT_COMMIT};
32pub use model::*;
33pub use reader::read;
34
35#[cfg(test)]
36mod tests;
37
38#[cfg(test)]
39mod corpus_checks;