Skip to content

Commit

Permalink
test: rueidisotel with the Arbitrary command builder
Browse files Browse the repository at this point in the history
  • Loading branch information
rueian committed Jan 29, 2024
1 parent ffeb7c7 commit a171bb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions rueidisotel/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/redis/rueidis v1.0.27 h1:UhTlj+9JBuQe6SHe60YJA+0TonZDi5n/TkJZ7QTyV/s=
github.com/redis/rueidis v1.0.27/go.mod h1:NT7lPuiVYijdZVsV0V8i9ZUhqe1OMGaq+NiQigNuKlg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
Expand Down
13 changes: 6 additions & 7 deletions rueidisotel/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"go.opentelemetry.io/otel/sdk/trace/tracetest"

"github.com/redis/rueidis"
"github.com/redis/rueidis/internal/cmds"
)

// MockMeterProvider for testing purposes
Expand Down Expand Up @@ -151,10 +150,10 @@ func testWithClient(t *testing.T, client rueidis.Client, exp *tracetest.InMemory
)
validateTrace(t, exp, "SET SET SET SET SET", codes.Ok)

client.Do(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
client.Do(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

client.DoMulti(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
client.DoMulti(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

ctx2, cancel := context.WithTimeout(ctx, time.Second/2)
Expand Down Expand Up @@ -186,10 +185,10 @@ func testWithClient(t *testing.T, client rueidis.Client, exp *tracetest.InMemory
)
validateTrace(t, exp, "SET SET SET SET SET", codes.Ok)

c.Do(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
c.Do(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

c.DoMulti(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
c.DoMulti(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

ctx2, cancel := context.WithTimeout(ctx, time.Second/2)
Expand All @@ -204,10 +203,10 @@ func testWithClient(t *testing.T, client rueidis.Client, exp *tracetest.InMemory
cancel()
<-hookCh

client.Do(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
client.Do(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

client.Do(ctx, cmds.NewCompleted([]string{"unknown", "command"}))
client.Do(ctx, client.B().Arbitrary("unknown", "command").Build())
validateTrace(t, exp, "unknown", codes.Error)

nodes := client.Nodes()
Expand Down

0 comments on commit a171bb7

Please sign in to comment.