Repository navigation
Expand file tree
/
Copy pathmod.rs
More file actions
74 lines (56 loc) · 1.65 KB
/
Copy pathmod.rs
File metadata and controls
74 lines (56 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#![allow(missing_docs)]
use crate::{
config::{Config, GenerateConfig},
topology::{RunningTopology, ShutdownErrorReceiver},
trace,
};
pub async fn start_topology(
mut config: Config,
require_healthy: impl Into<Option<bool>>,
) -> (RunningTopology, ShutdownErrorReceiver) {
config.healthchecks.set_require_healthy(require_healthy);
RunningTopology::start_init_validated(config, Default::default())
.await
.unwrap()
}
#[cfg(any(test, feature = "test-utils"))]
pub mod components;
#[cfg(test)]
pub mod http;
#[cfg(test)]
pub mod metrics;
#[cfg(test)]
pub mod mock;
#[cfg(all(test, feature = "sources-vector"))]
pub mod jwt_auth;
pub mod stats;
pub use vector_lib::test_util::*;
#[cfg(test)]
pub use vector_lib::assert_downcast_matches;
#[cfg(test)]
pub use collect_ready_async as collect_ready;
pub fn test_generate_config<T>()
where
for<'de> T: GenerateConfig + serde::Deserialize<'de>,
{
let cfg = toml::to_string(&T::generate_config()).unwrap();
toml::from_str::<T>(&cfg)
.unwrap_or_else(|e| panic!("Invalid config generated from string:\n\n{}\n'{}'", e, cfg));
}
#[cfg(test)]
pub use vector_lib::inet_test_util::*;
pub fn trace_init() {
#[cfg(unix)]
let color = {
use std::io::IsTerminal;
std::io::stdout().is_terminal()
};
// Windows: ANSI colors are not supported by cmd.exe
// Color is false for everything except unix.
#[cfg(not(unix))]
let color = false;
let levels = std::env::var("TEST_LOG").unwrap_or_else(|_| "error".to_string());
trace::init(color, false, &levels, 10);
// Initialize metrics as well
vector_lib::metrics::init_test();
}