本文整理汇总了Golang中github.com/juju/juju/juju/testing.AddStateServerMachine函数的典型用法代码示例。如果您正苦于以下问题:Golang AddStateServerMachine函数的具体用法?Golang AddStateServerMachine怎么用?Golang AddStateServerMachine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddStateServerMachine函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: addStateServerMachine
func addStateServerMachine(c *gc.C, st *state.State) {
// The AddStateServerMachine call will update the API host ports
// to made-up addresses. We need valid addresses so that the uniter
// can download charms from the API server.
apiHostPorts, err := st.APIHostPorts()
c.Assert(err, gc.IsNil)
testing.AddStateServerMachine(c, st)
err = st.SetAPIHostPorts(apiHostPorts)
c.Assert(err, gc.IsNil)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:10,代码来源:util_test.go
示例2: primeAgent
// primeAgent creates a unit, and sets up the unit agent's directory.
// It returns the assigned machine, new unit and the agent's configuration.
func (s *UnitSuite) primeAgent(c *gc.C) (*state.Machine, *state.Unit, agent.Config, *tools.Tools) {
jujutesting.AddStateServerMachine(c, s.State)
svc := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
unit, err := svc.AddUnit()
c.Assert(err, gc.IsNil)
err = unit.SetPassword(initialUnitPassword)
c.Assert(err, gc.IsNil)
// Assign the unit to a machine.
err = unit.AssignToNewMachine()
c.Assert(err, gc.IsNil)
id, err := unit.AssignedMachineId()
c.Assert(err, gc.IsNil)
machine, err := s.State.Machine(id)
c.Assert(err, gc.IsNil)
conf, tools := s.agentSuite.primeAgent(c, unit.Tag(), initialUnitPassword, version.Current)
return machine, unit, conf, tools
}
开发者ID:zhouqt,项目名称:juju,代码行数:19,代码来源:unit_test.go
示例3: primeAgent
// primeAgent creates a unit, and sets up the unit agent's directory.
// It returns the assigned machine, new unit and the agent's configuration.
func (s *UnitSuite) primeAgent(c *gc.C) (*state.Machine, *state.Unit, agent.Config, *tools.Tools) {
jujutesting.AddStateServerMachine(c, s.State)
svc := s.AddTestingService(c, "wordpress", s.AddTestingCharm(c, "wordpress"))
unit, err := svc.AddUnit()
c.Assert(err, jc.ErrorIsNil)
err = unit.SetPassword(initialUnitPassword)
c.Assert(err, jc.ErrorIsNil)
// Assign the unit to a machine.
err = unit.AssignToNewMachine()
c.Assert(err, jc.ErrorIsNil)
id, err := unit.AssignedMachineId()
c.Assert(err, jc.ErrorIsNil)
machine, err := s.State.Machine(id)
c.Assert(err, jc.ErrorIsNil)
inst, md := jujutesting.AssertStartInstance(c, s.Environ, id)
err = machine.SetProvisioned(inst.Id(), agent.BootstrapNonce, md)
c.Assert(err, jc.ErrorIsNil)
conf, tools := s.PrimeAgent(c, unit.Tag(), initialUnitPassword)
return machine, unit, conf, tools
}
开发者ID:imoapps,项目名称:juju,代码行数:22,代码来源:unit_test.go
示例4: setUpTest
func (s *provisionerSuite) setUpTest(c *gc.C, withStateServer bool) {
s.JujuConnSuite.SetUpTest(c)
// Reset previous machines (if any) and create 3 machines
// for the tests, plus an optional state server machine.
s.machines = nil
// Note that the specific machine ids allocated are assumed
// to be numerically consecutive from zero.
if withStateServer {
s.machines = append(s.machines, testing.AddStateServerMachine(c, s.State))
}
for i := 0; i < 5; i++ {
machine, err := s.State.AddMachine("quantal", state.JobHostUnits)
c.Check(err, gc.IsNil)
s.machines = append(s.machines, machine)
}
// Create a FakeAuthorizer so we can check permissions,
// set up assuming we logged in as the environment manager.
s.authorizer = apiservertesting.FakeAuthorizer{
LoggedIn: true,
EnvironManager: true,
}
// Create the resource registry separately to track invocations to
// Register.
s.resources = common.NewResources()
// Create a provisioner API for the machine.
provisionerAPI, err := provisioner.NewProvisionerAPI(
s.State,
s.resources,
s.authorizer,
)
c.Assert(err, gc.IsNil)
s.provisioner = provisionerAPI
}
开发者ID:rogpeppe,项目名称:juju,代码行数:37,代码来源:provisioner_test.go
注:本文中的github.com/juju/juju/juju/testing.AddStateServerMachine函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论