Update record_test.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2023-11-11 20:57:42 +01:00 committed by GitHub
parent 63691d82a5
commit 69c07ec6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -15,10 +15,10 @@
package record package record
import ( import (
"errors"
"math/rand" "math/rand"
"testing" "testing"
"github.com/pkg/errors"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/histogram"
@ -209,7 +209,7 @@ func TestRecord_Corrupted(t *testing.T) {
corrupted := enc.Samples(samples, nil)[:8] corrupted := enc.Samples(samples, nil)[:8]
_, err := dec.Samples(corrupted, nil) _, err := dec.Samples(corrupted, nil)
require.Equal(t, errors.Cause(err), encoding.ErrInvalidSize) require.True(t, errors.Is(err, encoding.ErrInvalidSize))
}) })
t.Run("Test corrupted tombstone record", func(t *testing.T) { t.Run("Test corrupted tombstone record", func(t *testing.T) {
@ -232,7 +232,7 @@ func TestRecord_Corrupted(t *testing.T) {
corrupted := enc.Exemplars(exemplars, nil)[:8] corrupted := enc.Exemplars(exemplars, nil)[:8]
_, err := dec.Exemplars(corrupted, nil) _, err := dec.Exemplars(corrupted, nil)
require.Equal(t, errors.Cause(err), encoding.ErrInvalidSize) require.True(t, errors.Is(err, encoding.ErrInvalidSize))
}) })
t.Run("Test corrupted metadata record", func(t *testing.T) { t.Run("Test corrupted metadata record", func(t *testing.T) {
@ -242,7 +242,7 @@ func TestRecord_Corrupted(t *testing.T) {
corrupted := enc.Metadata(meta, nil)[:8] corrupted := enc.Metadata(meta, nil)[:8]
_, err := dec.Metadata(corrupted, nil) _, err := dec.Metadata(corrupted, nil)
require.Equal(t, errors.Cause(err), encoding.ErrInvalidSize) require.True(t, errors.Is(err, encoding.ErrInvalidSize))
}) })
t.Run("Test corrupted histogram record", func(t *testing.T) { t.Run("Test corrupted histogram record", func(t *testing.T) {
@ -267,7 +267,7 @@ func TestRecord_Corrupted(t *testing.T) {
corrupted := enc.HistogramSamples(histograms, nil)[:8] corrupted := enc.HistogramSamples(histograms, nil)[:8]
_, err := dec.HistogramSamples(corrupted, nil) _, err := dec.HistogramSamples(corrupted, nil)
require.Equal(t, errors.Cause(err), encoding.ErrInvalidSize) require.True(t, errors.Is(err, encoding.ErrInvalidSize))
}) })
} }