示例#1
0
func (*kernelVersionSuite) TestKernelToMajorVersionEmpty(c *gc.C) {
	majorVersion, err := series.KernelToMajor(func() (string, error) {
		return "", nil
	})
	c.Assert(err, gc.ErrorMatches, `strconv.ParseInt: parsing "": invalid syntax`)
	c.Check(majorVersion, gc.Equals, 0)
}
示例#2
0
func (*kernelVersionSuite) TestKernelToMajorVersionNoDots(c *gc.C) {
	majorVersion, err := series.KernelToMajor(func() (string, error) {
		return "1234", nil
	})
	c.Assert(err, jc.ErrorIsNil)
	c.Check(majorVersion, gc.Equals, 1234)
}
示例#3
0
func (*kernelVersionSuite) TestKernelToMajorVersionError(c *gc.C) {
	majorVersion, err := series.KernelToMajor(sysctlError)
	c.Assert(err, gc.ErrorMatches, "no such syscall")
	c.Check(majorVersion, gc.Equals, 0)
}
示例#4
0
func (*kernelVersionSuite) TestKernelToMajorVersion(c *gc.C) {
	majorVersion, err := series.KernelToMajor(sysctlMacOS10dot9dot2)
	c.Assert(err, jc.ErrorIsNil)
	c.Check(majorVersion, gc.Equals, 13)
}