diff --git a/src/meta/test/GroupZoneTest.cpp b/src/meta/test/GroupZoneTest.cpp index 7c3ed7d1977..564cb1f7955 100644 --- a/src/meta/test/GroupZoneTest.cpp +++ b/src/meta/test/GroupZoneTest.cpp @@ -275,28 +275,6 @@ TEST(GroupAndZoneTest, GroupAndZoneTest) { auto resp = std::move(f).get(); ASSERT_EQ(nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND, resp.get_code()); } -// Drop host from zone -{ - cpp2::DropHostFromZoneReq req; - req.set_zone_name("zone_0"); - HostAddr node{"12", 12}; - req.set_node(std::move(node)); - auto* processor = DropHostFromZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::E_CONFLICT, resp.get_code()); -} -{ - cpp2::DropSpaceReq req; - req.set_space_name("space"); - req.set_if_exists(false); - auto* processor = DropSpaceProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} { cpp2::DropHostFromZoneReq req; req.set_zone_name("zone_0"); diff --git a/src/meta/test/MetaClientTest.cpp b/src/meta/test/MetaClientTest.cpp index e1cfbdc9890..1a8c6a9318f 100644 --- a/src/meta/test/MetaClientTest.cpp +++ b/src/meta/test/MetaClientTest.cpp @@ -410,45 +410,6 @@ TEST(MetaClientTest, SpaceWithGroupTest) { ret = client->createSpace(spaceDesc, true).get(); ASSERT_TRUE(ret.ok()) << ret.status(); } -// Create Space on group_0, replica factor is equal with zone size -{ - meta::cpp2::SpaceDesc spaceDesc; - spaceDesc.set_space_name("space_on_group_0_3"); - spaceDesc.set_partition_num(9); - spaceDesc.set_replica_factor(3); - spaceDesc.set_group_name("group_0"); - auto ret = client->createSpace(spaceDesc).get(); - ASSERT_TRUE(ret.ok()) << ret.status(); - - ret = client->createSpace(spaceDesc, true).get(); - ASSERT_TRUE(ret.ok()) << ret.status(); -} -// Create Space on group_0, replica factor is less than zone size -{ - meta::cpp2::SpaceDesc spaceDesc; - spaceDesc.set_space_name("space_on_group_0_1"); - spaceDesc.set_partition_num(9); - spaceDesc.set_replica_factor(1); - spaceDesc.set_group_name("group_0"); - auto ret = client->createSpace(spaceDesc).get(); - ASSERT_TRUE(ret.ok()) << ret.status(); - - ret = client->createSpace(spaceDesc, true).get(); - ASSERT_TRUE(ret.ok()) << ret.status(); -} -// Create Space on a group which is not exist -{ - meta::cpp2::SpaceDesc spaceDesc; - spaceDesc.set_space_name("space_on_group_not_exist"); - spaceDesc.set_partition_num(9); - spaceDesc.set_replica_factor(4); - spaceDesc.set_group_name("group_not_exist"); - auto ret = client->createSpace(spaceDesc).get(); - ASSERT_FALSE(ret.ok()) << ret.status(); - - ret = client->createSpace(spaceDesc, true).get(); - ASSERT_FALSE(ret.ok()) << ret.status(); -} } // namespace nebula TEST(MetaClientTest, TagTest) { diff --git a/src/meta/test/ProcessorTest.cpp b/src/meta/test/ProcessorTest.cpp index 6776a7f6176..f42f5d4a5d9 100644 --- a/src/meta/test/ProcessorTest.cpp +++ b/src/meta/test/ProcessorTest.cpp @@ -463,163 +463,6 @@ TEST(ProcessorTest, SpaceTest) { } } -TEST(ProcessorTest, SpaceWithGroupTest) { - fs::TempDir rootPath("/tmp/SpaceWithGroupTest.XXXXXX"); - std::unique_ptr kv(MockCluster::initMetaKV(rootPath.path())); - std::vector addresses; - for (int32_t i = 0; i <= 10; i++) { - addresses.emplace_back(std::to_string(i), i); - } - TestUtils::createSomeHosts(kv.get(), std::move(addresses)); - - // Add Zones - {{std::vector nodes; - for (int32_t i = 0; i < 2; i++) { - nodes.emplace_back(std::to_string(i), i); - } - cpp2::AddZoneReq req; - req.set_zone_name("zone_0"); - req.set_nodes(std::move(nodes)); - auto* processor = AddZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -{ - std::vector nodes; - for (int32_t i = 2; i < 4; i++) { - nodes.emplace_back(std::to_string(i), i); - } - cpp2::AddZoneReq req; - req.set_zone_name("zone_1"); - req.set_nodes(std::move(nodes)); - auto* processor = AddZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -{ - std::vector nodes; - for (int32_t i = 4; i < 6; i++) { - nodes.emplace_back(std::to_string(i), i); - } - cpp2::AddZoneReq req; - req.set_zone_name("zone_2"); - req.set_nodes(std::move(nodes)); - auto* processor = AddZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -{ - std::vector nodes; - for (int32_t i = 6; i < 8; i++) { - nodes.emplace_back(std::to_string(i), i); - } - cpp2::AddZoneReq req; - req.set_zone_name("zone_3"); - req.set_nodes(std::move(nodes)); - auto* processor = AddZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -{ - std::vector nodes; - for (int32_t i = 8; i < 10; i++) { - nodes.emplace_back(std::to_string(i), i); - } - cpp2::AddZoneReq req; - req.set_zone_name("zone_4"); - req.set_nodes(std::move(nodes)); - auto* processor = AddZoneProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -} // namespace meta -// List Zones -{ - cpp2::ListZonesReq req; - auto* processor = ListZonesProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); - ASSERT_EQ(5, resp.get_zones().size()); - ASSERT_EQ("zone_0", resp.get_zones()[0].get_zone_name()); - ASSERT_EQ("zone_1", resp.get_zones()[1].get_zone_name()); - ASSERT_EQ("zone_2", resp.get_zones()[2].get_zone_name()); - ASSERT_EQ("zone_3", resp.get_zones()[3].get_zone_name()); - ASSERT_EQ("zone_4", resp.get_zones()[4].get_zone_name()); -} - -// Create Space without Group -{ - cpp2::SpaceDesc properties; - properties.set_space_name("default_space"); - properties.set_partition_num(9); - properties.set_replica_factor(3); - cpp2::CreateSpaceReq req; - req.set_properties(std::move(properties)); - auto* processor = CreateSpaceProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -// Create Space on group_0, replica factor is equal with zone size -{ - cpp2::SpaceDesc properties; - properties.set_space_name("space_on_group_0_3"); - properties.set_partition_num(9); - properties.set_replica_factor(3); - properties.set_group_name("group_0"); - cpp2::CreateSpaceReq req; - req.set_properties(std::move(properties)); - auto* processor = CreateSpaceProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -// Create Space on group_0, replica factor is less than zone size -{ - cpp2::SpaceDesc properties; - properties.set_space_name("space_on_group_0_1"); - properties.set_partition_num(9); - properties.set_replica_factor(1); - properties.set_group_name("group_0"); - cpp2::CreateSpaceReq req; - req.set_properties(std::move(properties)); - auto* processor = CreateSpaceProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, resp.get_code()); -} -// Create Space on a group which is not exist -{ - cpp2::SpaceDesc properties; - properties.set_space_name("space_on_group_not_exist"); - properties.set_partition_num(9); - properties.set_replica_factor(4); - properties.set_group_name("group_not_exist"); - cpp2::CreateSpaceReq req; - req.set_properties(std::move(properties)); - auto* processor = CreateSpaceProcessor::instance(kv.get()); - auto f = processor->getFuture(); - processor->process(req); - auto resp = std::move(f).get(); - ASSERT_EQ(nebula::cpp2::ErrorCode::E_GROUP_NOT_FOUND, resp.get_code()); -} -} // namespace nebula - TEST(ProcessorTest, CreateTagTest) { fs::TempDir rootPath("/tmp/CreateTagTest.XXXXXX"); auto kv = MockCluster::initMetaKV(rootPath.path()); diff --git a/src/parser/test/ParserTest.cpp b/src/parser/test/ParserTest.cpp index 5267339a4c2..f1249614e67 100644 --- a/src/parser/test/ParserTest.cpp +++ b/src/parser/test/ParserTest.cpp @@ -2710,11 +2710,6 @@ TEST_F(ParserTest, MatchListSubscriptRange) { } TEST_F(ParserTest, Zone) { - { - std::string query = "SHOW GROUPS"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } { std::string query = "SHOW ZONES"; auto result = parse(query); @@ -2750,36 +2745,6 @@ TEST_F(ParserTest, Zone) { auto result = parse(query); ASSERT_TRUE(result.ok()) << result.status(); } - { - std::string query = "ADD GROUP group_0 zone_0,zone_1,zone_2"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } - { - std::string query = "ADD ZONE zone_3 INTO GROUP group_0"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } - { - std::string query = "DROP ZONE zone_3 FROM GROUP group_0"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } - { - std::string query = "DESC GROUP group_0"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } - { - std::string query = "DESCRIBE GROUP group_0"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } - { - std::string query = "DROP GROUP group_0"; - auto result = parse(query); - ASSERT_TRUE(result.ok()) << result.status(); - } } TEST_F(ParserTest, FullText) { diff --git a/tests/maintain/test_zone.py b/tests/maintain/test_zone.py index bfa504d6bc6..9e74d876af9 100644 --- a/tests/maintain/test_zone.py +++ b/tests/maintain/test_zone.py @@ -36,39 +36,6 @@ def test_zone(self): resp = self.client.execute('SHOW ZONES') self.check_resp_succeeded(resp) - # Add Group - resp = self.client.execute('ADD GROUP group_0 zone_0') - self.check_resp_succeeded(resp) - - resp = self.client.execute('ADD GROUP default zone_0') - self.check_resp_failed(resp) - - # Get Group - resp = self.client.execute('DESC GROUP group_0') - self.check_resp_succeeded(resp) - - resp = self.client.execute('DESCRIBE GROUP group_0') - self.check_resp_succeeded(resp) - - # Get Group which is not exist - resp = self.client.execute('DESC GROUP group_not_exist') - self.check_resp_failed(resp) - - resp = self.client.execute('DESCRIBE GROUP group_not_exist') - self.check_resp_failed(resp) - - # SHOW Groups - resp = self.client.execute('SHOW GROUPS') - self.check_resp_succeeded(resp) - - # Drop Group - resp = self.client.execute('DROP GROUP group_0') - self.check_resp_succeeded(resp) - - # Drop Group which is not exist - resp = self.client.execute('DROP GROUP group_0') - self.check_resp_failed(resp) - # Drop Zone resp = self.client.execute('DROP ZONE zone_0') self.check_resp_succeeded(resp)