Skip to content

Commit

Permalink
[internal/otelarrow] [chore] fix TestMRUReset flakiness (open-telemet…
Browse files Browse the repository at this point in the history
…ry#34260)

**Description:**

Ensure the monotonic clock has advanced prior to resetting, to ensure
the item generation is before the reset.
The monotonic clock is guaranteed to be non-decreasing, but may be
identical in consecutive measurements.

**Link to tracking Issue:**


open-telemetry#34252

**Testing:**

I couldn't reproduce the issue locally - this issue would depend on the
system clock frequency.

**Documentation:**

N/A
  • Loading branch information
axw authored Aug 1, 2024
1 parent 07a7efd commit 42f9faa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/otelarrow/compression/zstd/mru_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package zstd
import (
"runtime"
"testing"
"time"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -78,6 +79,9 @@ func TestMRUReset(t *testing.T) {
})
require.Equal(t, 1, m.Size())

// Ensure the monotonic clock has has advanced before resetting.
time.Sleep(10 * time.Millisecond)

m.Reset()
require.Equal(t, 0, m.Size())

Expand Down

0 comments on commit 42f9faa

Please sign in to comment.