test for single node cluster

This commit is contained in:
Robin Appelman 2025-05-30 16:30:29 +02:00
commit d62e94fd1c
2 changed files with 32 additions and 1 deletions

View file

@ -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();

View 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
),
];