|
|
|
@@ -233,7 +233,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_not_device_failed |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_not_device_id_failed) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"version": "1.0", |
|
|
|
@@ -241,8 +241,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_not_device_id_fai |
|
|
|
"server_list": [ |
|
|
|
{ |
|
|
|
"server_id": "10.155.111.140", |
|
|
|
"device": [ |
|
|
|
{"device_ip": "192.1.27.6","rank_id": "0"}], |
|
|
|
"device": "dsfds", |
|
|
|
"host_nic_ip": "reserve" |
|
|
|
} |
|
|
|
], |
|
|
|
@@ -254,16 +253,36 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_not_device_id_fai |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_id_failed) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_empty_device_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"version": "1.0", |
|
|
|
"server_count": "1", |
|
|
|
"server_list": [ |
|
|
|
{ |
|
|
|
"server_id": "", |
|
|
|
"server_id": "10.155.111.140", |
|
|
|
"device": [], |
|
|
|
"host_nic_ip": "reserve" |
|
|
|
} |
|
|
|
], |
|
|
|
"status": "completed" |
|
|
|
} |
|
|
|
)"_json; |
|
|
|
auto servable = std::make_shared<DistributedServable>(); |
|
|
|
auto status = servable->ParserRankTableWithServerList("rank_table_file", rank_table_server_list); |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_not_device_id_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"version": "1.0", |
|
|
|
"server_count": "1", |
|
|
|
"server_list": [ |
|
|
|
{ |
|
|
|
"server_id": "10.155.111.140", |
|
|
|
"device": [ |
|
|
|
{"device_id": "1wdb","device_ip": "192.1.27.6","rank_id": "0"}], |
|
|
|
{"device_ip": "192.1.27.6","rank_id": "0"}], |
|
|
|
"host_nic_ip": "reserve" |
|
|
|
} |
|
|
|
], |
|
|
|
@@ -275,7 +294,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_id |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_id_failed2) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_id_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"version": "1.0", |
|
|
|
@@ -284,7 +303,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_invalid_device_id |
|
|
|
{ |
|
|
|
"server_id": "", |
|
|
|
"device": [ |
|
|
|
{"device_id": "8","device_ip": "192.1.27.6","rank_id": "0"}], |
|
|
|
{"device_id": "1wdb","device_ip": "192.1.27.6","rank_id": "0"}], |
|
|
|
"host_nic_ip": "reserve" |
|
|
|
} |
|
|
|
], |
|
|
|
@@ -603,7 +622,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_not_de |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_not_device_id_failed) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invalid_devices_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"board_id": "0x0000", |
|
|
|
@@ -612,7 +631,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_not_de |
|
|
|
"instance_count": "1", |
|
|
|
"instance_list": [ |
|
|
|
{ |
|
|
|
"devices": [{"device_ip": "192.1.27.6"}], |
|
|
|
"devices": "rtrt", |
|
|
|
"rank_id": "0", |
|
|
|
"server_id": "10.155.111.140" |
|
|
|
} |
|
|
|
@@ -627,7 +646,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_not_de |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invalid_device_id_failed) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_empty_devices_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"board_id": "0x0000", |
|
|
|
@@ -636,7 +655,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invali |
|
|
|
"instance_count": "1", |
|
|
|
"instance_list": [ |
|
|
|
{ |
|
|
|
"devices": [{"device_id": "wd1gt2", "device_ip": "192.1.27.6"}], |
|
|
|
"devices": [], |
|
|
|
"rank_id": "0", |
|
|
|
"server_id": "10.155.111.140" |
|
|
|
} |
|
|
|
@@ -651,7 +670,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invali |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invalid_device_id_failed2) { |
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_not_device_id_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"board_id": "0x0000", |
|
|
|
@@ -660,7 +679,7 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invali |
|
|
|
"instance_count": "1", |
|
|
|
"instance_list": [ |
|
|
|
{ |
|
|
|
"devices": [{"device_id": "8", "device_ip": "192.1.27.6"}], |
|
|
|
"devices": [{"device_ip": "192.1.27.6"}], |
|
|
|
"rank_id": "0", |
|
|
|
"server_id": "10.155.111.140" |
|
|
|
} |
|
|
|
@@ -671,7 +690,31 @@ TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invali |
|
|
|
} |
|
|
|
)"_json; |
|
|
|
auto servable = std::make_shared<DistributedServable>(); |
|
|
|
auto status = servable->ParserRankTableWithServerList("rank_table_file", rank_table_server_list); |
|
|
|
auto status = servable->ParserRankTableWithGroupList("rank_table_file", rank_table_server_list); |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(TestParseRankTableFile, test_parse_rank_table_file_with_group_list_invalid_device_id_failed) { |
|
|
|
nlohmann::json rank_table_server_list = R"( |
|
|
|
{ |
|
|
|
"board_id": "0x0000", |
|
|
|
"group_list": [ |
|
|
|
{ |
|
|
|
"instance_count": "1", |
|
|
|
"instance_list": [ |
|
|
|
{ |
|
|
|
"devices": [{"device_id": "wd1gt2", "device_ip": "192.1.27.6"}], |
|
|
|
"rank_id": "0", |
|
|
|
"server_id": "10.155.111.140" |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
], |
|
|
|
"status": "completed" |
|
|
|
} |
|
|
|
)"_json; |
|
|
|
auto servable = std::make_shared<DistributedServable>(); |
|
|
|
auto status = servable->ParserRankTableWithGroupList("rank_table_file", rank_table_server_list); |
|
|
|
ASSERT_EQ(status.StatusCode(), INVALID_INPUTS); |
|
|
|
} |
|
|
|
|
|
|
|
|