(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestInstrumentedGate(t *testing.T) { |
| 69 | t.Run("max concurrency", func(t *testing.T) { |
| 70 | concurrency := 1 |
| 71 | reg := prometheus.NewPedanticRegistry() |
| 72 | _ = NewInstrumented(reg, concurrency, NewNoop()) |
| 73 | |
| 74 | require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(` |
| 75 | # HELP gate_queries_concurrent_max Number of maximum concurrent queries allowed. |
| 76 | # TYPE gate_queries_concurrent_max gauge |
| 77 | gate_queries_concurrent_max 1 |
| 78 | `), "gate_queries_concurrent_max")) |
| 79 | }) |
| 80 | |
| 81 | t.Run("inflight requests", func(t *testing.T) { |
| 82 | concurrency := 1 |
| 83 | reg := prometheus.NewPedanticRegistry() |
| 84 | g := NewInstrumented(reg, concurrency, NewNoop()) |
| 85 | |
| 86 | require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(` |
| 87 | # HELP gate_queries_in_flight Number of queries that are currently in flight. |
| 88 | # TYPE gate_queries_in_flight gauge |
| 89 | gate_queries_in_flight 0 |
| 90 | `), "gate_queries_in_flight")) |
| 91 | |
| 92 | require.NoError(t, g.Start(context.Background())) |
| 93 | |
| 94 | require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(` |
| 95 | # HELP gate_queries_in_flight Number of queries that are currently in flight. |
| 96 | # TYPE gate_queries_in_flight gauge |
| 97 | gate_queries_in_flight 1 |
| 98 | `), "gate_queries_in_flight")) |
| 99 | }) |
| 100 | } |
nothing calls this directly
no test coverage detected