Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: Add bulk args test #3363

Merged
merged 4 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions go/integTest/glide_test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"flag"
"fmt"
"log"
"math"
"os"
"os/exec"
"strconv"
Expand All @@ -15,6 +16,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/valkey-io/valkey-glide/go/api"
Expand Down Expand Up @@ -380,3 +382,12 @@ func (suite *GlideTestSuite) SkipIfServerVersionLowerThanBy(version string) {
suite.T().Skipf("This feature is added in version %s", version)
}
}

func (suite *GlideTestSuite) GenerateLargeUuid() string {
wantedLength := math.Pow(2, 16)
id := uuid.New().String()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uuid seems an overkill here. I'm OK as long as the performance is not terrible, otherwise consider math/rand or even strings.Repeat().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not take that much time to run this test.

for len(id) < int(wantedLength) {
id += uuid.New().String()
}
return id
}
11 changes: 11 additions & 0 deletions go/integTest/shared_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9168,3 +9168,14 @@ func (suite *GlideTestSuite) TestGeoAdd_InvalidArgs() {
assert.IsType(t, &errors.RequestError{}, err)
})
}

func (suite *GlideTestSuite) TestGetSet_SendLargeValues() {
suite.runWithDefaultClients(func(client api.BaseClient) {
key := suite.GenerateLargeUuid()
value := suite.GenerateLargeUuid()
suite.verifyOK(client.Set(key, value))
result, err := client.Get(key)
assert.Nil(suite.T(), err)
assert.Equal(suite.T(), value, result.Value())
})
}
Loading