MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestParseConfigFormat

Function TestParseConfigFormat

pkg/configs/api/api_test.go:355–376  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

353}
354
355func TestParseConfigFormat(t *testing.T) {
356 tests := []struct {
357 name string
358 defaultFormat string
359 expected string
360 }{
361 {"", FormatInvalid, FormatInvalid},
362 {"", FormatJSON, FormatJSON},
363 {"application/json", FormatInvalid, FormatJSON},
364 {"application/yaml", FormatInvalid, FormatYAML},
365 {"application/json, application/yaml", FormatInvalid, FormatJSON},
366 {"application/yaml, application/json", FormatInvalid, FormatYAML},
367 {"text/plain, application/yaml", FormatInvalid, FormatYAML},
368 {"application/yaml; a=1", FormatInvalid, FormatYAML},
369 }
370 for _, test := range tests {
371 t.Run(test.name+"_"+test.expected, func(t *testing.T) {
372 actual := parseConfigFormat(test.name, test.defaultFormat)
373 assert.Equal(t, test.expected, actual)
374 })
375 }
376}
377
378func Test_SetConfig_ValidateTemplateFiles(t *testing.T) {
379 cfg := userconfig.Config{

Callers

nothing calls this directly

Calls 3

parseConfigFormatFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected