grafbase_sdk/test/
config.rs1use grafbase_sdk_mock::Subgraph;
2use std::path::PathBuf;
3
4pub(super) const GATEWAY_BINARY_NAME: &str = "grafbase-gateway";
5pub(super) const CLI_BINARY_NAME: &str = "grafbase";
6
7#[derive(Debug, Clone, Default)]
9pub enum LogLevel {
10 Trace,
12 Debug,
14 #[default]
16 Info,
17 Warn,
19 Error,
21 EngineDebug,
23 EngineTrace,
25 WasiDebug,
27 Custom(String),
29}
30
31impl AsRef<str> for LogLevel {
32 fn as_ref(&self) -> &str {
33 match self {
34 LogLevel::Trace => "trace",
35 LogLevel::Debug => "debug",
36 LogLevel::Info => "info",
37 LogLevel::Warn => "warn",
38 LogLevel::Error => "error",
39 LogLevel::EngineDebug => "engine=debug",
40 LogLevel::EngineTrace => "engine=trace",
41 LogLevel::WasiDebug => "wasi_component_loader=debug",
42 LogLevel::Custom(level) => level.as_str(),
43 }
44 }
45}
46
47impl From<String> for LogLevel {
48 fn from(level: String) -> Self {
49 LogLevel::Custom(level)
50 }
51}
52
53impl From<&str> for LogLevel {
54 fn from(level: &str) -> Self {
55 level.to_string().into()
56 }
57}
58
59#[derive(Debug)]
61pub(super) struct TestConfig {
62 pub(super) gateway_path: PathBuf,
63 pub(super) cli_path: PathBuf,
64 pub(super) extension_path: Option<PathBuf>,
65 pub(super) toml_config: String,
66 pub(super) enable_stdout: Option<bool>,
67 pub(super) enable_stderr: Option<bool>,
68 pub(super) mock_subgraphs: Vec<Subgraph>,
69 pub(super) enable_networking: Option<bool>,
70 pub(super) enable_environment_variables: Option<bool>,
71 pub(super) max_pool_size: Option<usize>,
72 pub(super) log_level: LogLevel,
73 pub(super) stream_stdout_stderr: Option<bool>,
74}