Skip to content

Commit ebaa7a7

Browse files
committed
redis acl: temporary fix unittest
1 parent 2b2d5eb commit ebaa7a7

8 files changed

+13
-10
lines changed

common/database_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"INSTANCES": {
33
"redis":{
44
"hostname" : "127.0.0.1",
5-
"port" : 980,
5+
"port" : 6379,
66
"unix_socket_path" : "/var/run/redis/redis.sock"
77
},
88
"redis_chassis":{

common/dbinterface.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class DBInterface
106106

107107
std::string m_unix_socket_path;
108108
std::string m_host = "127.0.0.1";
109-
int m_port = 980;
109+
int m_port = 6379;
110110
};
111111

112112
}

common/rediscommand.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ size_t RedisCommand::length() const
148148
{
149149
if (len <= 0)
150150
return 0;
151+
// TODO review this casting
151152
return static_cast<size_t>(len);
152153
}
153154

tests/redis_multi_db_ut_config/database_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"INSTANCES": {
33
"redis":{
44
"hostname" : "127.0.0.1",
5-
"port": 980,
5+
"port": 6379,
66
"unix_socket_path": "/var/run/redis/redis.sock"
77
},
88
"redis1":{

tests/redis_multi_db_ut_config/database_config0.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"INSTANCES": {
33
"redis":{
44
"hostname" : "127.0.0.1",
5-
"port": 980,
5+
"port": 6379,
66
"unix_socket_path": "/var/run/redis0/redis.sock"
77
}
88
},

tests/redis_multi_db_ut_config/database_config1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"INSTANCES": {
33
"redis":{
44
"hostname" : "127.0.0.1",
5-
"port": 980,
5+
"port": 6379,
66
"unix_socket_path": "/var/run/redis1/redis.sock"
77
}
88
},

tests/redis_ut.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void TableBasicTest(string tableName, bool useDbId = false)
156156
int dbId = db1.getDbId();
157157

158158
// Use dbId to construct a DBConnector
159-
DBConnector db_dup(dbId, "localhost", 980, 0);
159+
DBConnector db_dup(dbId, "localhost", 6379, 0);
160160
cout << "db_dup separator: " << SonicDBConfig::getSeparator(&db_dup) << endl;
161161

162162
if (useDbId)
@@ -318,7 +318,7 @@ TEST(DBConnector, RedisClientName)
318318
TEST(DBConnector, DBInterface)
319319
{
320320
DBInterface dbintf;
321-
dbintf.set_redis_kwargs("", "127.0.0.1", 980);
321+
dbintf.set_redis_kwargs("", "127.0.0.1", 6379);
322322
dbintf.connect(15, "TEST_DB");
323323

324324
SonicV2Connector_Native db;
@@ -851,8 +851,10 @@ TEST(Table, binary_data_get)
851851
DBConnector db("TEST_DB", 0, true);
852852
Table table(&db, "binary_data");
853853

854-
const char* bindata1 = "\x11\x00\x22\x33\x44";
855-
const char* bindata2 = "\x11\x22\x33\x00\x44";
854+
// const char* bindata1 = "\x11\x00\x22\x33\x44";
855+
// const char* bindata2 = "\x11\x22\x33\x00\x44";
856+
const char bindata1[] = "\x11\x00\x22\x33\x44";
857+
const char bindata2[] = "\x11\x22\x33\x00\x44";
856858
auto v1 = std::string(bindata1, sizeof(bindata1));
857859
auto v2 = std::string(bindata2, sizeof(bindata2));
858860
vector<FieldValueTuple> values_set = {

tests/test_redis_ut.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def thread_coming_data():
197197

198198
def test_DBInterface():
199199
dbintf = DBInterface()
200-
dbintf.set_redis_kwargs("", "127.0.0.1", 980)
200+
dbintf.set_redis_kwargs("", "127.0.0.1", 6379)
201201
dbintf.connect(15, "TEST_DB")
202202

203203
db = SonicV2Connector(use_unix_socket_path=True, namespace='')

0 commit comments

Comments
 (0)