Skip to content
Merged
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
17 changes: 16 additions & 1 deletion server/norace_2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,15 @@ func TestNoRaceJetStreamKVReplaceWithServerRestart(t *testing.T) {
})
require_NoError(t, err)

// Manually disable direct get on underlying stream, since this test
// relies on immediate consistency which we can't guarantee with direct gets
// until we provide a solution for this.
si, err := js.StreamInfo("KV_TEST")
require_NoError(t, err)
si.Config.AllowDirect = false
_, err = js.UpdateStream(&si.Config)
require_NoError(t, err)

createData := func(n int) []byte {
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, n)
Expand All @@ -1247,6 +1256,11 @@ func TestNoRaceJetStreamKVReplaceWithServerRestart(t *testing.T) {
_, err = kv.Create("foo", createData(160))
require_NoError(t, err)

// Ensure all replicas have applied the key.
checkFor(t, 2*time.Second, 200*time.Millisecond, func() error {
return checkState(t, c, globalAccountName, "KV_TEST")
})

ch := make(chan struct{})
wg := sync.WaitGroup{}

Expand All @@ -1263,6 +1277,7 @@ func TestNoRaceJetStreamKVReplaceWithServerRestart(t *testing.T) {
for {
select {
case <-ch:
close(errCh)
return
default:
k, err := kv.Get("foo")
Expand All @@ -1285,7 +1300,7 @@ func TestNoRaceJetStreamKVReplaceWithServerRestart(t *testing.T) {
time.Sleep(2 * time.Second)
for _, s := range c.servers {
s.Shutdown()
// Need to leave servers down for awhile to trigger bug properly.
// Need to leave servers down for a while to trigger bug properly.
time.Sleep(5 * time.Second)
s = c.restartServer(s)
c.waitOnServerHealthz(s)
Expand Down
Loading