Skip to main content

runmat_test/event/
model.rs

1use serde::{Deserialize, Serialize};
2
3use crate::identity::{RunId, TestId};
4use crate::lifecycle::{ExecutionPhase, QualificationKind};
5use crate::result::{Artifact, AttemptResult, Diagnostic, RunResult};
6
7#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
8pub struct TestEvent {
9    pub sequence: u64,
10    pub run_id: RunId,
11    pub payload: TestEventPayload,
12}
13
14#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
15#[serde(rename_all = "snake_case", tag = "type")]
16pub enum TestEventPayload {
17    RunStarted,
18    TestStarted {
19        test_id: TestId,
20        attempt: u32,
21    },
22    PhaseStarted {
23        test_id: TestId,
24        attempt: u32,
25        phase: ExecutionPhase,
26        procedure: String,
27    },
28    PhaseFinished {
29        test_id: TestId,
30        attempt: u32,
31        phase: ExecutionPhase,
32        procedure: String,
33    },
34    Qualification {
35        test_id: TestId,
36        attempt: u32,
37        kind: QualificationKind,
38        diagnostic: Diagnostic,
39    },
40    Diagnostic {
41        test_id: TestId,
42        attempt: u32,
43        diagnostic: Diagnostic,
44    },
45    Output {
46        test_id: TestId,
47        attempt: u32,
48        text: String,
49        truncated: bool,
50    },
51    Artifact {
52        test_id: TestId,
53        attempt: u32,
54        artifact: Artifact,
55    },
56    Plugin {
57        plugin: String,
58        hook: String,
59        status: PluginStatus,
60        message: Option<String>,
61    },
62    TestFinished {
63        result: AttemptResult,
64    },
65    RunFinished {
66        result: RunResult,
67    },
68}
69
70#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
71#[serde(rename_all = "snake_case")]
72pub enum PluginStatus {
73    Completed,
74    Failed,
75}