(t *testing.T)
| 471 | } |
| 472 | |
| 473 | func TestCurryVecWithConstraints(t *testing.T) { |
| 474 | constraint := func(s string) string { return "x" + s } |
| 475 | t.Run("constrainedLabels overlap variableLabels", func(t *testing.T) { |
| 476 | vec := V2.NewCounterVec(CounterVecOpts{ |
| 477 | CounterOpts{ |
| 478 | Name: "test", |
| 479 | Help: "helpless", |
| 480 | }, |
| 481 | ConstrainedLabels{ |
| 482 | {Name: "one"}, |
| 483 | {Name: "two"}, |
| 484 | {Name: "three", Constraint: constraint}, |
| 485 | }, |
| 486 | }) |
| 487 | testCurryVec(t, vec) |
| 488 | }) |
| 489 | t.Run("constrainedLabels reducing cardinality", func(t *testing.T) { |
| 490 | constraint := func(s string) string { return "x" } |
| 491 | vec := V2.NewCounterVec(CounterVecOpts{ |
| 492 | CounterOpts{ |
| 493 | Name: "test", |
| 494 | Help: "helpless", |
| 495 | }, |
| 496 | ConstrainedLabels{ |
| 497 | {Name: "one"}, |
| 498 | {Name: "two"}, |
| 499 | {Name: "three", Constraint: constraint}, |
| 500 | }, |
| 501 | }) |
| 502 | testConstrainedCurryVec(t, vec, constraint) |
| 503 | }) |
| 504 | } |
| 505 | |
| 506 | func testCurryVec(t *testing.T, vec *CounterVec) { |
| 507 | assertMetrics := func(t *testing.T) { |
nothing calls this directly
no test coverage detected