You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by ti...@apache.org on 2022/09/12 11:58:59 UTC

[incubator-kvrocks] branch unstable updated: Move TCL test unit/config to Go case (#865)

This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new ad002c6  Move TCL test unit/config to Go case (#865)
ad002c6 is described below

commit ad002c647e61673c153c0972e8b06df9c533aaf0
Author: tison <wa...@gmail.com>
AuthorDate: Mon Sep 12 19:58:54 2022 +0800

    Move TCL test unit/config to Go case (#865)
    
    Signed-off-by: tison <wa...@gmail.com>
---
 tests/gocase/unit/config/config_test.go | 43 +++++++++++++++++++++++++++++++++
 tests/tcl/tests/test_helper.tcl         |  1 -
 tests/tcl/tests/unit/config.tcl         | 24 ------------------
 3 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/tests/gocase/unit/config/config_test.go b/tests/gocase/unit/config/config_test.go
new file mode 100644
index 0000000..7b72c7d
--- /dev/null
+++ b/tests/gocase/unit/config/config_test.go
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package config
+
+import (
+	"context"
+	"testing"
+
+	"github.com/apache/incubator-kvrocks/tests/gocase/util"
+	"github.com/stretchr/testify/require"
+)
+
+func TestRenameCommand(t *testing.T) {
+	srv := util.StartServer(t, map[string]string{
+		"rename-command": "KEYS KEYSNEW",
+	})
+	defer srv.Close()
+
+	ctx := context.Background()
+	rdb := srv.NewClient()
+	defer func() { require.NoError(t, rdb.Close()) }()
+	err := rdb.Keys(ctx, "*").Err()
+	require.ErrorContains(t, err, "unknown command")
+	r := rdb.Do(ctx, "KEYSNEW", "*")
+	require.Equal(t, []interface{}{}, r.Val())
+}
diff --git a/tests/tcl/tests/test_helper.tcl b/tests/tcl/tests/test_helper.tcl
index 1d0781d..a0cf6d5 100644
--- a/tests/tcl/tests/test_helper.tcl
+++ b/tests/tcl/tests/test_helper.tcl
@@ -48,7 +48,6 @@ set ::all_tests {
     unit/pubsub
     unit/introspection
     unit/geo
-    unit/config
     unit/scripting
     integration/slotmigrate
     integration/slotimport
diff --git a/tests/tcl/tests/unit/config.tcl b/tests/tcl/tests/unit/config.tcl
deleted file mode 100644
index 940d76d..0000000
--- a/tests/tcl/tests/unit/config.tcl
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-start_server {tags {"config"} overrides {rename-command "KEYS KEYSNEW"}} {
-    test {Rename one command} {
-        catch {r KEYS *} e
-        assert_error "*invalid command name*" $e
-        assert_equal "" [r KEYSNEW *]
-    }
-}