Skip to content

Commit

Permalink
fix ut test_rpc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinLeeo committed Dec 25, 2024
1 parent ad334ab commit 67f7627
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/restful/server/json_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ inline web::json::value ValueToJson(const std::vector<std::pair<std::string, std
}

inline web::json::value ValueToJson(
const std::vector<std::shared_ptr<lgraph::_detail::FieldExtractorBase>>& fields) {
const std::vector<lgraph::_detail::FieldExtractorBase*> fields) {
auto arr = web::json::value::array();
for (int idx = 0; idx < (int)fields.size(); ++idx) {
web::json::value js;
Expand Down
64 changes: 32 additions & 32 deletions test/test_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,11 +1084,11 @@ void test_label_field(lgraph::RpcClient& client) {

ret = client.CallCypher(str,
"CALL db.alterLabelModFields('vertex', 'animal',"
"['run', 'int8', false], ['jeep', 'int32', true])");
"['run', 'string', false], ['jeep', 'int32', true])");
UT_EXPECT_TRUE(ret);
ret = client.CallCypher(str,
"CALL db.alterLabelModFields('vertex', 'animal_not_exist',['run', "
"'int8', false], ['jeep', 'int32', true])");
"'string', false], ['jeep', 'int32', true])");
UT_EXPECT_FALSE(ret);

ret = client.CallCypher(str, "CALL db.alterLabelModFields('vertex', 'animal')");
Expand All @@ -1097,7 +1097,7 @@ void test_label_field(lgraph::RpcClient& client) {
ret = client.CallCypher(str, "CALL db.getLabelSchema('vertex', 'animal')");
UT_EXPECT_TRUE(ret);
json_val = web::json::value::parse(str);
UT_EXPECT_EQ(CheckElementEqual(json_val, "run", "INT8", "name", "type", "STRING", "STRING"),
UT_EXPECT_EQ(CheckElementEqual(json_val, "run", "STRING", "name", "type", "STRING", "STRING"),
true);
UT_EXPECT_EQ(CheckElementEqual(json_val, "jeep", "INT32", "name", "type", "STRING", "STRING"),
true);
Expand Down Expand Up @@ -2005,38 +2005,38 @@ void* test_rpc_client(void*) {
std::unique_lock<std::mutex> l(lock_rpc);
if (stage_3 == 0) cond.wait(l);
// start test user login
// UT_LOG() << "admin user login";
// {
// RpcClient client3("0.0.0.0:19099", "admin", "73@TuGraph");
// test_float(client3);
// test_cypher(client3);
// test_gql(client3);
// test_label(client3);
// test_relationshipTypes(client3);
// test_index(client3);
// test_warmup(client3);
// test_createlabel(client3);
// test_label_field(client3);
// test_procedure(client3);
// test_graph(client3);
// test_allow_host(client3);
// test_info(client3);
// test_configration(client3);
// }
UT_LOG() << "admin user login";
{
RpcClient client3("0.0.0.0:19099", "admin", "73@TuGraph");
test_float(client3);
test_cypher(client3);
test_gql(client3);
test_label(client3);
test_relationshipTypes(client3);
test_index(client3);
test_warmup(client3);
test_createlabel(client3);
test_label_field(client3);
test_procedure(client3);
test_graph(client3);
test_allow_host(client3);
test_info(client3);
test_configration(client3);
}
{
RpcClient client3("0.0.0.0:19099", "admin", "73@TuGraph");
test_configration_valid(client3);
// test_role(client3);
// test_user(client3);
// test_flushDb(client3);
// test_password(client3);
// test_cpp_procedure(client3);
// #ifndef __SANITIZE_ADDRESS__
// test_python_procedure(client3);
// #endif
// test_import_file(client3);
test_role(client3);
test_user(client3);
test_flushDb(client3);
test_password(client3);
test_cpp_procedure(client3);
#ifndef __SANITIZE_ADDRESS__
test_python_procedure(client3);
#endif
test_import_file(client3);
test_import_content(client3);
// test_procedure_privilege(client3);
test_procedure_privilege(client3);
}

stage_3++;
Expand All @@ -2047,7 +2047,7 @@ void* test_rpc_client(void*) {

class TestRPC : public TuGraphTest {};

TEST_F(TestRPC, DISABLED_RPC) {
TEST_F(TestRPC, RPC) {
// fma_common::Logger::Get().SetLevel(fma_common::LogLevel::LL_DEBUG);
std::thread tid_https[2] = {std::thread(test_rpc_server, nullptr),
std::thread(test_rpc_client, nullptr)};
Expand Down

0 comments on commit 67f7627

Please sign in to comment.