torwig commented on code in PR #1379:
URL:
https://github.com/apache/incubator-kvrocks/pull/1379#discussion_r1163246103
##########
tests/gocase/unit/info/info_test.go:
##########
@@ -88,4 +88,8 @@ func TestInfo(t *testing.T) {
require.GreaterOrEqual(t, lastBgsaveTimeSec, 0)
require.Less(t, lastBgsaveTimeSec, 3)
})
+
+ t.Run("get cluster information by INFO", func(t *testing.T) {
+ require.Equal(t, "0", util.FindInfoEntry(rdb,
"cluster_enabled", "cluster"))
+ })
Review Comment:
@enjoy-binbin Thank you for your contribution.
LGTM.
Additionally, you can add a test for the case when a cluster mode is enabled
like the following:
```
t.Run("get cluster information by INFO - cluster not enabled", func(t
*testing.T) { // <---- your test case
require.Equal(t, "0", util.FindInfoEntry(rdb, "cluster_enabled",
"cluster"))
})
srv0 := util.StartServer(t, map[string]string{"cluster-enabled": "yes"})
defer func() { srv0.Close() }()
rdb0 := srv0.NewClient()
defer func() { require.NoError(t, rdb0.Close()) }()
t.Run("get cluster information by INFO - cluster enabled", func(t
*testing.T) {
require.Equal(t, "1", util.FindInfoEntry(rdb0, "cluster_enabled",
"cluster"))
})
```
--
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]