本文整理匯總了Golang中github.com/juju/juju/version.Number.Major方法的典型用法代碼示例。如果您正苦於以下問題:Golang Number.Major方法的具體用法?Golang Number.Major怎麽用?Golang Number.Major使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/version.Number
的用法示例。
在下文中一共展示了Number.Major方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestMongoRestoreArgsForVersion
func (s *mongoRestoreSuite) TestMongoRestoreArgsForVersion(c *gc.C) {
dir := filepath.Join(agent.DefaultDataDir, "db")
versionNumber := version.Number{}
versionNumber.Major = 1
versionNumber.Minor = 21
args, err := backups.MongoRestoreArgsForVersion(versionNumber, "/some/fake/path")
c.Assert(err, jc.ErrorIsNil)
c.Assert(args, gc.HasLen, 5)
c.Assert(args[0:5], jc.DeepEquals, []string{
"--drop",
"--journal",
"--dbpath",
dir,
"/some/fake/path",
})
versionNumber.Major = 1
versionNumber.Minor = 22
args, err = backups.MongoRestoreArgsForVersion(versionNumber, "/some/fake/path")
c.Assert(err, jc.ErrorIsNil)
c.Assert(args, gc.HasLen, 6)
c.Assert(args[0:6], jc.DeepEquals, []string{
"--drop",
"--journal",
"--oplogReplay",
"--dbpath",
dir,
"/some/fake/path",
})
versionNumber.Major = 0
versionNumber.Minor = 0
_, err = backups.MongoRestoreArgsForVersion(versionNumber, "/some/fake/path")
c.Assert(err, gc.ErrorMatches, "this backup file is incompatible with the current version of juju")
}
示例2: TestMongoRestoreArgsForOldVersion
func (s *mongoRestoreSuite) TestMongoRestoreArgsForOldVersion(c *gc.C) {
versionNumber := version.Number{}
versionNumber.Major = 0
versionNumber.Minor = 0
_, err := backups.MongoRestoreArgsForVersion(versionNumber, "/some/fake/path")
c.Assert(err, gc.ErrorMatches, "this backup file is incompatible with the current version of juju")
}
示例3: TestMongoRestoreArgsForVersion121
func (s *mongoRestoreSuite) TestMongoRestoreArgsForVersion121(c *gc.C) {
dir := filepath.Join(agent.DefaultPaths.DataDir, "db")
versionNumber := version.Number{}
versionNumber.Major = 1
versionNumber.Minor = 21
args, err := backups.MongoRestoreArgsForVersion(versionNumber, "/some/fake/path")
c.Assert(err, jc.ErrorIsNil)
c.Assert(args, gc.HasLen, 5)
c.Assert(args[0:5], jc.DeepEquals, []string{
"--drop",
"--journal",
"--dbpath",
dir,
"/some/fake/path",
})
}