Skip to content

Commit

Permalink
Merge pull request #306 from alicebob/glua
Browse files Browse the repository at this point in the history
update github.com/yuin/gopher-lua dependency
  • Loading branch information
alicebob authored Nov 6, 2022
2 parents 0d94e57 + 16bd87e commit d306b35
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
42 changes: 25 additions & 17 deletions cmd_stream_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package miniredis

import (
"context"
"fmt"
"math"
"regexp"
Expand Down Expand Up @@ -421,29 +422,36 @@ func TestStreamRead(t *testing.T) {

t.Run("blocking async", func(t *testing.T) {
// XREAD blocking test using latest ID
ctx, cancel := context.WithCancel(context.Background())
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
mustDo(t, c,
"XREAD", "BLOCK", "0", "STREAMS", "planets", "$",
proto.Array(
proto.Array(proto.String("planets"),
proto.Array(
proto.Array(proto.String("5-1"), proto.Strings("name", "block", "idx", "6")),
),
),
),
)
xaddClient, err := proto.Dial(s.Addr())
ok(t, err)
defer xaddClient.Close()
for {
select {
case <-time.After(10 * time.Millisecond):
case <-ctx.Done():
return
}
_, err = xaddClient.Do("XADD", "planets", "5-1", "name", "block", "idx", "6")
ok(t, err)
}
}()

// Wait for the blocking XREAD to start and then run XADD
xaddClient, err := proto.Dial(s.Addr())
ok(t, err)
defer xaddClient.Close()

_, err = xaddClient.Do("XADD", "planets", "5-1", "name", "block", "idx", "6")
ok(t, err)
mustDo(t, c,
"XREAD", "BLOCK", "0", "STREAMS", "planets", "$",
proto.Array(
proto.Array(proto.String("planets"),
proto.Array(
proto.Array(proto.String("5-1"), proto.Strings("name", "block", "idx", "6")),
),
),
),
)
cancel()
wg.Wait()
})
})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/alicebob/miniredis/v2

require (
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64
)

go 1.14
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLCur2yWnJzwQEKRcAHXo6seXGuSwWw=
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 h1:5mLPGnFdSsevFRFc9q3yYbBkB6tsm4aCwwQV/j1JQAQ=
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

0 comments on commit d306b35

Please sign in to comment.