@@ -127,32 +127,34 @@ func TestValidateConfig(t *testing.T) {
127127 }
128128
129129 for _ , tt := range table {
130- logger := logrus .NewEntry (logrus .New ())
131- // load schema for config definitions
132- instance := load .Instances ([]string {"." }, & load.Config {
133- Dir : schemaPath ,
134- })
135- if len (instance ) > 1 {
136- t .Fatalf ("multiple instance loading currently not supported: %s" , schemaPath )
137- }
138- if len (instance ) < 1 {
139- t .Fatalf ("no instances found: %s" , schemaPath )
140- }
130+ t .Run (tt .description , func (t * testing.T ) {
131+ logger := logrus .NewEntry (logrus .New ())
132+ // load schema for config definitions
133+ instance := load .Instances ([]string {"." }, & load.Config {
134+ Dir : schemaPath ,
135+ })
136+ if len (instance ) > 1 {
137+ t .Fatalf ("multiple instance loading currently not supported: %s" , schemaPath )
138+ }
139+ if len (instance ) < 1 {
140+ t .Fatalf ("no instances found: %s" , schemaPath )
141+ }
141142
142- // Config validator
143- configValidator := NewConfigValidator (instance [0 ], logger )
144- // Read json file
145- content , err := ioutil .ReadFile (tt .filename )
146- require .NoError (t , err )
143+ // Config validator
144+ configValidator := NewConfigValidator (instance [0 ], logger )
145+ // Read json file
146+ content , err := ioutil .ReadFile (tt .filename )
147+ require .NoError (t , err )
147148
148- // Validate json against schema
149- err = configValidator .Validate (content , tt .kind )
149+ // Validate json against schema
150+ err = configValidator .Validate (content , tt .kind )
150151
151- if tt .hasError {
152- require .Error (t , err )
153- require .Contains (t , err .Error (), tt .errString )
154- } else {
155- require .NoError (t , err )
156- }
152+ if tt .hasError {
153+ require .Error (t , err )
154+ require .Contains (t , err .Error (), tt .errString )
155+ } else {
156+ require .NoError (t , err )
157+ }
158+ })
157159 }
158160}
0 commit comments