Skip to content

Commit f85f5cf

Browse files
authored
Go: Fix Full Matrix Tests (valkey-io#4079)
1 parent fb6379a commit f85f5cf

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

go/integTest/batch_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"reflect"
99
"strings"
1010
"testing"
11+
"time"
1112

1213
"github.com/google/uuid"
1314
"github.com/stretchr/testify/assert"
@@ -41,6 +42,9 @@ func (suite *GlideTestSuite) TestBatchTimeout() {
4142
_, err := c.ExecWithOptions(context.Background(), *batch, true, *opts)
4243
suite.Error(err)
4344
suite.IsType(&errors.TimeoutError{}, err)
45+
46+
time.Sleep(1 * time.Second)
47+
4448
// Retry with a longer timeout and expect [OK]
4549
opts.WithTimeout(1000)
4650
res, err := c.ExecWithOptions(context.Background(), *batch, true, *opts)
@@ -53,6 +57,9 @@ func (suite *GlideTestSuite) TestBatchTimeout() {
5357
_, err := c.ExecWithOptions(context.Background(), *batch, true, *opts)
5458
suite.Error(err)
5559
suite.IsType(&errors.TimeoutError{}, err)
60+
61+
time.Sleep(1 * time.Second)
62+
5663
// Retry with a longer timeout and expect [OK]
5764
opts.WithTimeout(1000)
5865
res, err := c.ExecWithOptions(context.Background(), *batch, true, *opts)

go/integTest/cluster_commands_test.go

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,27 +2422,12 @@ func (suite *GlideTestSuite) TestScriptKillWithoutRoute() {
24222422
require.NoError(suite.T(), err)
24232423
killClient := suite.defaultClusterClient()
24242424

2425-
// Ensure no script is running at the beginning
2426-
_, err = killClient.ScriptKill(context.Background())
2427-
assert.Error(suite.T(), err)
2428-
assert.True(suite.T(), strings.Contains(strings.ToLower(err.Error()), "notbusy"))
2429-
2430-
// Kill Running Code
2431-
code := CreateLongRunningLuaScript(5, true)
2432-
script := options.NewScript(code)
2433-
2434-
go invokeClient.InvokeScript(context.Background(), *script)
2435-
2436-
time.Sleep(1 * time.Second)
2437-
2438-
result, err := killClient.ScriptKill(context.Background())
2425+
// Flush before setup
2426+
result, err := invokeClient.ScriptFlush(context.Background())
24392427
assert.NoError(suite.T(), err)
24402428
assert.Equal(suite.T(), "OK", result)
2441-
script.Close()
2442-
2443-
time.Sleep(1 * time.Second)
24442429

2445-
// Ensure no script is running at the end
2430+
// Nothing loaded, nothing to kill
24462431
_, err = killClient.ScriptKill(context.Background())
24472432
assert.Error(suite.T(), err)
24482433
assert.True(suite.T(), strings.Contains(strings.ToLower(err.Error()), "notbusy"))
@@ -2503,15 +2488,15 @@ func (suite *GlideTestSuite) TestScriptKillUnkillableWithoutRoute() {
25032488

25042489
go invokeClient.InvokeScriptWithOptions(context.Background(), *script, *options.NewScriptOptions().WithKeys([]string{key}))
25052490

2506-
time.Sleep(1 * time.Second)
2491+
time.Sleep(3 * time.Second)
25072492

25082493
_, err = killClient.ScriptKill(context.Background())
25092494
assert.Error(suite.T(), err)
25102495
assert.True(suite.T(), strings.Contains(strings.ToLower(err.Error()), "unkillable"))
25112496
script.Close()
25122497

25132498
// Wait until script finishes
2514-
time.Sleep(6 * time.Second)
2499+
time.Sleep(4 * time.Second)
25152500

25162501
// Ensure no script is running at the end
25172502
_, err = killClient.ScriptKill(context.Background())

0 commit comments

Comments
 (0)