reject overlapping media and database paths

This commit is contained in:
Charles Hall 2025-02-28 11:14:52 -08:00
parent 81a449d1d2
commit b01b70fc20
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
20 changed files with 146 additions and 4 deletions

View file

@ -93,3 +93,21 @@ make_snapshot_test!(
"A config with invalid values fails",
"invalid-values.toml",
);
make_snapshot_test!(
overlapping_paths_equal,
"A config with equal paths fails",
"equal-paths.toml",
);
make_snapshot_test!(
overlapping_paths_media,
"A config with the media path inside the database path fails",
"media-in-database.toml",
);
make_snapshot_test!(
overlapping_paths_database,
"A config with the database path inside the media path fails",
"database-in-media.toml",
);

View file

@ -0,0 +1,12 @@
server_name = "example.com"
[server_discovery]
client.base_url = "https://matrix.example.com"
[database]
backend = "rocksdb"
path = "tests/integrations/fixtures/check_config/dirs/c/a"
[media.backend]
type = "filesystem"
path = "tests/integrations/fixtures/check_config/dirs/c"

View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -0,0 +1,12 @@
server_name = "example.com"
[server_discovery]
client.base_url = "https://matrix.example.com"
[database]
backend = "rocksdb"
path = "tests/integrations/fixtures/check_config/dirs/a"
[media.backend]
type = "filesystem"
path = "tests/integrations/fixtures/check_config/dirs/a"

View file

@ -0,0 +1,12 @@
server_name = "example.com"
[server_discovery]
client.base_url = "https://matrix.example.com"
[database]
backend = "rocksdb"
path = "tests/integrations/fixtures/check_config/dirs/c"
[media.backend]
type = "filesystem"
path = "tests/integrations/fixtures/check_config/dirs/c/a"

View file

@ -5,8 +5,8 @@ client.base_url = "https://matrix.example.com"
[database]
backend = "rocksdb"
path = "/var/lib/grapevine/database"
path = "tests/integrations/fixtures/check_config/dirs/a"
[media.backend]
type = "filesystem"
path = "/var/lib/grapevine/media"
path = "tests/integrations/fixtures/check_config/dirs/b"

View file

@ -10,11 +10,11 @@ client.base_url = "https://matrix.example.com"
[database]
backend = "rocksdb"
path = "/var/lib/grapevine/database"
path = "tests/integrations/fixtures/check_config/dirs/a"
[media.backend]
type = "filesystem"
path = "/var/lib/grapevine/media"
path = "tests/integrations/fixtures/check_config/dirs/b"
[federation]
enable = true

View file

@ -0,0 +1,7 @@
---
source: tests/integrations/check_config.rs
description: A config with the database path inside the media path fails
---
Some(
1,
)

View file

@ -0,0 +1,6 @@
---
source: tests/integrations/check_config.rs
description: A config with the database path inside the media path fails
---
Error: failed to validate configuration
Caused by: database and media paths overlap

View file

@ -0,0 +1,5 @@
---
source: tests/integrations/check_config.rs
description: A config with the database path inside the media path fails
---

View file

@ -0,0 +1,7 @@
---
source: tests/integrations/check_config.rs
description: A config with equal paths fails
---
Some(
1,
)

View file

@ -0,0 +1,6 @@
---
source: tests/integrations/check_config.rs
description: A config with equal paths fails
---
Error: failed to validate configuration
Caused by: database and media paths overlap

View file

@ -0,0 +1,5 @@
---
source: tests/integrations/check_config.rs
description: A config with equal paths fails
---

View file

@ -0,0 +1,7 @@
---
source: tests/integrations/check_config.rs
description: A config with the media path inside the database path fails
---
Some(
1,
)

View file

@ -0,0 +1,6 @@
---
source: tests/integrations/check_config.rs
description: A config with the media path inside the database path fails
---
Error: failed to validate configuration
Caused by: database and media paths overlap

View file

@ -0,0 +1,5 @@
---
source: tests/integrations/check_config.rs
description: A config with the media path inside the database path fails
---