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

Function TestInvalidSampleHistogramPairJSON

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected