mirror of
https://codeberg.org/icewind/nextcloud-config-parser.git
synced 2026-06-03 08:34:13 +02:00
test for single node cluster
This commit is contained in:
parent
b270299d79
commit
d62e94fd1c
2 changed files with 32 additions and 1 deletions
|
|
@ -340,7 +340,7 @@ fn test_parse_postgres_socket_folder() {
|
|||
fn test_parse_redis_cluster() {
|
||||
let config = config_from_file("tests/configs/redis.cluster.php");
|
||||
let mut addresses = config.redis.addr().cloned().collect::<Vec<_>>();
|
||||
addresses.sort_by(|a, b| format!("{:?}", a).cmp(&format!("{:?}", b)));
|
||||
addresses.sort();
|
||||
assert_debug_equal(
|
||||
vec![
|
||||
parse_redis("redis://:xxx@db1:6380").addr,
|
||||
|
|
@ -354,6 +354,14 @@ fn test_parse_redis_cluster() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_redis_cluster_single() {
|
||||
let config = config_from_file("tests/configs/redis_cluster_single.php");
|
||||
assert!(matches!(config.redis, RedisConfig::Cluster(_)));
|
||||
let addresses = config.redis.addr().cloned().collect::<Vec<_>>();
|
||||
assert_debug_equal(vec![parse_redis("redis://:xxx@db1:6380").addr], addresses);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_config_multiple() {
|
||||
let config = parse_glob("tests/configs/multiple/config.php").unwrap();
|
||||
|
|
|
|||
23
tests/configs/redis_cluster_single.php
Normal file
23
tests/configs/redis_cluster_single.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$CONFIG = [
|
||||
'overwrite.cli.url' => 'https://cloud.example.com',
|
||||
'dbtype' => 'mysql',
|
||||
'dbname' => 'nextcloud',
|
||||
'dbhost' => '127.0.0.1',
|
||||
'dbport' => '',
|
||||
'dbtableprefix' => 'oc_',
|
||||
'dbuser' => 'nextcloud',
|
||||
'dbpassword' => 'secret',
|
||||
'redis.cluster' =>
|
||||
array (
|
||||
'seeds' =>
|
||||
array (
|
||||
0 => 'db1:6380',
|
||||
),
|
||||
'password' => 'xxx',
|
||||
'timeout' => 0.0,
|
||||
'read_timeout' => 0.0,
|
||||
'failover_mode' => \RedisCluster::FAILOVER_ERROR
|
||||
),
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue