You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/10/17 08:34:44 UTC
[GitHub] [incubator-kvrocks] tisonkun opened a new pull request, #1004: test: migrate part of slotmigrate tests
tisonkun opened a new pull request, #1004:
URL: https://github.com/apache/incubator-kvrocks/pull/1004
This refers to #945.
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #1004: test: migrate part of slotmigrate tests
Posted by GitBox <gi...@apache.org>.
git-hulk commented on code in PR #1004:
URL: https://github.com/apache/incubator-kvrocks/pull/1004#discussion_r996776469
##########
tests/gocase/integration/slotmigrate/slotmigrate_test.go:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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 slotmigrate
+
+import (
+ "context"
+ "fmt"
+ "testing"
+ "time"
+
+ "github.com/apache/incubator-kvrocks/tests/gocase/util"
+ "github.com/stretchr/testify/require"
+)
+
+func TestSlotMigrateFromSlave(t *testing.T) {
+ ctx := context.Background()
+
+ master := util.StartServer(t, map[string]string{"cluster-enabled": "yes"})
+ defer func() { master.Close() }()
+ masterClient := master.NewClient()
+ defer func() { require.NoError(t, masterClient.Close()) }()
+ masterID := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx00"
+ require.NoError(t, masterClient.Do(ctx, "clusterx", "SETNODEID", masterID).Err())
+
+ slave := util.StartServer(t, map[string]string{"cluster-enabled": "yes"})
+ defer func() { slave.Close() }()
+ slaveClient := slave.NewClient()
+ defer func() { require.NoError(t, slaveClient.Close()) }()
+ slaveID := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx01"
+ require.NoError(t, slaveClient.Do(ctx, "clusterx", "SETNODEID", slaveID).Err())
+
+ clusterNodes := fmt.Sprintf("%s %s %d master - 0-100\n", masterID, master.Host(), master.Port())
+ clusterNodes += fmt.Sprintf("%s %s %d slave %s", slaveID, slave.Host(), slave.Port(), masterID)
+ require.NoError(t, masterClient.Do(ctx, "clusterx", "SETNODES", clusterNodes, "1").Err())
+ require.NoError(t, slaveClient.Do(ctx, "clusterx", "SETNODES", clusterNodes, "1").Err())
+
+ t.Run("MIGRATE - Slave cannot migrate slot", func(t *testing.T) {
+ require.ErrorContains(t, slaveClient.Do(ctx, "clusterx", "migrate", "1", masterID).Err(), "Can't migrate slot")
+ })
+
+ t.Run("MIGRATE - Cannot migrate slot to a slave", func(t *testing.T) {
+ require.ErrorContains(t, masterClient.Do(ctx, "clusterx", "migrate", "1", slaveID).Err(), "Can't migrate slot")
Review Comment:
```suggestion
require.ErrorContains(t, masterClient.Do(ctx, "clusterx", "migrate", "1", slaveID).Err(), "Can't migrate slot to a slave")
```
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kvrocks] tisonkun merged pull request #1004: test: migrate part of slotmigrate tests
Posted by GitBox <gi...@apache.org>.
tisonkun merged PR #1004:
URL: https://github.com/apache/incubator-kvrocks/pull/1004
--
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: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org