git-hulk commented on code in PR #772:
URL: https://github.com/apache/incubator-kvrocks/pull/772#discussion_r939538063


##########
src/config.cc:
##########
@@ -742,6 +742,9 @@ Status Config::AddNamespace(const std::string &ns, const 
std::string &token) {
   if (cluster_enabled) {
     return Status(Status::NotOK, "forbidden to add namespace when cluster mode 
was enabled");
   }
+  if (ns == kDefaultNamespace) {
+    return Status(Status::NotOK, "forbidden to the add the default namespace");

Review Comment:
   ```suggestion
       return Status(Status::NotOK, "forbidden to add the default namespace");
   ```



##########
tests/cppunit/config_test.cc:
##########
@@ -179,6 +179,10 @@ TEST(Namespace, Add) {
   auto s = config.AddNamespace("n1", "t0");
   EXPECT_FALSE(s.IsOK());
   EXPECT_EQ(s.Msg(), "the namespace has already exists");
+
+  s = config.AddNamespace(kDefaultNamespace, "mytoken");
+  EXPECT_FALSE(s.IsOK());
+  EXPECT_EQ(s.Msg(), "forbidden to the add the default namespace");

Review Comment:
   ```suggestion
     EXPECT_EQ(s.Msg(), "forbidden to add the default namespace");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to