예제 #1
0
func (s *SysTestSuite) TestAtLeastVersion(t *C) {
	var got bool
	var err error

	v := "5.1"

	got, err = pct.AtLeastVersion("5.0", v)
	t.Check(err, IsNil)
	t.Check(got, Equals, false)

	got, err = pct.AtLeastVersion("ubuntu-something", v)
	t.Check(err, NotNil)
	t.Check(got, Equals, false)

	got, err = pct.AtLeastVersion("5.0.1-ubuntu-something", v)
	t.Check(err, IsNil)
	t.Check(got, Equals, false)

	got, err = pct.AtLeastVersion(v, v)
	t.Check(err, IsNil)
	t.Check(got, Equals, true)

	got, err = pct.AtLeastVersion("5.1.0-ubuntu-something", v)
	t.Check(err, IsNil)
	t.Check(got, Equals, true)

	got, err = pct.AtLeastVersion("10.1.0-MariaDB", v)
	t.Check(err, IsNil)
	t.Check(got, Equals, true)
}
예제 #2
0
// Check if version v2 is equal or higher than v1 (v2 >= v1)
// v2 can be in form m.n.o-ubuntu
func (c *Connection) AtLeastVersion(minVersion string) (bool, error) {
	return pct.AtLeastVersion(c.GetGlobalVarString("version"), minVersion)
}