Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test: plugin/storage/badger/samplingstore #5094

Merged
merged 9 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions plugin/storage/badger/samplingstore/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *SamplingStore) GetThroughput(start, end time.Time) ([]*model.Throughput
if err != nil {
return err
}
throughputs, err := decodeThroughtputValue(val)
throughputs, err := decodeThroughputValue(val)
if err != nil {
return err
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func (s *SamplingStore) createThroughputKV(throughput []*model.Throughput, start
return key, bb, err
}

func decodeThroughtputValue(val []byte) ([]*model.Throughput, error) {
func decodeThroughputValue(val []byte) ([]*model.Throughput, error) {
var throughput []*model.Throughput

err := json.Unmarshal(val, &throughput)
Expand Down
4 changes: 2 additions & 2 deletions plugin/storage/badger/samplingstore/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestGetThroughput(t *testing.T) {
err := store.InsertThroughput(expected)
require.NoError(t, err)

akagami-harsh marked this conversation as resolved.
Show resolved Hide resolved
actual, err := store.GetThroughput(start, start.Add(time.Second*time.Duration(10)))
actual, err := store.GetThroughput(start.Add(-time.Millisecond), start.Add(time.Second*time.Duration(10)))
require.NoError(t, err)
assert.Equal(t, expected, actual)
})
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestDecodeThroughtputValue(t *testing.T) {

marshalBytes, err := json.Marshal(expected)
require.NoError(t, err)
acrual, err := decodeThroughtputValue(marshalBytes)
acrual, err := decodeThroughputValue(marshalBytes)
require.NoError(t, err)
assert.Equal(t, expected, acrual)
}
Expand Down
Loading