本文整理汇总了Golang中github.com/juju/juju/environs/testing.CheckTools函数的典型用法代码示例。如果您正苦于以下问题:Golang CheckTools函数的具体用法?Golang CheckTools怎么用?Golang CheckTools使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckTools函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestUpgraderAllowsDowngradeToOrigVersionIfUpgradeInProgress
func (s *UpgraderSuite) TestUpgraderAllowsDowngradeToOrigVersionIfUpgradeInProgress(c *gc.C) {
// note: otherwise illegal version jump
downgradeVersion := version.MustParseBinary("5.3.0-precise-amd64")
s.confVersion = downgradeVersion.Number
s.upgradeRunning = true
stor := s.DefaultToolsStorage
origTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, origTools.Version)
downgradeTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), downgradeVersion)[0]
err := statetesting.SetAgentVersion(s.State, downgradeVersion.Number)
c.Assert(err, jc.ErrorIsNil)
dummy.SetStorageDelay(coretesting.ShortWait)
u := s.makeUpgrader(c)
err = u.Stop()
s.expectUpgradeChannelNotClosed(c)
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: origTools.Version,
NewTools: downgradeVersion,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), downgradeTools.Version)
c.Assert(err, jc.ErrorIsNil)
downgradeTools.URL = fmt.Sprintf("https://%s/environment/%s/tools/5.3.0-precise-amd64",
s.APIState.Addr(), coretesting.EnvironmentTag.Id())
envtesting.CheckTools(c, foundTools, downgradeTools)
}
示例2: TestUpgraderUpgradesImmediately
func (s *UpgraderSuite) TestUpgraderUpgradesImmediately(c *gc.C) {
stor := s.Environ.Storage()
oldTools := envtesting.PrimeTools(c, stor, s.DataDir(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, oldTools.Version)
newTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, version.MustParseBinary("5.4.5-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, newTools.Version.Number)
c.Assert(err, gc.IsNil)
// Make the download take a while so that we verify that
// the download happens before the upgrader checks if
// it's been stopped.
dummy.SetStorageDelay(coretesting.ShortWait)
u := s.makeUpgrader()
err = u.Stop()
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: oldTools.Version,
NewTools: newTools.Version,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), newTools.Version)
c.Assert(err, gc.IsNil)
envtesting.CheckTools(c, foundTools, newTools)
}
示例3: TestUpgraderUpgradesImmediately
func (s *UpgraderSuite) TestUpgraderUpgradesImmediately(c *gc.C) {
stor := s.DefaultToolsStorage
oldTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, oldTools.Version)
newTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.5-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, newTools.Version.Number)
c.Assert(err, jc.ErrorIsNil)
// Make the download take a while so that we verify that
// the download happens before the upgrader checks if
// it's been stopped.
dummy.SetStorageDelay(coretesting.ShortWait)
u := s.makeUpgrader(c)
err = u.Stop()
s.expectUpgradeChannelNotClosed(c)
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: oldTools.Version,
NewTools: newTools.Version,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), newTools.Version)
c.Assert(err, jc.ErrorIsNil)
newTools.URL = fmt.Sprintf("https://%s/environment/%s/tools/5.4.5-precise-amd64",
s.APIState.Addr(), coretesting.EnvironmentTag.Id())
envtesting.CheckTools(c, foundTools, newTools)
}
示例4: TestUpgraderSetsTools
func (s *UpgraderSuite) TestUpgraderSetsTools(c *gc.C) {
vers := version.MustParseBinary("5.4.3-precise-amd64")
err := statetesting.SetAgentVersion(s.State, vers.Number)
c.Assert(err, gc.IsNil)
stor := s.Environ.Storage()
agentTools := envtesting.PrimeTools(c, stor, s.DataDir(), vers)
s.PatchValue(&version.Current, agentTools.Version)
err = envtools.MergeAndWriteMetadata(stor, coretools.List{agentTools}, envtools.DoNotWriteMirrors)
_, err = s.machine.AgentTools()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
u := s.makeUpgrader()
statetesting.AssertStop(c, u)
s.machine.Refresh()
gotTools, err := s.machine.AgentTools()
c.Assert(err, gc.IsNil)
envtesting.CheckTools(c, gotTools, agentTools)
}
示例5: TestUpgraderSetsTools
func (s *UpgraderSuite) TestUpgraderSetsTools(c *gc.C) {
vers := version.MustParseBinary("5.4.3-precise-amd64")
err := statetesting.SetAgentVersion(s.State, vers.Number)
c.Assert(err, jc.ErrorIsNil)
stor := s.DefaultToolsStorage
agentTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), vers)
s.patchVersion(agentTools.Version)
err = envtools.MergeAndWriteMetadata(stor, "released", "released", coretools.List{agentTools}, envtools.DoNotWriteMirrors)
_, err = s.machine.AgentTools()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
u := s.makeUpgrader(c)
statetesting.AssertStop(c, u)
s.expectInitialUpgradeCheckDone(c)
s.machine.Refresh()
gotTools, err := s.machine.AgentTools()
c.Assert(err, jc.ErrorIsNil)
envtesting.CheckTools(c, gotTools, agentTools)
}
示例6: TestUpgraderAllowsDowngradingPatchVersions
func (s *UpgraderSuite) TestUpgraderAllowsDowngradingPatchVersions(c *gc.C) {
stor := s.Environ.Storage()
origTools := envtesting.PrimeTools(c, stor, s.DataDir(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, origTools.Version)
downgradeTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, version.MustParseBinary("5.4.2-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, downgradeTools.Version.Number)
c.Assert(err, gc.IsNil)
dummy.SetStorageDelay(coretesting.ShortWait)
u := s.makeUpgrader()
err = u.Stop()
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: origTools.Version,
NewTools: downgradeTools.Version,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), downgradeTools.Version)
c.Assert(err, gc.IsNil)
envtesting.CheckTools(c, foundTools, downgradeTools)
}
示例7: TestUpgraderAllowsDowngradingPatchVersions
func (s *UpgraderSuite) TestUpgraderAllowsDowngradingPatchVersions(c *gc.C) {
stor := s.DefaultToolsStorage
origTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.3-precise-amd64"))
s.patchVersion(origTools.Version)
downgradeTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.2-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, downgradeTools.Version.Number)
c.Assert(err, jc.ErrorIsNil)
u := s.makeUpgrader(c)
err = u.Stop()
s.expectInitialUpgradeCheckNotDone(c)
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: origTools.Version,
NewTools: downgradeTools.Version,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), downgradeTools.Version)
c.Assert(err, jc.ErrorIsNil)
downgradeTools.URL = fmt.Sprintf("https://%s/model/%s/tools/5.4.2-precise-amd64",
s.APIState.Addr(), coretesting.ModelTag.Id())
envtesting.CheckTools(c, foundTools, downgradeTools)
}
示例8: TestUpgraderUpgradesImmediately
func (s *UpgraderSuite) TestUpgraderUpgradesImmediately(c *gc.C) {
stor := s.DefaultToolsStorage
oldTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.3-precise-amd64"))
s.patchVersion(oldTools.Version)
newTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.5-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, newTools.Version.Number)
c.Assert(err, jc.ErrorIsNil)
u := s.makeUpgrader(c)
err = u.Stop()
s.expectUpgradeChannelNotClosed(c)
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: oldTools.Version,
NewTools: newTools.Version,
DataDir: s.DataDir(),
})
foundTools, err := agenttools.ReadTools(s.DataDir(), newTools.Version)
c.Assert(err, jc.ErrorIsNil)
newTools.URL = fmt.Sprintf("https://%s/environment/%s/tools/5.4.5-precise-amd64",
s.APIState.Addr(), coretesting.EnvironmentTag.Id())
envtesting.CheckTools(c, foundTools, newTools)
}