Skip to content

Commit

Permalink
Go: XTrim, XLen - fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Kumar <[email protected]>
  • Loading branch information
prateek-kumar-improving committed Jan 10, 2025
1 parent 1f90184 commit 5c1a69c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4598,6 +4598,7 @@ func (suite *GlideTestSuite) Test_XAdd_XLen_XTrim() {
),
)
assert.NotNil(t, xAddResult.Value())
assert.Nil(t, err)
id := xAddResult.Value()
xLenResult, err = client.XLen(key1)
assert.Nil(t, err)
Expand All @@ -4611,6 +4612,7 @@ func (suite *GlideTestSuite) Test_XAdd_XLen_XTrim() {
options.NewXTrimOptionsWithMinId(id).SetExactTrimming(),
),
)
assert.Nil(t, err)
assert.NotNil(t, xAddResult.Value())
xLenResult, err = client.XLen(key1)
assert.Nil(t, err)
Expand All @@ -4621,6 +4623,7 @@ func (suite *GlideTestSuite) Test_XAdd_XLen_XTrim() {
key1,
options.NewXTrimOptionsWithMaxLen(1).SetExactTrimming(),
)
assert.Nil(t, err)
assert.Equal(t, xTrimResult.Value(), int64(1))
xLenResult, err = client.XLen(key1)
assert.Nil(t, err)
Expand All @@ -4631,18 +4634,19 @@ func (suite *GlideTestSuite) Test_XAdd_XLen_XTrim() {
key2,
options.NewXTrimOptionsWithMaxLen(1).SetExactTrimming(),
)
assert.Nil(t, err)
assert.Equal(t, xTrimResult.Value(), int64(0))
xLenResult, err = client.XLen(key2)
assert.Nil(t, err)
assert.Equal(t, xLenResult.Value(), int64(0))

// Throw Exception: Key exists - but it is not a stream
setResult, err := client.Set(key2, "xtrimtest")
assert.Nil(t, err)
assert.Equal(t, setResult.Value(), "OK")
_, err = client.XTrim(key2, options.NewXTrimOptionsWithMinId("0-1"))
assert.NotNil(t, err)
assert.IsType(t, &api.RequestError{}, err)

_, err = client.XLen(key2)
assert.NotNil(t, err)
assert.IsType(t, &api.RequestError{}, err)
Expand Down

0 comments on commit 5c1a69c

Please sign in to comment.