From 2c017343bf33d5674f08c13ac59ca57ffcfae7b6 Mon Sep 17 00:00:00 2001 From: Zixuan Liu Date: Mon, 21 Mar 2022 16:22:18 +0800 Subject: [PATCH] test: fix splite bundle test and update pulsar image (#663) Signed-off-by: Zixuan Liu (cherry picked from commit 06d64a747f8e7705e33fed1ba161e9d6047ab428) Signed-off-by: Zixuan Liu --- pkg/ctl/namespace/split_bundle_test.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pkg/ctl/namespace/split_bundle_test.go b/pkg/ctl/namespace/split_bundle_test.go index 9682086d..e678d257 100644 --- a/pkg/ctl/namespace/split_bundle_test.go +++ b/pkg/ctl/namespace/split_bundle_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/streamnative/pulsarctl/pkg/ctl/topic" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestSplitBundle(t *testing.T) { @@ -30,28 +30,26 @@ func TestSplitBundle(t *testing.T) { args := []string{"create", ns} _, execErr, _, _ := TestNamespaceCommands(createNs, args) - assert.Nil(t, execErr) + require.Nil(t, execErr) args = []string{"split-bundle", ns, "--bundle", "0x80000000_0xc0000000"} _, execErr, _, _ = TestNamespaceCommands(splitBundle, args) - assert.NotNil(t, execErr) - errMsg := "code: 412 reason: Failed to find ownership for ServiceUnit:" + ns + "/0x80000000_0xc0000000" - assert.Equal(t, execErr.Error(), errMsg) + require.Nil(t, execErr) args = []string{"create", ns + "/test-topic", "0"} _, _, argsErr, err := topic.TestTopicCommands(topic.CreateTopicCmd, args) - assert.Nil(t, argsErr) - assert.Nil(t, err) + require.Nil(t, argsErr) + require.Nil(t, err) args = []string{"bundle-range", ns + "/test-topic"} out, execErr, _, _ := topic.TestTopicCommands(topic.GetBundleRangeCmd, args) - assert.Nil(t, execErr) + require.Nil(t, execErr) bundle := strings.Split(out.String(), ":")[2] bundle = strings.TrimSpace(bundle) args = []string{"split-bundle", ns, "--bundle", bundle} splitOut, execErr, _, _ := TestNamespaceCommands(splitBundle, args) - assert.Nil(t, execErr) - assert.Equal(t, splitOut.String(), "Split a namespace bundle: "+bundle+" successfully\n") + require.Nil(t, execErr) + require.Equal(t, splitOut.String(), "Split a namespace bundle: "+bundle+" successfully\n") }