本文整理汇总了Golang中github.com/juju/juju/migration.SourcePrecheck函数的典型用法代码示例。如果您正苦于以下问题:Golang SourcePrecheck函数的具体用法?Golang SourcePrecheck怎么用?Golang SourcePrecheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SourcePrecheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestControllerAgentVersionError
func (s *SourcePrecheckSuite) TestControllerAgentVersionError(c *gc.C) {
backend := newFakeBackend()
backend.controllerBackend.agentVersionErr = errors.New("boom")
err := migration.SourcePrecheck(backend)
c.Assert(err, gc.ErrorMatches, "controller: retrieving model version: boom")
}
示例2: TestDyingControllerMachine
func (s *SourcePrecheckSuite) TestDyingControllerMachine(c *gc.C) {
backend := &fakeBackend{
controllerBackend: newBackendWithDyingMachine(),
}
err := migration.SourcePrecheck(backend)
c.Assert(err, gc.ErrorMatches, "controller: machine 0 is dying")
}
示例3: TestProvisioningControllerMachine
func (s *SourcePrecheckSuite) TestProvisioningControllerMachine(c *gc.C) {
backend := &fakeBackend{
controllerBackend: newBackendWithProvisioningMachine(),
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "controller: machine 0 not running (allocating)")
}
示例4: TestNonStartedControllerMachine
func (s *SourcePrecheckSuite) TestNonStartedControllerMachine(c *gc.C) {
backend := &fakeBackend{
controllerBackend: newBackendWithDownMachine(),
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "controller: machine 0 agent not functioning at this time (down)")
}
示例5: TestDyingApplication
func (s *SourcePrecheckSuite) TestDyingApplication(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
life: state.Dying,
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "application foo is dying")
}
示例6: TestWithPendingMinUnits
func (s *SourcePrecheckSuite) TestWithPendingMinUnits(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
minunits: 2,
units: []migration.PrecheckUnit{&fakeUnit{name: "foo/0"}},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "application foo is below its minimum units threshold")
}
示例7: TestUnitLost
func (s *SourcePrecheckSuite) TestUnitLost(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
units: []migration.PrecheckUnit{
&fakeUnit{name: "foo/0", lost: true},
},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "unit foo/0 not idle (lost)")
}
示例8: TestUnitNotIdle
func (s *SourcePrecheckSuite) TestUnitNotIdle(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
units: []migration.PrecheckUnit{
&fakeUnit{name: "foo/0", agentStatus: status.Failed},
},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "unit foo/0 not idle (failed)")
}
示例9: TestDeadUnit
func (s *SourcePrecheckSuite) TestDeadUnit(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
units: []migration.PrecheckUnit{
&fakeUnit{name: "foo/0", life: state.Dead},
},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "unit foo/0 is dead")
}
示例10: TestCharmUpgrades
func (*SourcePrecheckSuite) TestCharmUpgrades(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "spanner",
charmURL: "cs:spanner-3",
units: []migration.PrecheckUnit{
&fakeUnit{name: "spanner/0", charmURL: "cs:spanner-3"},
&fakeUnit{name: "spanner/1", charmURL: "cs:spanner-2"},
},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err, gc.ErrorMatches, "unit spanner/1 is upgrading")
}
示例11: TestUnitVersionsDontMatch
func (s *SourcePrecheckSuite) TestUnitVersionsDontMatch(c *gc.C) {
backend := &fakeBackend{
apps: []migration.PrecheckApplication{
&fakeApp{
name: "foo",
units: []migration.PrecheckUnit{&fakeUnit{name: "foo/0"}},
},
&fakeApp{
name: "bar",
units: []migration.PrecheckUnit{
&fakeUnit{name: "bar/0"},
&fakeUnit{name: "bar/1", version: version.MustParseBinary("1.2.4-trusty-ppc64")},
},
},
},
}
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "unit bar/1 tools don't match model (1.2.4 != 1.2.3)")
}
示例12: sourcePrecheck
func sourcePrecheck(backend migration.PrecheckBackend) error {
return migration.SourcePrecheck(backend)
}
示例13: TestNonStartedMachine
func (s *SourcePrecheckSuite) TestNonStartedMachine(c *gc.C) {
backend := newBackendWithDownMachine()
err := migration.SourcePrecheck(backend)
c.Assert(err.Error(), gc.Equals, "machine 0 agent not functioning at this time (down)")
}
示例14: Prechecks
// Prechecks performs pre-migration checks on the model and
// (source) controller.
func (api *API) Prechecks() error {
return migration.SourcePrecheck(api.precheckBackend)
}
示例15: TestDownMachineAgent
func (s *SourcePrecheckSuite) TestDownMachineAgent(c *gc.C) {
err := migration.SourcePrecheck(newBackendWithDownMachineAgent())
c.Assert(err.Error(), gc.Equals, "machine 1 agent not functioning at this time (down)")
}