mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
Add a "check-config" command to validate config files & tests for it
This commit is contained in:
parent
70ee206031
commit
26ba489aa3
24 changed files with 492 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid keys fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
1,
|
||||
)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid keys fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
Error: failed to validate configuration
|
||||
Caused by: failed to parse configuration file "tests/integrations/fixtures/check_config/invalid-keys.toml"
|
||||
Caused by: TOML parse error at line 1, column 1
|
||||
|
|
||||
1 | some_name = "example.com"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
missing field `server_name`
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid keys fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid values fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
1,
|
||||
)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid values fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
Error: failed to validate configuration
|
||||
Caused by: failed to parse configuration file "tests/integrations/fixtures/check_config/invalid-values.toml"
|
||||
Caused by: TOML parse error at line 1, column 15
|
||||
|
|
||||
1 | server_name = 6667
|
||||
| ^^^^
|
||||
invalid type: integer `6667`, expected a string
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A config with invalid values fails
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A configuration containing only the required keys is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
0,
|
||||
)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A configuration containing only the required keys is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
"fields": {
|
||||
"message": "Configuration looks good"
|
||||
},
|
||||
"level": "INFO",
|
||||
"target": "grapevine::cli::check_config",
|
||||
"timestamp": "[timestamp]"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A configuration containing only the required keys is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A normal config is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
0,
|
||||
)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A normal config is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
"fields": {
|
||||
"message": "Configuration looks good"
|
||||
},
|
||||
"level": "INFO",
|
||||
"target": "grapevine::cli::check_config",
|
||||
"timestamp": "[timestamp]"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: tests/integrations/check_config.rs
|
||||
description: A normal config is valid
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue