vector/components/validation/test_case.rs
1use serde::Deserialize;
2
3use super::TestEvent;
4
5/// Expected outcome of a validation test case.
6#[derive(Clone, Copy, Deserialize)]
7pub enum TestCaseExpectation {
8 /// All events were processed successfully.
9 #[serde(rename = "success")]
10 Success,
11
12 /// All events failed to be processed successfully.
13 #[serde(rename = "failure")]
14 Failure,
15
16 /// Some events, but not all, were processed successfully.
17 #[serde(rename = "partial_success")]
18 PartialSuccess,
19}
20
21/// A validation test case.
22///
23/// Test cases define both the events that should be given as input to the component being
24/// validated, as well as the "expectation" for the test case, in terms of if all the events should
25/// be processed successfully, or fail to be processed, and so on.
26#[derive(Deserialize)]
27pub struct TestCase {
28 pub name: String,
29 pub config_name: Option<String>,
30 pub expectation: TestCaseExpectation,
31 pub events: Vec<TestEvent>,
32}