(t *testing.T)
| 117 | } |
| 118 | |
| 119 | func TestFrontendCheckReady(t *testing.T) { |
| 120 | limits := MockLimits{MockLimits: queue.MockLimits{MaxOutstanding: 100}} |
| 121 | for _, tt := range []struct { |
| 122 | name string |
| 123 | connectedClients int |
| 124 | msg string |
| 125 | readyForRequests bool |
| 126 | }{ |
| 127 | {"connected clients are ready", 3, "", true}, |
| 128 | {"no url, no clients is not ready", 0, "not ready: number of queriers connected to query-frontend is 0", false}, |
| 129 | } { |
| 130 | t.Run(tt.name, func(t *testing.T) { |
| 131 | f := &Frontend{ |
| 132 | log: log.NewNopLogger(), |
| 133 | requestQueue: queue.NewRequestQueue(5, |
| 134 | prometheus.NewGaugeVec(prometheus.GaugeOpts{}, []string{"user"}), |
| 135 | prometheus.NewCounterVec(prometheus.CounterOpts{}, []string{"user"}), |
| 136 | limits, |
| 137 | nil, |
| 138 | ), |
| 139 | } |
| 140 | for i := 0; i < tt.connectedClients; i++ { |
| 141 | f.requestQueue.RegisterQuerierConnection("test") |
| 142 | } |
| 143 | err := f.CheckReady(context.Background()) |
| 144 | errMsg := "" |
| 145 | |
| 146 | if err != nil { |
| 147 | errMsg = err.Error() |
| 148 | } |
| 149 | |
| 150 | require.Equal(t, tt.msg, errMsg) |
| 151 | }) |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | // TestFrontendCancel ensures that when client requests are cancelled, |
| 156 | // the underlying query is correctly cancelled _and not retried_. |
nothing calls this directly
no test coverage detected