(t *testing.T)
| 403 | } |
| 404 | |
| 405 | func TestGetSortedServerNames(t *testing.T) { |
| 406 | metrics := &GatewayMetrics{ |
| 407 | Servers: map[string]*GatewayServerMetrics{ |
| 408 | "github": { |
| 409 | ServerName: "github", |
| 410 | RequestCount: 10, |
| 411 | }, |
| 412 | "playwright": { |
| 413 | ServerName: "playwright", |
| 414 | RequestCount: 5, |
| 415 | }, |
| 416 | "tavily": { |
| 417 | ServerName: "tavily", |
| 418 | RequestCount: 15, |
| 419 | }, |
| 420 | }, |
| 421 | } |
| 422 | |
| 423 | names := getSortedServerNames(metrics) |
| 424 | require.Len(t, names, 3) |
| 425 | |
| 426 | // Should be sorted by request count (descending) |
| 427 | assert.Equal(t, "tavily", names[0]) |
| 428 | assert.Equal(t, "github", names[1]) |
| 429 | assert.Equal(t, "playwright", names[2]) |
| 430 | } |
| 431 | |
| 432 | func TestGatewayLogsWithMethodField(t *testing.T) { |
| 433 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected