pkg.re/essentialkaos/ek@v12.36.0+incompatible/knf/validators/system/validators_linux_test.go (about)

     1  // +build linux
     2  
     3  package system
     4  
     5  // ////////////////////////////////////////////////////////////////////////////////// //
     6  //                                                                                    //
     7  //                         Copyright (c) 2021 ESSENTIAL KAOS                          //
     8  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
     9  //                                                                                    //
    10  // ////////////////////////////////////////////////////////////////////////////////// //
    11  
    12  import (
    13  	"pkg.re/essentialkaos/ek.v12/knf"
    14  
    15  	. "pkg.re/essentialkaos/check.v1"
    16  )
    17  
    18  // ////////////////////////////////////////////////////////////////////////////////// //
    19  
    20  func (s *ValidatorSuite) TestInterfaceValidator(c *C) {
    21  	configFile := createConfig(c, _CONFIG_DATA)
    22  
    23  	err := knf.Global(configFile)
    24  	c.Assert(err, IsNil)
    25  
    26  	errs := knf.Validate([]*knf.Validator{
    27  		{"interface:test0", Interface, nil},
    28  		{"interface:test1", Interface, nil},
    29  	})
    30  
    31  	c.Assert(errs, HasLen, 0)
    32  
    33  	errs = knf.Validate([]*knf.Validator{
    34  		{"interface:test2", Interface, nil},
    35  	})
    36  
    37  	c.Assert(errs, HasLen, 1)
    38  }