Skip to content

Commit

Permalink
fix tck error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
codesigner committed Nov 29, 2022
1 parent 14f9e61 commit 0f98d29
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 41 deletions.
54 changes: 27 additions & 27 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ Status MetaClient::handleResponse(const RESP& resp) {
case nebula::cpp2::ErrorCode::E_EXISTED:
return Status::Error("Existed!");
case nebula::cpp2::ErrorCode::E_SPACE_NOT_FOUND:
return Status::SpaceNotFound("Space not existed!");
return Status::Error("Space not existed!");
case nebula::cpp2::ErrorCode::E_TAG_NOT_FOUND:
return Status::TagNotFound("Tag not existed!");
case nebula::cpp2::ErrorCode::E_EDGE_NOT_FOUND:
Expand Down Expand Up @@ -1389,7 +1389,7 @@ StatusOr<GraphSpaceID> MetaClient::getSpaceIdByNameFromCache(const std::string&
if (it != metadata.spaceIndexByName_.end()) {
return it->second;
}
return Status::SpaceNotFound(fmt::format("Space {} not found", name));
return Status::SpaceNotFound(fmt::format("SpaceName `{}`", name));
}

StatusOr<std::string> MetaClient::getSpaceNameByIdFromCache(GraphSpaceID spaceId) {
Expand All @@ -1401,7 +1401,7 @@ StatusOr<std::string> MetaClient::getSpaceNameByIdFromCache(GraphSpaceID spaceId
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
LOG(ERROR) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
return spaceIt->second->spaceDesc_.get_space_name();
}
Expand All @@ -1415,7 +1415,7 @@ StatusOr<TagID> MetaClient::getTagIDByNameFromCache(const GraphSpaceID& space,
const auto& metadata = *metadata_.load();
auto it = metadata.spaceTagIndexByName_.find(std::make_pair(space, name));
if (it == metadata.spaceTagIndexByName_.end()) {
return Status::TagNotFound(fmt::format("TagName `{}` is nonexistent", name));
return Status::TagNotFound(fmt::format("TagName `{}`", name));
}
return it->second;
}
Expand All @@ -1429,7 +1429,7 @@ StatusOr<std::string> MetaClient::getTagNameByIdFromCache(const GraphSpaceID& sp
const auto& metadata = *metadata_.load();
auto it = metadata.spaceTagIndexById_.find(std::make_pair(space, tagId));
if (it == metadata.spaceTagIndexById_.end()) {
return Status::TagNotFound(fmt::format("TagID `{}` is nonexistent", tagId));
return Status::TagNotFound(fmt::format("TagID `{}`", tagId));
}
return it->second;
}
Expand All @@ -1443,7 +1443,7 @@ StatusOr<EdgeType> MetaClient::getEdgeTypeByNameFromCache(const GraphSpaceID& sp
const auto& metadata = *metadata_.load();
auto it = metadata.spaceEdgeIndexByName_.find(std::make_pair(space, name));
if (it == metadata.spaceEdgeIndexByName_.end()) {
return Status::EdgeNotFound(fmt::format("EdgeName `{}` is nonexistent", name));
return Status::EdgeNotFound(fmt::format("EdgeName `{}`", name));
}
return it->second;
}
Expand All @@ -1457,7 +1457,7 @@ StatusOr<std::string> MetaClient::getEdgeNameByTypeFromCache(const GraphSpaceID&
const auto& metadata = *metadata_.load();
auto it = metadata.spaceEdgeIndexByType_.find(std::make_pair(space, edgeType));
if (it == metadata.spaceEdgeIndexByType_.end()) {
return Status::EdgeNotFound(fmt::format("EdgeType `{}` is nonexistent", edgeType));
return Status::EdgeNotFound(fmt::format("EdgeType `{}`", edgeType));
}
return it->second;
}
Expand All @@ -1470,7 +1470,7 @@ StatusOr<std::vector<std::string>> MetaClient::getAllEdgeFromCache(const GraphSp
const auto& metadata = *metadata_.load();
auto it = metadata.spaceAllEdgeMap_.find(space);
if (it == metadata.spaceAllEdgeMap_.end()) {
return Status::SpaceNotFound(fmt::format("Space {} not found", space));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", space));
}
return it->second;
}
Expand Down Expand Up @@ -1542,7 +1542,7 @@ StatusOr<int32_t> MetaClient::partsNum(GraphSpaceID spaceId) {
const auto& metadata = *metadata_.load();
auto it = metadata.localCache_.find(spaceId);
if (it == metadata.localCache_.end()) {
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
return it->second->partsAlloc_.size();
}
Expand Down Expand Up @@ -1937,7 +1937,7 @@ StatusOr<int32_t> MetaClient::getSpaceVidLen(const GraphSpaceID& spaceId) {
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
LOG(ERROR) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
auto& vidType = spaceIt->second->spaceDesc_.get_vid_type();
auto vIdLen = vidType.type_length_ref().has_value() ? *vidType.get_type_length() : 0;
Expand All @@ -1956,7 +1956,7 @@ StatusOr<nebula::cpp2::PropertyType> MetaClient::getSpaceVidType(const GraphSpac
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
LOG(ERROR) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
auto vIdType = spaceIt->second->spaceDesc_.get_vid_type().get_type();
if (vIdType != nebula::cpp2::PropertyType::INT64 &&
Expand All @@ -1969,16 +1969,16 @@ StatusOr<nebula::cpp2::PropertyType> MetaClient::getSpaceVidType(const GraphSpac
return vIdType;
}

StatusOr<cpp2::SpaceDesc> MetaClient::getSpaceDesc(const GraphSpaceID& space) {
StatusOr<cpp2::SpaceDesc> MetaClient::getSpaceDesc(const GraphSpaceID& spaceId) {
if (!ready_) {
return Status::Error("Not ready!");
}
folly::rcu_reader guard;
const auto& metadata = *metadata_.load();
auto spaceIt = metadata.localCache_.find(space);
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
LOG(ERROR) << "Space " << space << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", space));
LOG(ERROR) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
return spaceIt->second->spaceDesc_;
}
Expand Down Expand Up @@ -2042,7 +2042,7 @@ StatusOr<TagSchemas> MetaClient::getAllVerTagSchema(GraphSpaceID spaceId) {
const auto& metadata = *metadata_.load();
auto iter = metadata.localCache_.find(spaceId);
if (iter == metadata.localCache_.end()) {
return Status::SpaceNotFound("Space %d not found", spaceId);
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
return iter->second->tagSchemas_;
}
Expand All @@ -2055,7 +2055,7 @@ StatusOr<TagSchema> MetaClient::getAllLatestVerTagSchema(const GraphSpaceID& spa
const auto& metadata = *metadata_.load();
auto iter = metadata.localCache_.find(spaceId);
if (iter == metadata.localCache_.end()) {
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
TagSchema tagsSchema;
tagsSchema.reserve(iter->second->tagSchemas_.size());
Expand All @@ -2074,7 +2074,7 @@ StatusOr<EdgeSchemas> MetaClient::getAllVerEdgeSchema(GraphSpaceID spaceId) {
const auto& metadata = *metadata_.load();
auto iter = metadata.localCache_.find(spaceId);
if (iter == metadata.localCache_.end()) {
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
return iter->second->edgeSchemas_;
}
Expand All @@ -2087,7 +2087,7 @@ StatusOr<EdgeSchema> MetaClient::getAllLatestVerEdgeSchemaFromCache(const GraphS
const auto& metadata = *metadata_.load();
auto iter = metadata.localCache_.find(spaceId);
if (iter == metadata.localCache_.end()) {
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
}
EdgeSchema edgesSchema;
edgesSchema.reserve(iter->second->edgeSchemas_.size());
Expand Down Expand Up @@ -2140,7 +2140,7 @@ StatusOr<std::shared_ptr<cpp2::IndexItem>> MetaClient::getTagIndexByNameFromCach
std::pair<GraphSpaceID, std::string> key(space, name);
auto iter = tagNameIndexMap_.find(key);
if (iter == tagNameIndexMap_.end()) {
return Status::IndexNotFound(fmt::format("Index {}:{} not found", space, name));
return Status::IndexNotFound(fmt::format("Index: {}:{}", space, name));
}
auto indexID = iter->second;
auto itemStatus = getTagIndexFromCache(space, indexID);
Expand All @@ -2158,7 +2158,7 @@ StatusOr<std::shared_ptr<cpp2::IndexItem>> MetaClient::getEdgeIndexByNameFromCac
std::pair<GraphSpaceID, std::string> key(space, name);
auto iter = edgeNameIndexMap_.find(key);
if (iter == edgeNameIndexMap_.end()) {
return Status::IndexNotFound(fmt::format("Index {}:{} not found", space, name));
return Status::IndexNotFound(fmt::format("Index: {}:{}", space, name));
}
auto indexID = iter->second;
auto itemStatus = getEdgeIndexFromCache(space, indexID);
Expand All @@ -2179,7 +2179,7 @@ StatusOr<std::shared_ptr<cpp2::IndexItem>> MetaClient::getTagIndexFromCache(Grap
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
VLOG(3) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
} else {
auto iter = spaceIt->second->tagIndexes_.find(indexID);
if (iter == spaceIt->second->tagIndexes_.end()) {
Expand Down Expand Up @@ -2217,12 +2217,12 @@ StatusOr<std::shared_ptr<cpp2::IndexItem>> MetaClient::getEdgeIndexFromCache(Gra
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
VLOG(3) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
} else {
auto iter = spaceIt->second->edgeIndexes_.find(indexId);
if (iter == spaceIt->second->edgeIndexes_.end()) {
VLOG(3) << "Space " << spaceId << ", Edge Index " << indexId << " not found!";
return Status::IndexNotFound(fmt::format("Index {}:{} not found", spaceId, indexId));
return Status::IndexNotFound(fmt::format("Index: {}:{}", spaceId, indexId));
} else {
return iter->second;
}
Expand Down Expand Up @@ -2255,7 +2255,7 @@ StatusOr<std::vector<std::shared_ptr<cpp2::IndexItem>>> MetaClient::getTagIndexe
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
VLOG(3) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
} else {
auto tagIndexes = spaceIt->second->tagIndexes_;
auto iter = tagIndexes.begin();
Expand All @@ -2279,7 +2279,7 @@ StatusOr<std::vector<std::shared_ptr<cpp2::IndexItem>>> MetaClient::getEdgeIndex
auto spaceIt = metadata.localCache_.find(spaceId);
if (spaceIt == metadata.localCache_.end()) {
VLOG(3) << "Space " << spaceId << " not found!";
return Status::SpaceNotFound(fmt::format("Space {} not found", spaceId));
return Status::SpaceNotFound(fmt::format("SpaceId `{}`", spaceId));
} else {
auto edgeIndexes = spaceIt->second->edgeIndexes_;
auto iter = edgeIndexes.begin();
Expand Down Expand Up @@ -2490,7 +2490,7 @@ StatusOr<SchemaVer> MetaClient::getLatestEdgeVersionFromCache(const GraphSpaceID
const auto& metadata = *metadata_.load();
auto it = metadata.spaceNewestEdgeVerMap_.find(std::make_pair(space, edgeType));
if (it == metadata.spaceNewestEdgeVerMap_.end()) {
return Status::EdgeNotFound(fmt::format("EdgeType `{}` not found", edgeType));
return Status::EdgeNotFound(fmt::format("EdgeType `{}`", edgeType));
}
return it->second;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/mutate/ClearSpace.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Clear space test
"""
CLEAR SPACE clear_space_0;
"""
Then a ExecutionError should be raised at runtime: Space not existed!
Then a ExecutionError should be raised at runtime: SpaceNotFound: Space not existed!
And drop the used space

Scenario: Clear space function test
Expand Down
11 changes: 6 additions & 5 deletions tests/tck/features/schema/Schema.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
# This source code is licensed under Apache 2.0 License.\
@tag1
Feature: Insert string vid of vertex and edge

Scenario: insert vertex and edge test
Expand Down Expand Up @@ -96,7 +97,7 @@ Feature: Insert string vid of vertex and edge
"""
DESCRIBE TAG not_exist
"""
Then a ExecutionError should be raised at runtime: Tag not existed!
Then a ExecutionError should be raised at runtime: TagNotFound: Tag not existed!
# unreserved keyword
When executing query:
"""
Expand Down Expand Up @@ -193,7 +194,7 @@ Feature: Insert string vid of vertex and edge
"""
DROP TAG not_exist_tag
"""
Then a ExecutionError should be raised at runtime: Tag not existed!
Then a ExecutionError should be raised at runtime: TagNotFound: Tag not existed!
# drop if exists with not exist tag
When executing query:
"""
Expand Down Expand Up @@ -300,7 +301,7 @@ Feature: Insert string vid of vertex and edge
"""
DESCRIBE EDGE not_exist
"""
Then a ExecutionError should be raised at runtime: Edge not existed!
Then a ExecutionError should be raised at runtime: EdgeNotFound: Edge not existed!
# create edge with timestamp
When executing query:
"""
Expand Down Expand Up @@ -378,7 +379,7 @@ Feature: Insert string vid of vertex and edge
"""
DROP EDGE not_exist_edge
"""
Then a ExecutionError should be raised at runtime: Edge not existed!
Then a ExecutionError should be raised at runtime: EdgeNotFound: Edge not existed!
# drop if exists
When executing query:
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/yield/NoSpaceChosen.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ Feature: Yield
"""
YIELD $$.dummyTag.p
"""
Then a ExecutionError should be raised at runtime: TagName `dummyTag' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `dummyTag`
When executing query:
"""
YIELD $^.dummyTag.p
"""
Then a ExecutionError should be raised at runtime: TagName `dummyTag' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `dummyTag`
When executing query:
"""
YIELD $-.dummyTag.p
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/yield/return.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ Feature: Return
"""
RETURN $$.dummyTag.p
"""
Then a ExecutionError should be raised at runtime: TagName `dummyTag' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `dummyTag`
When executing query:
"""
RETURN $^.dummyTag.p
"""
Then a ExecutionError should be raised at runtime: TagName `dummyTag' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `dummyTag`
When executing query:
"""
RETURN $-.dummyTag.p
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/yield/yield.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ Feature: Yield Sentence
"""
$var = GO FROM hash("Boris Diaw") OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD $$.a.team
"""
Then a ExecutionError should be raised at runtime: TagName `a' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `a`
When executing query:
"""
$var = GO FROM hash("Boris Diaw") OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD $^.a.team
"""
Then a ExecutionError should be raised at runtime: TagName `a' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `a`
When executing query:
"""
$var = GO FROM hash("Boris Diaw") OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD a.team
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/yield/yield.feature
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ Feature: Yield Sentence
"""
$var = GO FROM "Boris Diaw" OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD $$.a.team
"""
Then a ExecutionError should be raised at runtime: TagName `a' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `a`
When executing query:
"""
$var = GO FROM "Boris Diaw" OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD $^.a.team
"""
Then a ExecutionError should be raised at runtime: TagName `a' is nonexistent
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `a`
When executing query:
"""
$var = GO FROM "Boris Diaw" OVER serve YIELD $^.player.name AS name, serve.start_year AS start, $$.team.name AS team;YIELD a.team
Expand Down

0 comments on commit 0f98d29

Please sign in to comment.