chore(poll): return NotModifiedTimeoutErr on 304

This commit is contained in:
Milas Bowman 2025-03-10 22:54:48 -04:00
parent 35a3c1c23a
commit bdf9298496
Signed by: milas
SSH key fingerprint: SHA256:ek2D5l1HA34B3wbdErz0QOXm1E46CVvyf/nM4Fwfx/U
4 changed files with 65 additions and 1 deletions

View file

@ -46,3 +46,24 @@ func TestClient_PollItem(t *testing.T) {
require.NotEmpty(t, ct)
require.NoError(t, <-updateErrCh)
}
func TestClient_PollItem_Timeout(t *testing.T) {
if testing.Short() {
t.Skip("Skipping in short mode: 1 sec minimum to trigger timeout")
return
}
t.Parallel()
f, ctx := newFixture(t)
pk := randomPk()
sk := randomSk()
err := f.cli.InsertItem(ctx, f.bucket, pk, sk, "", []byte("hello1"))
require.NoError(t, err)
_, ct, err := f.cli.ReadItemSingle(ctx, f.bucket, pk, sk)
item, ct, err := f.cli.PollItem(ctx, f.bucket, pk, sk, ct, 1*time.Second)
require.ErrorIs(t, err, k2v.NotModifiedTimeoutErr)
require.Empty(t, item)
}