diff --git a/tests/cli_ut.cpp b/tests/cli_ut.cpp index 39c80ceea..bde4e3ebf 100755 --- a/tests/cli_ut.cpp +++ b/tests/cli_ut.cpp @@ -380,7 +380,7 @@ TEST(sonic_db_cli, test_cli_multi_ns_cmd) char *args[7]; args[0] = "sonic-db-cli"; args[1] = "-n"; - args[2] = "asic0"; + args[2] = "asic2"; args[3] = "TEST_DB"; // set key to test DB @@ -409,7 +409,7 @@ TEST(sonic_db_cli, test_cli_unix_socket_cmd) args[0] = "sonic-db-cli"; args[1] = "-s"; args[2] = "-n"; - args[3] = "asic0"; + args[3] = "asic2"; args[4] = "TEST_DB"; // set key to test DB @@ -431,7 +431,7 @@ TEST(sonic_db_cli, test_cli_eval_cmd) char *args[11]; args[0] = "sonic-db-cli"; args[1] = "-n"; - args[2] = "asic0"; + args[2] = "asic2"; args[3] = "TEST_DB"; // run eval command: EVAL "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 k1 k2 v1 v2 @@ -450,24 +450,24 @@ TEST(sonic_db_cli, test_parallel_cmd) { char *args[7]; args[0] = "sonic-db-cli"; args[1] = "-n"; - args[2] = "asic0"; + args[2] = "asic2"; args[4] = "SAVE"; - auto db_names = swss::SonicDBConfig::getDbList("asic0"); + auto db_names = swss::SonicDBConfig::getDbList("asic2"); for (auto& db_name : db_names) { - generateTestData("asic0", const_cast(db_name.c_str())); + generateTestData("asic2", const_cast(db_name.c_str())); } - db_names = swss::SonicDBConfig::getDbList("asic1"); + db_names = swss::SonicDBConfig::getDbList("asic3"); for (auto& db_name : db_names) { - generateTestData("asic1", const_cast(db_name.c_str())); + generateTestData("asic3", const_cast(db_name.c_str())); } // save 2 DBs and get save DB performance auto begin_time = clock(); - db_names = swss::SonicDBConfig::getDbList("asic0"); - args[2] = "asic0"; + db_names = swss::SonicDBConfig::getDbList("asic2"); + args[2] = "asic2"; for (auto& db_name : db_names) { args[3] = const_cast(db_name.c_str()); @@ -475,8 +475,8 @@ TEST(sonic_db_cli, test_parallel_cmd) { sonic_db_cli(5, args); } - db_names = swss::SonicDBConfig::getDbList("asic1"); - args[2] = "asic1"; + db_names = swss::SonicDBConfig::getDbList("asic3"); + args[2] = "asic3"; for (auto& db_name : db_names) { args[3] = const_cast(db_name.c_str()); @@ -487,15 +487,15 @@ TEST(sonic_db_cli, test_parallel_cmd) { auto sequential_time = float( clock () - begin_time ); // prepare data - db_names = swss::SonicDBConfig::getDbList("asic0"); + db_names = swss::SonicDBConfig::getDbList("asic2"); for (auto& db_name : db_names) { - generateTestData("asic0", const_cast(db_name.c_str())); + generateTestData("asic2", const_cast(db_name.c_str())); } - db_names = swss::SonicDBConfig::getDbList("asic1"); + db_names = swss::SonicDBConfig::getDbList("asic3"); for (auto& db_name : db_names) { - generateTestData("asic0", const_cast(db_name.c_str())); + generateTestData("asic3", const_cast(db_name.c_str())); } // save 2 DBs in parallel, and get save DB performance diff --git a/tests/redis_multi_db_ut_config/database_config0.json b/tests/redis_multi_db_ut_config/database_config0.json index e7cc0efb2..45606fc3a 100644 --- a/tests/redis_multi_db_ut_config/database_config0.json +++ b/tests/redis_multi_db_ut_config/database_config0.json @@ -3,7 +3,7 @@ "redis":{ "hostname" : "127.0.0.1", "port": 6379, - "unix_socket_path": "/var/run/redis/redis.sock" + "unix_socket_path": "/var/run/redis0/redis.sock" } }, "DATABASES" : { diff --git a/tests/redis_multi_db_ut_config/database_config2.json b/tests/redis_multi_db_ut_config/database_config2.json new file mode 100644 index 000000000..e7cc0efb2 --- /dev/null +++ b/tests/redis_multi_db_ut_config/database_config2.json @@ -0,0 +1,97 @@ +{ + "INSTANCES": { + "redis":{ + "hostname" : "127.0.0.1", + "port": 6379, + "unix_socket_path": "/var/run/redis/redis.sock" + } + }, + "DATABASES" : { + "APPL_DB" : { + "id" : 0, + "separator": ":", + "instance" : "redis" + }, + "ASIC_DB" : { + "id" : 1, + "separator": ":", + "instance" : "redis" + }, + "COUNTERS_DB" : { + "id" : 2, + "separator": ":", + "instance" : "redis" + }, + "LOGLEVEL_DB" : { + "id" : 3, + "separator": ":", + "instance" : "redis" + }, + "CONFIG_DB" : { + "id" : 4, + "separator": "|", + "instance" : "redis" + }, + "PFC_WD_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "FLEX_COUNTER_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "STATE_DB" : { + "id" : 6, + "separator": "|", + "instance" : "redis" + }, + "SNMP_OVERLAY_DB" : { + "id" : 7, + "separator": "|", + "instance" : "redis" + }, + "RESTAPI_DB": { + "id": 8, + "separator": "|", + "instance": "redis" + }, + "GB_ASIC_DB": { + "id": 9, + "separator": ":", + "instance": "redis" + }, + "GB_COUNTERS_DB": { + "id": 10, + "separator": ":", + "instance": "redis" + }, + "GB_FLEX_COUNTER_DB": { + "id": 11, + "separator": ":", + "instance": "redis" + }, + "PROFILE_DB" : { + "id" : 12, + "separator": "|", + "instance" : "redis" + }, + "STATE_DB2" : { + "id" : 13, + "separator": "|", + "instance" : "redis" + }, + "APPL_STATE_DB" : { + "id" : 14, + "separator": ":", + "instance" : "redis" + }, + "TEST_DB" : { + "id" : 15, + "separator": ":", + "instance" : "redis" + } + }, + "VERSION" : "1.0" +} diff --git a/tests/redis_multi_db_ut_config/database_config3.json b/tests/redis_multi_db_ut_config/database_config3.json new file mode 100644 index 000000000..e7cc0efb2 --- /dev/null +++ b/tests/redis_multi_db_ut_config/database_config3.json @@ -0,0 +1,97 @@ +{ + "INSTANCES": { + "redis":{ + "hostname" : "127.0.0.1", + "port": 6379, + "unix_socket_path": "/var/run/redis/redis.sock" + } + }, + "DATABASES" : { + "APPL_DB" : { + "id" : 0, + "separator": ":", + "instance" : "redis" + }, + "ASIC_DB" : { + "id" : 1, + "separator": ":", + "instance" : "redis" + }, + "COUNTERS_DB" : { + "id" : 2, + "separator": ":", + "instance" : "redis" + }, + "LOGLEVEL_DB" : { + "id" : 3, + "separator": ":", + "instance" : "redis" + }, + "CONFIG_DB" : { + "id" : 4, + "separator": "|", + "instance" : "redis" + }, + "PFC_WD_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "FLEX_COUNTER_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "STATE_DB" : { + "id" : 6, + "separator": "|", + "instance" : "redis" + }, + "SNMP_OVERLAY_DB" : { + "id" : 7, + "separator": "|", + "instance" : "redis" + }, + "RESTAPI_DB": { + "id": 8, + "separator": "|", + "instance": "redis" + }, + "GB_ASIC_DB": { + "id": 9, + "separator": ":", + "instance": "redis" + }, + "GB_COUNTERS_DB": { + "id": 10, + "separator": ":", + "instance": "redis" + }, + "GB_FLEX_COUNTER_DB": { + "id": 11, + "separator": ":", + "instance": "redis" + }, + "PROFILE_DB" : { + "id" : 12, + "separator": "|", + "instance" : "redis" + }, + "STATE_DB2" : { + "id" : 13, + "separator": "|", + "instance" : "redis" + }, + "APPL_STATE_DB" : { + "id" : 14, + "separator": ":", + "instance" : "redis" + }, + "TEST_DB" : { + "id" : 15, + "separator": ":", + "instance" : "redis" + } + }, + "VERSION" : "1.0" +} diff --git a/tests/redis_multi_db_ut_config/database_global.json b/tests/redis_multi_db_ut_config/database_global.json index 3f66a74b5..fa0879af1 100644 --- a/tests/redis_multi_db_ut_config/database_global.json +++ b/tests/redis_multi_db_ut_config/database_global.json @@ -10,6 +10,14 @@ { "namespace" : "asic1", "include" : "../redis_multi_db_ut_config/database_config1.json" + }, + { + "namespace" : "asic2", + "include" : "../redis_multi_db_ut_config/database_config2.json" + }, + { + "namespace" : "asic3", + "include" : "../redis_multi_db_ut_config/database_config3.json" } ], "VERSION" : "1.0"