(t *testing.T)
| 414 | } |
| 415 | |
| 416 | func TestCounterVecEndToEndWithCollision(t *testing.T) { |
| 417 | vec := NewCounterVec( |
| 418 | CounterOpts{ |
| 419 | Name: "test", |
| 420 | Help: "helpless", |
| 421 | }, |
| 422 | []string{"labelname"}, |
| 423 | ) |
| 424 | vec.WithLabelValues("77kepQFQ8Kl").Inc() |
| 425 | vec.WithLabelValues("!0IC=VloaY").Add(2) |
| 426 | |
| 427 | m := &dto.Metric{} |
| 428 | if err := vec.WithLabelValues("77kepQFQ8Kl").Write(m); err != nil { |
| 429 | t.Fatal(err) |
| 430 | } |
| 431 | if got, want := m.GetLabel()[0].GetValue(), "77kepQFQ8Kl"; got != want { |
| 432 | t.Errorf("got label value %q, want %q", got, want) |
| 433 | } |
| 434 | if got, want := m.GetCounter().GetValue(), 1.; got != want { |
| 435 | t.Errorf("got value %f, want %f", got, want) |
| 436 | } |
| 437 | m.Reset() |
| 438 | if err := vec.WithLabelValues("!0IC=VloaY").Write(m); err != nil { |
| 439 | t.Fatal(err) |
| 440 | } |
| 441 | if got, want := m.GetLabel()[0].GetValue(), "!0IC=VloaY"; got != want { |
| 442 | t.Errorf("got label value %q, want %q", got, want) |
| 443 | } |
| 444 | if got, want := m.GetCounter().GetValue(), 2.; got != want { |
| 445 | t.Errorf("got value %f, want %f", got, want) |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | func TestCurryVec(t *testing.T) { |
| 450 | vec := NewCounterVec( |
nothing calls this directly
no test coverage detected