本文整理汇总了Golang中github.com/juju/juju/environs/testing.PrimeTools函数的典型用法代码示例。如果您正苦于以下问题:Golang PrimeTools函数的具体用法?Golang PrimeTools怎么用?Golang PrimeTools使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrimeTools函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:29,代码来源:upgrader_test.go
示例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)
}
开发者ID:klyachin,项目名称:juju,代码行数:26,代码来源:upgrader_test.go
示例3: primeAgent
// primeAgent writes the configuration file and tools with version vers
// for an agent with the given entity name. It returns the agent's
// configuration and the current tools.
func (s *agentSuite) primeAgent(c *gc.C, tag, password string, vers version.Binary) (agent.ConfigSetterWriter, *coretools.Tools) {
stor := s.Conn.Environ.Storage()
agentTools := envtesting.PrimeTools(c, stor, s.DataDir(), vers)
err := envtools.MergeAndWriteMetadata(stor, coretools.List{agentTools}, envtools.DoNotWriteMirrors)
c.Assert(err, gc.IsNil)
tools1, err := agenttools.ChangeAgentTools(s.DataDir(), tag, vers)
c.Assert(err, gc.IsNil)
c.Assert(tools1, gc.DeepEquals, agentTools)
stateInfo := s.StateInfo(c)
apiInfo := s.APIInfo(c)
conf, err := agent.NewAgentConfig(
agent.AgentConfigParams{
DataDir: s.DataDir(),
Tag: tag,
UpgradedToVersion: vers.Number,
Password: password,
Nonce: state.BootstrapNonce,
StateAddresses: stateInfo.Addrs,
APIAddresses: apiInfo.Addrs,
CACert: stateInfo.CACert,
})
conf.SetPassword(password)
c.Assert(conf.Write(), gc.IsNil)
s.primeAPIHostPorts(c)
return conf, agentTools
}
开发者ID:rogpeppe,项目名称:juju,代码行数:30,代码来源:agent_test.go
示例4: PrimeAgentVersion
// PrimeAgentVersion writes the configuration file and tools with version
// vers for an agent with the given entity name. It returns the agent's
// configuration and the current tools.
func (s *AgentSuite) PrimeAgentVersion(c *gc.C, tag names.Tag, password string, vers version.Binary) (agent.ConfigSetterWriter, *coretools.Tools) {
c.Logf("priming agent %s", tag.String())
stor, err := filestorage.NewFileStorageWriter(c.MkDir())
c.Assert(err, jc.ErrorIsNil)
agentTools := envtesting.PrimeTools(c, stor, s.DataDir(), "released", vers)
err = envtools.MergeAndWriteMetadata(stor, "released", "released", coretools.List{agentTools}, envtools.DoNotWriteMirrors)
tools1, err := agenttools.ChangeAgentTools(s.DataDir(), tag.String(), vers)
c.Assert(err, jc.ErrorIsNil)
c.Assert(tools1, gc.DeepEquals, agentTools)
stateInfo := s.MongoInfo(c)
apiInfo := s.APIInfo(c)
paths := agent.DefaultPaths
paths.DataDir = s.DataDir()
conf, err := agent.NewAgentConfig(
agent.AgentConfigParams{
Paths: paths,
Tag: tag,
UpgradedToVersion: vers.Number,
Password: password,
Nonce: agent.BootstrapNonce,
StateAddresses: stateInfo.Addrs,
APIAddresses: apiInfo.Addrs,
CACert: stateInfo.CACert,
Model: apiInfo.ModelTag,
})
c.Assert(err, jc.ErrorIsNil)
conf.SetPassword(password)
c.Assert(conf.Write(), gc.IsNil)
s.primeAPIHostPorts(c)
return conf, agentTools
}
开发者ID:pmatulis,项目名称:juju,代码行数:35,代码来源:agent.go
示例5: 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)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:31,代码来源:upgrader_test.go
示例6: TestUpgraderRetryAndChanged
func (s *UpgraderSuite) TestUpgraderRetryAndChanged(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)
retryc := make(chan time.Time)
*upgrader.RetryAfter = func() <-chan time.Time {
c.Logf("replacement retry after")
return retryc
}
err = stor.Remove(envtools.StorageName(newTools.Version, "released"))
c.Assert(err, jc.ErrorIsNil)
u := s.makeUpgrader(c)
defer u.Stop()
s.expectUpgradeChannelNotClosed(c)
for i := 0; i < 3; i++ {
select {
case retryc <- time.Now():
case <-time.After(coretesting.LongWait):
c.Fatalf("upgrader did not retry (attempt %d)", i)
}
}
// Make it upgrade to some newer tools that can be
// downloaded ok; it should stop retrying, download
// the newer tools and exit.
newerTools := envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), version.MustParseBinary("5.4.6-precise-amd64"))[0]
err = statetesting.SetAgentVersion(s.State, newerTools.Version.Number)
c.Assert(err, jc.ErrorIsNil)
s.BackingState.StartSync()
done := make(chan error)
go func() {
done <- u.Wait()
}()
select {
case err := <-done:
envtesting.CheckUpgraderReadyError(c, err, &upgrader.UpgradeReadyError{
AgentName: s.machine.Tag().String(),
OldTools: oldTools.Version,
NewTools: newerTools.Version,
DataDir: s.DataDir(),
})
case <-time.After(coretesting.LongWait):
c.Fatalf("upgrader did not quit after upgrading")
}
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:54,代码来源:upgrader_test.go
示例7: TestEnsureToolsChecksBeforeDownloading
func (s *UpgraderSuite) TestEnsureToolsChecksBeforeDownloading(c *gc.C) {
stor := s.Environ.Storage()
newTools := envtesting.PrimeTools(c, stor, s.DataDir(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, newTools.Version)
// We've already downloaded the tools, so change the URL to be
// something invalid and ensure we don't actually get an error, because
// it doesn't actually do an HTTP request
u := s.makeUpgrader()
newTools.URL = "http://0.1.2.3/invalid/path/tools.tgz"
err := upgrader.EnsureTools(u, newTools, utils.VerifySSLHostnames)
c.Assert(err, gc.IsNil)
}
开发者ID:klyachin,项目名称:juju,代码行数:12,代码来源:upgrader_test.go
示例8: primeStateAgent
// primeStateAgent writes the configuration file and tools with version vers
// for an agent with the given entity name. It returns the agent's configuration
// and the current tools.
func (s *agentSuite) primeStateAgent(
c *gc.C, tag, password string, vers version.Binary) (agent.ConfigSetterWriter, *coretools.Tools) {
agentTools := envtesting.PrimeTools(c, s.Conn.Environ.Storage(), s.DataDir(), vers)
tools1, err := agenttools.ChangeAgentTools(s.DataDir(), tag, vers)
c.Assert(err, gc.IsNil)
c.Assert(tools1, gc.DeepEquals, agentTools)
stateInfo := s.StateInfo(c)
conf := writeStateAgentConfig(c, stateInfo, s.DataDir(), tag, password, vers)
s.primeAPIHostPorts(c)
return conf, agentTools
}
开发者ID:rogpeppe,项目名称:juju,代码行数:16,代码来源:agent_test.go
示例9: PrimeStateAgentVersion
// PrimeStateAgentVersion writes the configuration file and tools with
// version vers for a state agent with the given entity name. It
// returns the agent's configuration and the current tools.
func (s *AgentSuite) PrimeStateAgentVersion(c *gc.C, tag names.Tag, password string, vers version.Binary) (
agent.ConfigSetterWriter, *coretools.Tools,
) {
stor, err := filestorage.NewFileStorageWriter(c.MkDir())
c.Assert(err, jc.ErrorIsNil)
agentTools := envtesting.PrimeTools(c, stor, s.DataDir(), "released", vers)
tools1, err := agenttools.ChangeAgentTools(s.DataDir(), tag.String(), vers)
c.Assert(err, jc.ErrorIsNil)
c.Assert(tools1, gc.DeepEquals, agentTools)
conf := s.WriteStateAgentConfig(c, tag, password, vers, s.State.ModelTag())
s.primeAPIHostPorts(c)
return conf, agentTools
}
开发者ID:pmatulis,项目名称:juju,代码行数:17,代码来源:agent.go
示例10: 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)
}
开发者ID:klyachin,项目名称:juju,代码行数:18,代码来源:upgrader_test.go
示例11: TestUpgraderSetVersion
func (s *UpgraderSuite) TestUpgraderSetVersion(c *gc.C) {
vers := version.MustParseBinary("5.4.3-precise-amd64")
agentTools := envtesting.PrimeTools(c, s.Environ.Storage(), s.DataDir(), vers)
s.PatchValue(&version.Current, agentTools.Version)
err := os.RemoveAll(filepath.Join(s.DataDir(), "tools"))
c.Assert(err, gc.IsNil)
_, err = s.machine.AgentTools()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
err = statetesting.SetAgentVersion(s.State, vers.Number)
c.Assert(err, gc.IsNil)
u := s.makeUpgrader()
statetesting.AssertStop(c, u)
s.machine.Refresh()
gotTools, err := s.machine.AgentTools()
c.Assert(err, gc.IsNil)
c.Assert(gotTools, gc.DeepEquals, &coretools.Tools{Version: version.Current})
}
开发者ID:klyachin,项目名称:juju,代码行数:19,代码来源:upgrader_test.go
示例12: 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)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:19,代码来源:upgrader_test.go
示例13: TestUpgraderSetVersion
func (s *UpgraderSuite) TestUpgraderSetVersion(c *gc.C) {
vers := version.MustParseBinary("5.4.3-precise-amd64")
agentTools := envtesting.PrimeTools(c, s.DefaultToolsStorage, s.DataDir(), s.Environ.Config().AgentStream(), vers)
s.patchVersion(agentTools.Version)
err := os.RemoveAll(filepath.Join(s.DataDir(), "tools"))
c.Assert(err, jc.ErrorIsNil)
_, err = s.machine.AgentTools()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
err = statetesting.SetAgentVersion(s.State, vers.Number)
c.Assert(err, jc.ErrorIsNil)
u := s.makeUpgrader(c)
statetesting.AssertStop(c, u)
s.expectInitialUpgradeCheckDone(c)
s.machine.Refresh()
gotTools, err := s.machine.AgentTools()
c.Assert(err, jc.ErrorIsNil)
c.Assert(gotTools, gc.DeepEquals, &coretools.Tools{Version: vers})
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:20,代码来源:upgrader_test.go
示例14: TestUpgraderRefusesToDowngradeMinorVersions
func (s *UpgraderSuite) TestUpgraderRefusesToDowngradeMinorVersions(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.3.3-precise-amd64"))[0]
err := statetesting.SetAgentVersion(s.State, downgradeTools.Version.Number)
c.Assert(err, gc.IsNil)
u := s.makeUpgrader()
err = u.Stop()
// If the upgrade would have triggered, we would have gotten an
// UpgradeReadyError, since it was skipped, we get no error
c.Check(err, gc.IsNil)
_, err = agenttools.ReadTools(s.DataDir(), downgradeTools.Version)
// TODO: ReadTools *should* be returning some form of errors.NotFound,
// however, it just passes back a fmt.Errorf so we live with it
// c.Assert(err, jc.Satisfies, errors.IsNotFound)
c.Check(err, gc.ErrorMatches, "cannot read tools metadata in tools directory.*no such file or directory")
}
开发者ID:klyachin,项目名称:juju,代码行数:20,代码来源:upgrader_test.go
示例15: TestUpgraderRefusesDowngradeToOrigVersionIfUpgradeNotInProgress
func (s *UpgraderSuite) TestUpgraderRefusesDowngradeToOrigVersionIfUpgradeNotInProgress(c *gc.C) {
downgradeVersion := version.MustParseBinary("5.3.0-precise-amd64")
s.confVersion = downgradeVersion.Number
s.upgradeRunning = false
stor := s.Environ.Storage()
origTools := envtesting.PrimeTools(c, stor, s.DataDir(), version.MustParseBinary("5.4.3-precise-amd64"))
s.PatchValue(&version.Current, origTools.Version)
envtesting.AssertUploadFakeToolsVersions(c, stor, downgradeVersion)
err := statetesting.SetAgentVersion(s.State, downgradeVersion.Number)
c.Assert(err, gc.IsNil)
dummy.SetStorageDelay(coretesting.ShortWait)
u := s.makeUpgrader(c)
err = u.Stop()
// If the upgrade would have triggered, we would have gotten an
// UpgradeReadyError, since it was skipped, we get no error
c.Check(err, gc.IsNil)
}
开发者ID:zhouqt,项目名称:juju,代码行数:21,代码来源:upgrader_test.go
示例16: TestUpgraderRefusesDowngradeToOrigVersionIfUpgradeNotInProgress
func (s *UpgraderSuite) TestUpgraderRefusesDowngradeToOrigVersionIfUpgradeNotInProgress(c *gc.C) {
downgradeVersion := version.MustParseBinary("5.3.0-precise-amd64")
s.confVersion = downgradeVersion.Number
s.upgradeStepsComplete.Unlock()
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)
envtesting.AssertUploadFakeToolsVersions(
c, stor, s.Environ.Config().AgentStream(), s.Environ.Config().AgentStream(), downgradeVersion)
err := statetesting.SetAgentVersion(s.State, downgradeVersion.Number)
c.Assert(err, jc.ErrorIsNil)
u := s.makeUpgrader(c)
err = u.Stop()
s.expectInitialUpgradeCheckDone(c)
// If the upgrade would have triggered, we would have gotten an
// UpgradeReadyError, since it was skipped, we get no error
c.Check(err, jc.ErrorIsNil)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:21,代码来源:upgrader_test.go
示例17: TestChangeAgentTools
func (s *UpgraderSuite) TestChangeAgentTools(c *gc.C) {
oldTools := &coretools.Tools{
Version: version.MustParseBinary("1.2.3-quantal-amd64"),
}
stor := s.DefaultToolsStorage
newToolsBinary := "5.4.3-precise-amd64"
newTools := envtesting.PrimeTools(c, stor, s.DataDir(), s.Environ.Config().AgentStream(), version.MustParseBinary(newToolsBinary))
s.PatchValue(&version.Current, newTools.Version)
err := envtools.MergeAndWriteMetadata(stor, "released", "released", coretools.List{newTools}, envtools.DoNotWriteMirrors)
c.Assert(err, jc.ErrorIsNil)
ugErr := &upgrader.UpgradeReadyError{
AgentName: "anAgent",
OldTools: oldTools.Version,
NewTools: newTools.Version,
DataDir: s.DataDir(),
}
err = ugErr.ChangeAgentTools()
c.Assert(err, jc.ErrorIsNil)
target := agenttools.ToolsDir(s.DataDir(), newToolsBinary)
link, err := symlink.Read(agenttools.ToolsDir(s.DataDir(), "anAgent"))
c.Assert(err, jc.ErrorIsNil)
c.Assert(link, jc.SamePath, target)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:23,代码来源:upgrader_test.go
示例18: 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)
}
开发者ID:klyachin,项目名称:juju,代码行数:23,代码来源:upgrader_test.go
示例19: 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)
}
开发者ID:imoapps,项目名称:juju,代码行数:24,代码来源:upgrader_test.go
示例20: 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)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:24,代码来源:upgrader_test.go
注:本文中的github.com/juju/juju/environs/testing.PrimeTools函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论