pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/system/info_darwin_test.go (about)

     1  package system
     2  
     3  // ////////////////////////////////////////////////////////////////////////////////// //
     4  //                                                                                    //
     5  //                         Copyright (c) 2022 ESSENTIAL KAOS                          //
     6  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
     7  //                                                                                    //
     8  // ////////////////////////////////////////////////////////////////////////////////// //
     9  
    10  import (
    11  	"testing"
    12  
    13  	. "pkg.re/essentialkaos/check.v1"
    14  )
    15  
    16  // ////////////////////////////////////////////////////////////////////////////////// //
    17  
    18  func Test(t *testing.T) { TestingT(t) }
    19  
    20  type SystemSuite struct{}
    21  
    22  // ////////////////////////////////////////////////////////////////////////////////// //
    23  
    24  var _ = Suite(&SystemSuite{})
    25  
    26  // ////////////////////////////////////////////////////////////////////////////////// //
    27  
    28  func (s *SystemSuite) TestUptime(c *C) {
    29  	uptime, err := GetUptime()
    30  
    31  	c.Assert(err, IsNil)
    32  	c.Assert(uptime, Not(Equals), 0)
    33  }
    34  
    35  func (s *SystemSuite) TestLoadAvg(c *C) {
    36  	la, err := GetLA()
    37  
    38  	c.Assert(err, IsNil)
    39  	c.Assert(la, NotNil)
    40  }
    41  
    42  func (s *SystemSuite) TestUser(c *C) {
    43  	c.Assert(IsUserExist("root"), Equals, true)
    44  	c.Assert(IsUserExist("_unknown_"), Equals, false)
    45  	c.Assert(IsGroupExist("wheel"), Equals, true)
    46  	c.Assert(IsGroupExist("_unknown_"), Equals, false)
    47  }