本文整理汇总了Golang中github.com/juju/utils/series.HostSeries函数的典型用法代码示例。如果您正苦于以下问题:Golang HostSeries函数的具体用法?Golang HostSeries怎么用?Golang HostSeries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HostSeries函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestMissingAttributes
func (s *format_1_18Suite) TestMissingAttributes(c *gc.C) {
logDir, err := paths.LogDir(series.HostSeries())
c.Assert(err, jc.ErrorIsNil)
realDataDir, err := paths.DataDir(series.HostSeries())
c.Assert(err, jc.ErrorIsNil)
realDataDir = filepath.FromSlash(realDataDir)
logPath := filepath.Join(logDir, "juju")
logPath = filepath.FromSlash(logPath)
dataDir := c.MkDir()
configPath := filepath.Join(dataDir, agentConfigFilename)
err = utils.AtomicWriteFile(configPath, []byte(configData1_18WithoutUpgradedToVersion), 0600)
c.Assert(err, jc.ErrorIsNil)
readConfig, err := ReadConfig(configPath)
c.Assert(err, jc.ErrorIsNil)
c.Assert(readConfig.UpgradedToVersion(), gc.Equals, version.MustParse("1.16.0"))
configLogDir := filepath.FromSlash(readConfig.LogDir())
configDataDir := filepath.FromSlash(readConfig.DataDir())
c.Assert(configLogDir, gc.Equals, logPath)
c.Assert(configDataDir, gc.Equals, realDataDir)
c.Assert(readConfig.PreferIPv6(), jc.IsFalse)
// The api info doesn't have the environment tag set.
apiInfo, ok := readConfig.APIInfo()
c.Assert(ok, jc.IsTrue)
c.Assert(apiInfo.EnvironTag.Id(), gc.Equals, "")
}
开发者ID:imoapps,项目名称:juju,代码行数:27,代码来源:format-1.18_whitebox_test.go
示例2: TestMissingAttributes
func (s *format_1_16Suite) TestMissingAttributes(c *gc.C) {
logDir, err := paths.LogDir(series.HostSeries())
c.Assert(err, jc.ErrorIsNil)
realDataDir, err := paths.DataDir(series.HostSeries())
c.Assert(err, jc.ErrorIsNil)
realDataDir = filepath.FromSlash(realDataDir)
logPath := filepath.Join(logDir, "juju")
logPath = filepath.FromSlash(logPath)
dataDir := c.MkDir()
formatPath := filepath.Join(dataDir, legacyFormatFilename)
err = utils.AtomicWriteFile(formatPath, []byte(legacyFormatFileContents), 0600)
c.Assert(err, jc.ErrorIsNil)
configPath := filepath.Join(dataDir, agentConfigFilename)
err = utils.AtomicWriteFile(configPath, []byte(configDataWithoutNewAttributes), 0600)
c.Assert(err, jc.ErrorIsNil)
readConfig, err := ReadConfig(configPath)
c.Assert(err, jc.ErrorIsNil)
c.Assert(readConfig.UpgradedToVersion(), gc.Equals, version.MustParse("1.16.0"))
configLogDir := filepath.FromSlash(readConfig.LogDir())
configDataDir := filepath.FromSlash(readConfig.DataDir())
c.Assert(configLogDir, gc.Equals, logPath)
c.Assert(configDataDir, gc.Equals, realDataDir)
// Test data doesn't include a StateServerKey so StateServingInfo
// should *not* be available
_, available := readConfig.StateServingInfo()
c.Assert(available, jc.IsFalse)
}
开发者ID:imoapps,项目名称:juju,代码行数:31,代码来源:format-1.16_whitebox_test.go
示例3: Bootstrap
// Bootstrap is specified in the Environ interface.
func (env *localEnviron) Bootstrap(ctx environs.BootstrapContext, args environs.BootstrapParams) (*environs.BootstrapResult, error) {
if err := ensureNotRoot(); err != nil {
return nil, err
}
// Make sure there are tools available for the
// host's architecture and series.
if _, err := args.AvailableTools.Match(tools.Filter{
Arch: arch.HostArch(),
Series: series.HostSeries(),
}); err != nil {
return nil, err
}
cfg, err := env.Config().Apply(map[string]interface{}{
// Record the bootstrap IP, so the containers know where to go for storage.
"bootstrap-ip": env.bridgeAddress,
})
if err == nil {
err = env.SetConfig(cfg)
}
if err != nil {
logger.Errorf("failed to apply bootstrap-ip to config: %v", err)
return nil, err
}
result := &environs.BootstrapResult{
Arch: arch.HostArch(),
Series: series.HostSeries(),
Finalize: env.finishBootstrap,
}
return result, nil
}
开发者ID:imoapps,项目名称:juju,代码行数:34,代码来源:environ.go
示例4: testFindToolsExact
func (s *toolsSuite) testFindToolsExact(c *gc.C, t common.ToolsStorageGetter, inStorage bool, develVersion bool) {
var called bool
s.PatchValue(common.EnvtoolsFindTools, func(e environs.Environ, major, minor int, stream string, filter coretools.Filter) (list coretools.List, err error) {
called = true
c.Assert(filter.Number, gc.Equals, version.Current)
c.Assert(filter.Series, gc.Equals, series.HostSeries())
c.Assert(filter.Arch, gc.Equals, arch.HostArch())
if develVersion {
c.Assert(stream, gc.Equals, "devel")
} else {
c.Assert(stream, gc.Equals, "released")
}
return nil, errors.NotFoundf("tools")
})
toolsFinder := common.NewToolsFinder(s.State, t, sprintfURLGetter("tools:%s"))
result, err := toolsFinder.FindTools(params.FindToolsParams{
Number: version.Current,
MajorVersion: -1,
MinorVersion: -1,
Series: series.HostSeries(),
Arch: arch.HostArch(),
})
c.Assert(err, jc.ErrorIsNil)
if inStorage {
c.Assert(result.Error, gc.IsNil)
c.Assert(called, jc.IsFalse)
} else {
c.Assert(result.Error, gc.ErrorMatches, "tools not found")
c.Assert(called, jc.IsTrue)
}
}
开发者ID:pmatulis,项目名称:juju,代码行数:31,代码来源:tools_test.go
示例5: TestUploadFakeSeries
func (s *uploadSuite) TestUploadFakeSeries(c *gc.C) {
seriesToUpload := "precise"
if seriesToUpload == series.HostSeries() {
seriesToUpload = "raring"
}
t, err := sync.Upload(s.targetStorage, "released", nil, "quantal", seriesToUpload)
c.Assert(err, jc.ErrorIsNil)
s.assertUploadedTools(c, t, []string{seriesToUpload, "quantal", series.HostSeries()}, "released")
}
开发者ID:pmatulis,项目名称:juju,代码行数:9,代码来源:sync_test.go
示例6: TestSyncToolsFakeSeries
func (s *uploadSuite) TestSyncToolsFakeSeries(c *gc.C) {
seriesToUpload := "precise"
if seriesToUpload == series.HostSeries() {
seriesToUpload = "raring"
}
builtTools, err := sync.BuildToolsTarball(nil, "testing")
c.Assert(err, jc.ErrorIsNil)
t, err := sync.SyncBuiltTools(s.targetStorage, "testing", builtTools, "quantal", seriesToUpload)
c.Assert(err, jc.ErrorIsNil)
s.assertUploadedTools(c, t, []string{seriesToUpload, "quantal", series.HostSeries()}, "testing")
}
开发者ID:pmatulis,项目名称:juju,代码行数:12,代码来源:sync_test.go
示例7: AddDefaultToolsToState
// AddDefaultToolsToState adds tools to tools storage for
// {Number: jujuversion.Current.Number, Arch: amd64}, for the
// "precise" series and the environment's preferred series.
// The preferred series is default-series if specified,
// otherwise the latest LTS.
func (s *JujuConnSuite) AddDefaultToolsToState(c *gc.C) {
preferredVersion := version.Binary{
Number: jujuversion.Current,
Arch: "amd64",
Series: series.HostSeries(),
}
current := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
versions := PreferredDefaultVersions(s.Environ.Config(), preferredVersion)
versions = append(versions, current)
s.AddToolsToState(c, versions...)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:20,代码来源:conn.go
示例8: SetUpTest
func (s *syslogSuite) SetUpTest(c *gc.C) {
if runtime.GOOS != "linux" {
c.Skip(fmt.Sprintf("this test requires a controller, therefore does not support %q", runtime.GOOS))
}
currentSeries := series.HostSeries()
osFromSeries, err := series.GetOSFromSeries(currentSeries)
c.Assert(err, jc.ErrorIsNil)
if osFromSeries != os.Ubuntu {
c.Skip(fmt.Sprintf("this test requires a controller, therefore does not support OS %q only Ubuntu", osFromSeries.String()))
}
s.AgentSuite.SetUpTest(c)
// TODO(perrito666) 200160701:
// This needs to be done to stop the test from trying to install mongo
// while running, but it is a huge footprint for such little benefit.
// This test should not need JujuConnSuite or AgentSuite.
s.fakeEnsureMongo = agenttest.InstallFakeEnsureMongo(s)
done := make(chan struct{})
s.received = make(chan rfc5424test.Message)
addr := s.createSyslogServer(c, s.received, done)
// Leave log forwarding disabled initially, it will be enabled
// via a model config update in the test.
err = s.State.UpdateModelConfig(map[string]interface{}{
"syslog-host": addr,
"syslog-ca-cert": coretesting.CACert,
"syslog-client-cert": coretesting.ServerCert,
"syslog-client-key": coretesting.ServerKey,
}, nil, nil)
c.Assert(err, jc.ErrorIsNil)
s.logsCh, err = logsender.InstallBufferedLogWriter(1000)
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:bac,项目名称:juju,代码行数:34,代码来源:syslog_test.go
示例9: SetUpTest
func (s *UpgradeSuite) SetUpTest(c *gc.C) {
s.StateSuite.SetUpTest(c)
s.preUpgradeError = false
// Most of these tests normally finish sub-second on a fast machine.
// If any given test hits a minute, we have almost certainly become
// wedged, so dump the logs.
coretesting.DumpTestLogsAfter(time.Minute, c, s)
s.oldVersion = version.Binary{
Number: version.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
s.oldVersion.Major = 1
s.oldVersion.Minor = 16
// Don't wait so long in tests.
s.PatchValue(&UpgradeStartTimeoutMaster, time.Duration(time.Millisecond*50))
s.PatchValue(&UpgradeStartTimeoutSecondary, time.Duration(time.Millisecond*60))
// Allow tests to make the API connection appear to be dead.
s.connectionDead = false
s.PatchValue(&cmdutil.ConnectionIsDead, func(loggo.Logger, cmdutil.Pinger) bool {
return s.connectionDead
})
s.machineIsMaster = true
fakeIsMachineMaster := func(*state.State, string) (bool, error) {
return s.machineIsMaster, nil
}
s.PatchValue(&IsMachineMaster, fakeIsMachineMaster)
}
开发者ID:pmatulis,项目名称:juju,代码行数:34,代码来源:worker_test.go
示例10: TestSetTools
func (s *upgraderSuite) TestSetTools(c *gc.C) {
current := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
_, err := s.rawMachine.AgentTools()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
args := params.EntitiesVersion{
AgentTools: []params.EntityVersion{{
Tag: s.rawMachine.Tag().String(),
Tools: ¶ms.Version{
Version: current,
}},
},
}
results, err := s.upgrader.SetTools(args)
c.Assert(err, jc.ErrorIsNil)
c.Assert(results.Results, gc.HasLen, 1)
c.Assert(results.Results[0].Error, gc.IsNil)
// Check that the new value actually got set, we must Refresh because
// it was set on a different Machine object
err = s.rawMachine.Refresh()
c.Assert(err, jc.ErrorIsNil)
realTools, err := s.rawMachine.AgentTools()
c.Assert(err, jc.ErrorIsNil)
c.Check(realTools.Version, gc.Equals, current)
c.Check(realTools.URL, gc.Equals, "")
}
开发者ID:bac,项目名称:juju,代码行数:29,代码来源:upgrader_test.go
示例11: TestLxcContainerUsesImageURL
func (s *ContainerSetupSuite) TestLxcContainerUsesImageURL(c *gc.C) {
// create a machine to host the container.
m, err := s.BackingState.AddOneMachine(state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: s.defaultConstraints,
})
c.Assert(err, jc.ErrorIsNil)
err = m.SetSupportedContainers([]instance.ContainerType{instance.LXC, instance.KVM})
c.Assert(err, jc.ErrorIsNil)
current := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
err = m.SetAgentVersion(current)
c.Assert(err, jc.ErrorIsNil)
brokerCalled := false
newlxcbroker := func(api provisioner.APICalls, agentConfig agent.Config, managerConfig container.ManagerConfig,
imageURLGetter container.ImageURLGetter, enableNAT bool, defaultMTU int) (environs.InstanceBroker, error) {
imageURL, err := imageURLGetter.ImageURL(instance.LXC, "trusty", "amd64")
c.Assert(err, jc.ErrorIsNil)
c.Assert(imageURL, gc.Equals, "imageURL")
c.Assert(imageURLGetter.CACert(), gc.DeepEquals, []byte("cert"))
brokerCalled = true
return nil, fmt.Errorf("lxc broker error")
}
s.PatchValue(&provisioner.NewLxcBroker, newlxcbroker)
s.createContainer(c, m, instance.LXC)
c.Assert(brokerCalled, jc.IsTrue)
}
开发者ID:xushiwei,项目名称:juju,代码行数:32,代码来源:container_initialisation_test.go
示例12: assertAgentSetsToolsVersion
func (s *MachineSuite) assertAgentSetsToolsVersion(c *gc.C, job state.MachineJob) {
vers := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
vers.Minor++
m, _, _ := s.primeAgentVersion(c, vers, job)
a := s.newAgent(c, m)
go func() { c.Check(a.Run(nil), jc.ErrorIsNil) }()
defer func() { c.Check(a.Stop(), jc.ErrorIsNil) }()
timeout := time.After(coretesting.LongWait)
for done := false; !done; {
select {
case <-timeout:
c.Fatalf("timeout while waiting for agent version to be set")
case <-time.After(coretesting.ShortWait):
c.Log("Refreshing")
err := m.Refresh()
c.Assert(err, jc.ErrorIsNil)
c.Log("Fetching agent tools")
agentTools, err := m.AgentTools()
c.Assert(err, jc.ErrorIsNil)
c.Logf("(%v vs. %v)", agentTools.Version, jujuversion.Current)
if agentTools.Version.Minor != jujuversion.Current.Minor {
continue
}
c.Assert(agentTools.Version.Number, gc.DeepEquals, jujuversion.Current)
done = true
}
}
}
开发者ID:bac,项目名称:juju,代码行数:33,代码来源:machine_test.go
示例13: TestDefaultMTUPropagatedToNewLXCBroker
func (s *LXCDefaultMTUSuite) TestDefaultMTUPropagatedToNewLXCBroker(c *gc.C) {
// create a machine to host the container.
m, err := s.BackingState.AddOneMachine(state.MachineTemplate{
Series: coretesting.FakeDefaultSeries,
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: s.defaultConstraints,
})
c.Assert(err, jc.ErrorIsNil)
err = m.SetSupportedContainers([]instance.ContainerType{instance.LXC, instance.KVM})
c.Assert(err, jc.ErrorIsNil)
current := version.Binary{
Number: version.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
err = m.SetAgentVersion(current)
c.Assert(err, jc.ErrorIsNil)
brokerCalled := false
newlxcbroker := func(api provisioner.APICalls, agentConfig agent.Config, managerConfig container.ManagerConfig, imageURLGetter container.ImageURLGetter, enableNAT bool, defaultMTU int) (environs.InstanceBroker, error) {
brokerCalled = true
c.Assert(defaultMTU, gc.Equals, 9000)
return nil, fmt.Errorf("lxc broker error")
}
s.PatchValue(&provisioner.NewLxcBroker, newlxcbroker)
s.createContainer(c, m, instance.LXC)
c.Assert(brokerCalled, jc.IsTrue)
}
开发者ID:snailwalker,项目名称:juju,代码行数:28,代码来源:container_initialisation_test.go
示例14: getContainerInstance
func getContainerInstance() (cont []ContainerInstance, err error) {
current_os, err := series.GetOSFromSeries(series.HostSeries())
if err != nil {
return nil, err
}
switch current_os {
case jujuos.CentOS:
cont = []ContainerInstance{
{instance.LXC, [][]string{
{"lxc"},
{"cloud-image-utils"},
}},
{instance.KVM, [][]string{
{"uvtool-libvirt"},
{"uvtool"},
}},
}
default:
cont = []ContainerInstance{
{instance.LXC, [][]string{
{"--target-release", "precise-updates/cloud-tools", "lxc"},
{"--target-release", "precise-updates/cloud-tools", "cloud-image-utils"},
}},
{instance.KVM, [][]string{
{"uvtool-libvirt"},
{"uvtool"},
}},
}
}
return cont, nil
}
开发者ID:snailwalker,项目名称:juju,代码行数:33,代码来源:container_initialisation_test.go
示例15: TestContainerInitLockError
func (s *ContainerSetupSuite) TestContainerInitLockError(c *gc.C) {
m, err := s.BackingState.AddOneMachine(state.MachineTemplate{
Series: coretesting.FakeDefaultSeries,
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: s.defaultConstraints,
})
c.Assert(err, jc.ErrorIsNil)
current := version.Binary{
Number: version.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
err = m.SetAgentVersion(current)
c.Assert(err, jc.ErrorIsNil)
err = os.RemoveAll(s.initLockDir)
c.Assert(err, jc.ErrorIsNil)
handler, runner := s.setupContainerWorker(c, m.Tag().(names.MachineTag))
runner.Kill()
err = runner.Wait()
c.Assert(err, jc.ErrorIsNil)
_, err = handler.SetUp()
c.Assert(err, jc.ErrorIsNil)
err = handler.Handle([]string{"0/lxc/0"})
c.Assert(err, gc.ErrorMatches, ".*failed to acquire initialization lock:.*")
}
开发者ID:snailwalker,项目名称:juju,代码行数:28,代码来源:container_initialisation_test.go
示例16: SetUpTest
func (s *prereqsSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
s.tmpdir = c.MkDir()
s.testMongodPath = filepath.Join(s.tmpdir, "mongod")
s.PatchEnvironment("PATH", s.tmpdir)
s.PatchValue(&mongo.JujuMongodPath, "/somewhere/that/wont/exist")
os.Setenv("JUJUTEST_LSB_RELEASE_ID", "Ubuntu")
err := ioutil.WriteFile(filepath.Join(s.tmpdir, "lsb_release"), []byte(lsbrelease), 0777)
c.Assert(err, jc.ErrorIsNil)
// symlink $temp/dpkg-query to /bin/true, to
// simulate package installation query responses.
pm, err := testing.GetPackageManager()
c.Assert(err, jc.ErrorIsNil)
err = symlink.New("/bin/true", filepath.Join(s.tmpdir, pm.PackageQuery))
c.Assert(err, jc.ErrorIsNil)
s.PatchValue(&isPackageInstalled, func(pack string) bool {
pacman, err := manager.NewPackageManager(series.HostSeries())
c.Assert(err, jc.ErrorIsNil)
return pacman.IsInstalled(pack)
})
}
开发者ID:imoapps,项目名称:juju,代码行数:26,代码来源:prereqs_test.go
示例17: testBootstrap
func (s *localJujuTestSuite) testBootstrap(c *gc.C, cfg *config.Config) environs.Environ {
ctx := envtesting.BootstrapContext(c)
environ, err := local.Provider.PrepareForBootstrap(ctx, cfg)
c.Assert(err, jc.ErrorIsNil)
availableTools := coretools.List{&coretools.Tools{
Version: version.Binary{
Number: version.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
},
URL: "http://testing.invalid/tools.tar.gz",
}}
result, err := environ.Bootstrap(ctx, environs.BootstrapParams{
AvailableTools: availableTools,
})
c.Assert(err, jc.ErrorIsNil)
icfg, err := instancecfg.NewBootstrapInstanceConfig(
constraints.Value{}, constraints.Value{}, "quantal", "",
)
c.Assert(err, jc.ErrorIsNil)
icfg.Tools = availableTools[0]
err = result.Finalize(ctx, icfg)
c.Assert(err, jc.ErrorIsNil)
return environ
}
开发者ID:pmatulis,项目名称:juju,代码行数:25,代码来源:environ_test.go
示例18: Create
// Create creates a service with the given config.
func (s *SvcManager) Create(name string, conf common.Conf) error {
serviceStartName := "LocalSystem"
var passwd string
if !series.IsWindowsNano(series.HostSeries()) {
password, err := getPassword()
if err != nil {
return errors.Trace(err)
}
passwd = password
serviceStartName = jujudUser
}
cfg := mgr.Config{
Dependencies: []string{"Winmgmt"},
ErrorControl: mgr.ErrorSevere,
StartType: mgr.StartAutomatic,
DisplayName: conf.Desc,
ServiceStartName: serviceStartName,
Password: passwd,
}
// mgr.CreateService actually does correct argument escaping itself. There is no
// need for quoted strings of any kind passed to this function. It takes in
// a binary name, and an array or arguments.
service, err := s.mgr.CreateService(name, conf.ServiceBinary, cfg, conf.ServiceArgs...)
if err != nil {
return errors.Trace(err)
}
defer service.Close()
err = s.ensureRestartOnFailure(name)
if err != nil {
return errors.Trace(err)
}
return nil
}
开发者ID:bac,项目名称:juju,代码行数:34,代码来源:service_windows.go
示例19: SetUp
func (fix *SimpleToolsFixture) SetUp(c *gc.C, dataDir string) {
fix.dataDir = dataDir
fix.logDir = c.MkDir()
current := version.Binary{
Number: version.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
toolsDir := tools.SharedToolsDir(fix.dataDir, current)
err := os.MkdirAll(toolsDir, 0755)
c.Assert(err, jc.ErrorIsNil)
jujudPath := filepath.Join(toolsDir, "jujud")
err = ioutil.WriteFile(jujudPath, []byte(fakeJujud), 0755)
c.Assert(err, jc.ErrorIsNil)
toolsPath := filepath.Join(toolsDir, "downloaded-tools.txt")
testTools := coretools.Tools{Version: current, URL: "http://testing.invalid/tools"}
data, err := json.Marshal(testTools)
c.Assert(err, jc.ErrorIsNil)
err = ioutil.WriteFile(toolsPath, data, 0644)
c.Assert(err, jc.ErrorIsNil)
fix.binDir = c.MkDir()
fix.origPath = os.Getenv("PATH")
os.Setenv("PATH", fix.binDir+":"+fix.origPath)
fix.makeBin(c, "status", `echo "blah stop/waiting"`)
fix.makeBin(c, "stopped-status", `echo "blah stop/waiting"`)
fix.makeBin(c, "started-status", `echo "blah start/running, process 666"`)
fix.makeBin(c, "start", "cp $(which started-status) $(which status)")
fix.makeBin(c, "stop", "cp $(which stopped-status) $(which status)")
fix.data = svctesting.NewFakeServiceData()
}
开发者ID:imoapps,项目名称:juju,代码行数:31,代码来源:simple_test.go
示例20: SetUpTest
func (s *upgradeSuite) SetUpTest(c *gc.C) {
s.AgentSuite.SetUpTest(c)
s.oldVersion = version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
s.oldVersion.Major = 1
s.oldVersion.Minor = 16
// Don't wait so long in tests.
s.PatchValue(&upgradesteps.UpgradeStartTimeoutMaster, time.Duration(time.Millisecond*50))
s.PatchValue(&upgradesteps.UpgradeStartTimeoutSecondary, time.Duration(time.Millisecond*60))
// Ensure we don't fail disk space check.
s.PatchValue(&upgrades.MinDiskSpaceMib, uint64(0))
// Consume apt-get commands that get run before upgrades.
aptCmds := s.AgentSuite.HookCommandOutput(&pacman.CommandOutput, nil, nil)
go func() {
for _ = range aptCmds {
}
}()
// TODO(mjs) - the following should maybe be part of AgentSuite.SetUpTest()
s.PatchValue(&cmdutil.EnsureMongoServer, func(mongo.EnsureServerParams) error {
return nil
})
s.PatchValue(&agentcmd.ProductionMongoWriteConcern, false)
}
开发者ID:kat-co,项目名称:juju,代码行数:32,代码来源:upgrade_test.go
注:本文中的github.com/juju/utils/series.HostSeries函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论