Skip to content

Commit

Permalink
add sleeps to v2 tests
Browse files Browse the repository at this point in the history
Testing commit having issue with returning ok before
replication has completed.

Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Feb 6, 2025
1 parent 8b5ed64 commit 0313f96
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func TestSaveLoad(t *testing.T) {
err = c.Save(ctx, key, NewBlob([]byte("foobar")))
require.NoError(t, err)

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err = c.Load(ctx, key)
require.NoError(t, err)
require.NotNil(t, ce)
Expand Down Expand Up @@ -118,6 +121,9 @@ func TestChunkedSave(t *testing.T) {

UploadChunkSize = oldChunkSize

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err := c.Load(ctx, id)
require.NoError(t, err)
require.NotNil(t, ce)
Expand Down Expand Up @@ -186,6 +192,9 @@ func TestPartialKeyOrder(t *testing.T) {
err = c.Save(ctx, key3, NewBlob(dt))
require.NoError(t, err)

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err := c.Load(ctx, "partial-"+rand+"foo")
require.NoError(t, err)
require.Equal(t, "partial-"+rand+"foo1", ce.Key)
Expand Down Expand Up @@ -231,6 +240,9 @@ func TestMutable(t *testing.T) {
})
require.NoError(t, err)

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err := c.Load(ctx, key)
require.NoError(t, err)
require.NotNil(t, ce)
Expand Down Expand Up @@ -270,6 +282,9 @@ func TestMutableRace(t *testing.T) {
require.NoError(t, err)
}

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

count := 0
err = c.SaveMutable(ctx, key, 10*time.Second, func(ce *Entry) (Blob, error) {
require.NotNil(t, ce)
Expand All @@ -288,6 +303,9 @@ func TestMutableRace(t *testing.T) {
})
require.NoError(t, err)

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err := c.Load(ctx, key)
require.NoError(t, err)
require.NotNil(t, ce)
Expand Down Expand Up @@ -325,6 +343,9 @@ func TestMutableCrash(t *testing.T) {

require.True(t, count > 1)

// v2 API is not immediately consistent
time.Sleep(1 * time.Second)

ce, err := c.Load(ctx, key)
require.NoError(t, err)
require.NotNil(t, ce)
Expand Down

0 comments on commit 0313f96

Please sign in to comment.