@@ -20,6 +20,8 @@ import (
20
20
"reflect"
21
21
"testing"
22
22
"time"
23
+
24
+ "k8s.io/node-problem-detector/pkg/types"
23
25
)
24
26
25
27
func TestCustomPluginConfigApplyConfiguration (t * testing.T ) {
@@ -279,6 +281,55 @@ func TestCustomPluginConfigValidate(t *testing.T) {
279
281
},
280
282
IsError : true ,
281
283
},
284
+ "permanent problem has preset default condition" : {
285
+ Conf : CustomPluginConfig {
286
+ Plugin : customPluginName ,
287
+ PluginGlobalConfig : pluginGlobalConfig {
288
+ InvokeInterval : & defaultInvokeInterval ,
289
+ Timeout : & defaultGlobalTimeout ,
290
+ MaxOutputLength : & defaultMaxOutputLength ,
291
+ Concurrency : & defaultConcurrency ,
292
+ },
293
+ DefaultConditions : []types.Condition {
294
+ {
295
+ Type : "TestCondition" ,
296
+ Reason : "TestConditionOK" ,
297
+ Message : "Test condition is OK." ,
298
+ },
299
+ },
300
+ Rules : []* CustomRule {
301
+ {
302
+ Type : types .Perm ,
303
+ Condition : "TestCondition" ,
304
+ Reason : "TestConditionFail" ,
305
+ Path : "../plugin/test-data/ok.sh" ,
306
+ Timeout : & normalRuleTimeout ,
307
+ },
308
+ },
309
+ },
310
+ IsError : false ,
311
+ },
312
+ "permanent problem does not have preset default condition" : {
313
+ Conf : CustomPluginConfig {
314
+ Plugin : customPluginName ,
315
+ PluginGlobalConfig : pluginGlobalConfig {
316
+ InvokeInterval : & defaultInvokeInterval ,
317
+ Timeout : & defaultGlobalTimeout ,
318
+ MaxOutputLength : & defaultMaxOutputLength ,
319
+ Concurrency : & defaultConcurrency ,
320
+ },
321
+ Rules : []* CustomRule {
322
+ {
323
+ Type : types .Perm ,
324
+ Condition : "TestCondition" ,
325
+ Reason : "TestConditionFail" ,
326
+ Path : "../plugin/test-data/ok.sh" ,
327
+ Timeout : & normalRuleTimeout ,
328
+ },
329
+ },
330
+ },
331
+ IsError : true ,
332
+ },
282
333
}
283
334
284
335
for desp , utMeta := range utMetas {
0 commit comments