(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestSummaryWithDefaultObjectives(t *testing.T) { |
| 29 | now := time.Now() |
| 30 | |
| 31 | reg := NewRegistry() |
| 32 | summaryWithDefaultObjectives := NewSummary(SummaryOpts{ |
| 33 | Name: "default_objectives", |
| 34 | Help: "Test help.", |
| 35 | now: func() time.Time { return now }, |
| 36 | }) |
| 37 | if err := reg.Register(summaryWithDefaultObjectives); err != nil { |
| 38 | t.Error(err) |
| 39 | } |
| 40 | |
| 41 | m := &dto.Metric{} |
| 42 | if err := summaryWithDefaultObjectives.Write(m); err != nil { |
| 43 | t.Error(err) |
| 44 | } |
| 45 | if len(m.GetSummary().Quantile) != 0 { |
| 46 | t.Error("expected no objectives in summary") |
| 47 | } |
| 48 | |
| 49 | if !m.Summary.CreatedTimestamp.AsTime().Equal(now) { |
| 50 | t.Errorf("expected created timestamp %s, got %s", now, m.Summary.CreatedTimestamp.AsTime()) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestSummaryWithoutObjectives(t *testing.T) { |
| 55 | reg := NewRegistry() |
nothing calls this directly
no test coverage detected