mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Update record_test.go
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
63691d82a5
commit
69c07ec6ae
|
@ -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))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue