MCPcopy
hub / github.com/cortexlabs/cortex / testConfig

Function testConfig

pkg/lib/configreader/reader_test.go:1022–1035  ·  view source on GitHub ↗
(structValidation *StructValidation, configData interface{}, expected interface{}, t *testing.T)

Source from the content-addressed store, hash-verified

1020}
1021
1022func testConfig(structValidation *StructValidation, configData interface{}, expected interface{}, t *testing.T) {
1023 config := reflect.New(reflect.TypeOf(expected).Elem()).Interface()
1024
1025 errs := Struct(config, configData, structValidation)
1026
1027 if errs != nil {
1028 for _, err := range errs {
1029 fmt.Println("ERROR: " + errors.Message(err))
1030 }
1031 }
1032 require.Empty(t, errs)
1033
1034 require.Equal(t, expected, config)
1035}
1036
1037func testConfigError(structValidation *StructValidation, configData interface{}, expectedTypeInstance interface{}, t *testing.T) {
1038 config := reflect.New(reflect.TypeOf(expectedTypeInstance).Elem()).Interface()

Callers 7

TestSimpleFunction · 0.85
TestNestedFunction · 0.85
TestNestedListFunction · 0.85
TestInterfaceFunction · 0.85
TestInterfaceListFunction · 0.85
TestDefaultNullFunction · 0.85
TestDefaultFieldFunction · 0.85

Calls 3

MessageFunction · 0.92
StructFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected