(t *testing.T)
| 3454 | } |
| 3455 | |
| 3456 | func TestScrapeProtocolHeader(t *testing.T) { |
| 3457 | tests := []struct { |
| 3458 | name string |
| 3459 | proto ScrapeProtocol |
| 3460 | expectedValue string |
| 3461 | }{ |
| 3462 | { |
| 3463 | name: "blank", |
| 3464 | proto: ScrapeProtocol(""), |
| 3465 | expectedValue: "", |
| 3466 | }, |
| 3467 | { |
| 3468 | name: "invalid", |
| 3469 | proto: ScrapeProtocol("invalid"), |
| 3470 | expectedValue: "", |
| 3471 | }, |
| 3472 | { |
| 3473 | name: "prometheus protobuf", |
| 3474 | proto: PrometheusProto, |
| 3475 | expectedValue: "application/vnd.google.protobuf", |
| 3476 | }, |
| 3477 | { |
| 3478 | name: "prometheus text 0.0.4", |
| 3479 | proto: PrometheusText0_0_4, |
| 3480 | expectedValue: "text/plain", |
| 3481 | }, |
| 3482 | { |
| 3483 | name: "prometheus text 1.0.0", |
| 3484 | proto: PrometheusText1_0_0, |
| 3485 | expectedValue: "text/plain", |
| 3486 | }, |
| 3487 | { |
| 3488 | name: "openmetrics 0.0.1", |
| 3489 | proto: OpenMetricsText0_0_1, |
| 3490 | expectedValue: "application/openmetrics-text", |
| 3491 | }, |
| 3492 | { |
| 3493 | name: "openmetrics 1.0.0", |
| 3494 | proto: OpenMetricsText1_0_0, |
| 3495 | expectedValue: "application/openmetrics-text", |
| 3496 | }, |
| 3497 | } |
| 3498 | for _, tc := range tests { |
| 3499 | t.Run(tc.name, func(t *testing.T) { |
| 3500 | mediaType := tc.proto.HeaderMediaType() |
| 3501 | |
| 3502 | require.Equal(t, tc.expectedValue, mediaType) |
| 3503 | }) |
| 3504 | } |
| 3505 | } |
| 3506 | |
| 3507 | // Regression test against https://github.com/prometheus/prometheus/issues/15538 |
| 3508 | func TestGetScrapeConfigs_Loaded(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…