Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Niharika Bhavaraju <[email protected]>
  • Loading branch information
niharikabhavaraju committed Jan 22, 2025
1 parent 51884e6 commit eb60104
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion go/integTest/cluster_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func (suite *GlideTestSuite) TestClusterCustomCommandWithRoute_InvalidRoute() {
func (suite *GlideTestSuite) TestClusterCustomCommandWithRoute_AllNodes() {
client := suite.defaultClusterClient()
route := config.SimpleNodeRoute(config.AllNodes)
result, err := client.CustomCommandWithRoute([]string{"PING"}, route)
result, _ := client.CustomCommandWithRoute([]string{"PING"}, route)
value := result.Value()

if result.IsMultiValue() {
responses := value.(map[string]interface{})
Expand Down
30 changes: 15 additions & 15 deletions go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1314,11 +1314,11 @@ func (suite *GlideTestSuite) TestHRandField() {
key = uuid.NewString()
suite.verifyOK(client.Set(key, "HRandField"))
_, err = client.HRandField(key)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
_, err = client.HRandFieldWithCount(key, 42)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
_, err = client.HRandFieldWithCountWithValues(key, 42)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
})
}

Expand Down Expand Up @@ -4552,11 +4552,11 @@ func (suite *GlideTestSuite) TestXGroupSetId() {

// An error is raised if XGROUP SETID is called with a non-existing key
_, err = client.XGroupSetId(uuid.NewString(), group, "1-1")
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

// An error is raised if XGROUP SETID is called with a non-existing group
_, err = client.XGroupSetId(key, uuid.NewString(), "1-1")
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

// Setting the ID to a non-existing ID is allowed
suite.verifyOK(client.XGroupSetId(key, group, "99-99"))
Expand All @@ -4565,7 +4565,7 @@ func (suite *GlideTestSuite) TestXGroupSetId() {
key = uuid.NewString()
suite.verifyOK(client.Set(key, "xgroup setid"))
_, err = client.XGroupSetId(key, group, "1-1")
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
})
}

Expand Down Expand Up @@ -7106,7 +7106,7 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
// claim with invalid stream entry IDs
_, err = client.XClaimJustId(key, groupName, consumer1, int64(1), []string{"invalid-stream-id"})
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

// claim with empty stream entry IDs returns empty map
claimResult, err := client.XClaimJustId(key, groupName, consumer1, int64(1), []string{})
Expand All @@ -7117,7 +7117,7 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
claimOptions := options.NewStreamClaimOptions().SetIdleTime(1)
_, err = client.XClaim(stringKey, groupName, consumer1, int64(1), []string{streamid_1.Value()})
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
assert.Contains(suite.T(), err.Error(), "NOGROUP")

_, err = client.XClaimWithOptions(
Expand All @@ -7129,12 +7129,12 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
claimOptions,
)
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
assert.Contains(suite.T(), err.Error(), "NOGROUP")

_, err = client.XClaimJustId(stringKey, groupName, consumer1, int64(1), []string{streamid_1.Value()})
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
assert.Contains(suite.T(), err.Error(), "NOGROUP")

_, err = client.XClaimJustIdWithOptions(
Expand All @@ -7146,15 +7146,15 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
claimOptions,
)
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
assert.Contains(suite.T(), err.Error(), "NOGROUP")

// key exists, but is not a stream
_, err = client.Set(stringKey, "test")
assert.NoError(suite.T(), err)
_, err = client.XClaim(stringKey, groupName, consumer1, int64(1), []string{streamid_1.Value()})
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

_, err = client.XClaimWithOptions(
stringKey,
Expand All @@ -7165,11 +7165,11 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
claimOptions,
)
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

_, err = client.XClaimJustId(stringKey, groupName, consumer1, int64(1), []string{streamid_1.Value()})
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)

_, err = client.XClaimJustIdWithOptions(
stringKey,
Expand All @@ -7180,6 +7180,6 @@ func (suite *GlideTestSuite) TestXClaimFailure() {
claimOptions,
)
assert.Error(suite.T(), err)
assert.IsType(suite.T(), &api.RequestError{}, err)
assert.IsType(suite.T(), &errors.RequestError{}, err)
})
}

0 comments on commit eb60104

Please sign in to comment.