MCPcopy Create free account
hub / github.com/prometheus/common / TestInvalidSampleHistogramPairJSON

Function TestInvalidSampleHistogramPairJSON

model/value_histogram_test.go:385–401  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

383}
384
385func TestInvalidSampleHistogramPairJSON(t *testing.T) {
386 s1 := SampleHistogramPair{
387 Timestamp: 1,
388 Histogram: nil,
389 }
390 d, err := json.Marshal(s1)
391 if err == nil {
392 t.Errorf("expected error when trying to marshal invalid SampleHistogramPair %s", string(d))
393 }
394
395 var s2 SampleHistogramPair
396 plain := "[0.001,null]"
397 err = json.Unmarshal([]byte(plain), &s2)
398 if err == nil {
399 t.Errorf("expected error when trying to unmarshal invalid SampleHistogramPair %s", plain)
400 }
401}
402
403func TestSampleHistogramJSON(t *testing.T) {
404 input := []struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected