本文整理汇总了Golang中github.com/juju/juju/apiserver/client.Status函数的典型用法代码示例。如果您正苦于以下问题:Golang Status函数的具体用法?Golang Status怎么用?Golang Status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Status函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestNoMeterStatusWhenNotRequired
func (s *statusUnitTestSuite) TestNoMeterStatusWhenNotRequired(c *gc.C) {
service := s.Factory.MakeApplication(c, nil)
units, err := service.AllUnits()
c.Assert(err, jc.ErrorIsNil)
c.Assert(units, gc.HasLen, 0)
for i, unit := range testUnits {
u, err := service.AddUnit()
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
err := u.SetMeterStatus(unit.setStatus.Code.String(), unit.setStatus.Info)
c.Assert(err, jc.ErrorIsNil)
}
}
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Assert(status, gc.NotNil)
serviceStatus, ok := status.Applications[service.Name()]
c.Assert(ok, gc.Equals, true)
c.Assert(serviceStatus.MeterStatuses, gc.HasLen, 0)
}
开发者ID:kat-co,项目名称:juju,代码行数:26,代码来源:status_test.go
示例2: checkAppVersion
func (s *statusUnitTestSuite) checkAppVersion(c *gc.C, application *state.Application, expectedVersion string) params.ApplicationStatus {
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
appStatus, found := status.Applications[application.Name()]
c.Assert(found, jc.IsTrue)
c.Check(appStatus.WorkloadVersion, gc.Equals, expectedVersion)
return appStatus
}
开发者ID:kat-co,项目名称:juju,代码行数:9,代码来源:status_test.go
示例3: TestUpdateRevisions
func (s *statusUpgradeUnitSuite) TestUpdateRevisions(c *gc.C) {
s.AddMachine(c, "0", state.JobManageModel)
s.SetupScenario(c)
client := s.APIState.Client()
status, _ := client.Status(nil)
serviceStatus, ok := status.Services["mysql"]
c.Assert(ok, gc.Equals, true)
c.Assert(serviceStatus.CanUpgradeTo, gc.Equals, "")
// Update to the latest available charm revision.
result, err := s.charmrevisionupdater.UpdateLatestRevisions()
c.Assert(err, jc.ErrorIsNil)
c.Assert(result.Error, gc.IsNil)
// Check if CanUpgradeTo suggest the latest revision.
status, _ = client.Status(nil)
serviceStatus, ok = status.Services["mysql"]
c.Assert(ok, gc.Equals, true)
c.Assert(serviceStatus.CanUpgradeTo, gc.Equals, "cs:quantal/mysql-23")
}
开发者ID:makyo,项目名称:juju,代码行数:21,代码来源:status_test.go
示例4: TestFullStatusUnitLeadership
func (s *statusSuite) TestFullStatusUnitLeadership(c *gc.C) {
u := s.Factory.MakeUnit(c, nil)
s.State.LeadershipClaimer().ClaimLeadership(u.ApplicationName(), u.Name(), time.Minute)
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
app, ok := status.Applications[u.ApplicationName()]
c.Assert(ok, jc.IsTrue)
unit, ok := app.Units[u.Name()]
c.Assert(ok, jc.IsTrue)
c.Assert(unit.Leader, jc.IsTrue)
}
开发者ID:bac,项目名称:juju,代码行数:12,代码来源:status_test.go
示例5: TestFullStatus
func (s *statusSuite) TestFullStatus(c *gc.C) {
machine := s.addMachine(c)
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Check(status.ModelName, gc.Equals, "admin")
c.Check(status.Services, gc.HasLen, 0)
c.Check(status.Machines, gc.HasLen, 1)
resultMachine, ok := status.Machines[machine.Id()]
if !ok {
c.Fatalf("Missing machine with id %q", machine.Id())
}
c.Check(resultMachine.Id, gc.Equals, machine.Id())
c.Check(resultMachine.Series, gc.Equals, machine.Series())
}
开发者ID:makyo,项目名称:juju,代码行数:15,代码来源:status_test.go
示例6: TestFullStatus
func (s *statusSuite) TestFullStatus(c *gc.C) {
machine := s.addMachine(c)
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Check(status.Model.Name, gc.Equals, "controller")
c.Check(status.Model.CloudTag, gc.Equals, "cloud-dummy")
c.Check(status.Applications, gc.HasLen, 0)
c.Check(status.Machines, gc.HasLen, 1)
resultMachine, ok := status.Machines[machine.Id()]
if !ok {
c.Fatalf("Missing machine with id %q", machine.Id())
}
c.Check(resultMachine.Id, gc.Equals, machine.Id())
c.Check(resultMachine.Series, gc.Equals, machine.Series())
}
开发者ID:kat-co,项目名称:juju,代码行数:16,代码来源:status_test.go
示例7: TestMigrationInProgress
func (s *statusUnitTestSuite) TestMigrationInProgress(c *gc.C) {
// Create a host model because controller models can't be migrated.
state2 := s.Factory.MakeModel(c, nil)
defer state2.Close()
// Get API connection to hosted model.
apiInfo := s.APIInfo(c)
apiInfo.ModelTag = state2.ModelTag()
conn, err := api.Open(apiInfo, api.DialOpts{})
c.Assert(err, jc.ErrorIsNil)
client := conn.Client()
checkMigStatus := func(expected string) {
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Check(status.Model.Migration, gc.Equals, expected)
}
// Migration status should be empty when no migration is happening.
checkMigStatus("")
// Start it migrating.
mig, err := state2.CreateMigration(state.MigrationSpec{
InitiatedBy: names.NewUserTag("admin"),
TargetInfo: migration.TargetInfo{
ControllerTag: names.NewControllerTag(utils.MustNewUUID().String()),
Addrs: []string{"1.2.3.4:5555", "4.3.2.1:6666"},
CACert: "cert",
AuthTag: names.NewUserTag("user"),
Password: "password",
},
})
c.Assert(err, jc.ErrorIsNil)
// Check initial message.
checkMigStatus("starting")
// Check status is reported when set.
setAndCheckMigStatus := func(message string) {
err := mig.SetStatusMessage(message)
c.Assert(err, jc.ErrorIsNil)
checkMigStatus(message)
}
setAndCheckMigStatus("proceeding swimmingly")
setAndCheckMigStatus("oh noes")
}
开发者ID:kat-co,项目名称:juju,代码行数:47,代码来源:status_test.go
示例8: TestMeterStatusWithCredentials
func (s *statusUnitTestSuite) TestMeterStatusWithCredentials(c *gc.C) {
service := s.Factory.MakeApplication(c, nil)
c.Assert(service.SetMetricCredentials([]byte("magic-ticket")), jc.ErrorIsNil)
units, err := service.AllUnits()
c.Assert(err, jc.ErrorIsNil)
c.Assert(units, gc.HasLen, 0)
for i, unit := range testUnits {
u, err := service.AddUnit()
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
err := u.SetMeterStatus(unit.setStatus.Code.String(), unit.setStatus.Info)
c.Assert(err, jc.ErrorIsNil)
}
}
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Assert(status, gc.NotNil)
serviceStatus, ok := status.Applications[service.Name()]
c.Assert(ok, gc.Equals, true)
c.Assert(serviceStatus.MeterStatuses, gc.HasLen, len(testUnits)-1)
for _, unit := range testUnits {
unitStatus, ok := serviceStatus.MeterStatuses[unit.unitName]
if unit.expectedStatus != nil {
c.Assert(ok, gc.Equals, true)
c.Assert(&unitStatus, gc.DeepEquals, unit.expectedStatus)
} else {
c.Assert(ok, gc.Equals, false)
}
}
}
开发者ID:kat-co,项目名称:juju,代码行数:37,代码来源:status_test.go
示例9: TestMeterStatus
func (s *statusUnitTestSuite) TestMeterStatus(c *gc.C) {
meteredCharm := s.Factory.MakeCharm(c, &factory.CharmParams{Name: "metered", URL: "cs:quantal/metered"})
service := s.Factory.MakeApplication(c, &factory.ApplicationParams{Charm: meteredCharm})
units, err := service.AllUnits()
c.Assert(err, jc.ErrorIsNil)
c.Assert(units, gc.HasLen, 0)
for i, unit := range testUnits {
u, err := service.AddUnit()
testUnits[i].unitName = u.Name()
c.Assert(err, jc.ErrorIsNil)
if unit.setStatus != nil {
err := u.SetMeterStatus(unit.setStatus.Code.String(), unit.setStatus.Info)
c.Assert(err, jc.ErrorIsNil)
}
}
client := s.APIState.Client()
status, err := client.Status(nil)
c.Assert(err, jc.ErrorIsNil)
c.Assert(status, gc.NotNil)
serviceStatus, ok := status.Applications[service.Name()]
c.Assert(ok, gc.Equals, true)
c.Assert(serviceStatus.MeterStatuses, gc.HasLen, len(testUnits)-1)
for _, unit := range testUnits {
unitStatus, ok := serviceStatus.MeterStatuses[unit.unitName]
if unit.expectedStatus != nil {
c.Assert(ok, gc.Equals, true)
c.Assert(&unitStatus, gc.DeepEquals, unit.expectedStatus)
} else {
c.Assert(ok, gc.Equals, false)
}
}
}
开发者ID:kat-co,项目名称:juju,代码行数:37,代码来源:status_test.go
注:本文中的github.com/juju/juju/apiserver/client.Status函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论