本文整理汇总了Golang中github.com/coreos/fleet/functional/platform.Cluster类的典型用法代码示例。如果您正苦于以下问题:Golang Cluster类的具体用法?Golang Cluster怎么用?Golang Cluster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cluster类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: waitForNUnitsStart
func waitForNUnitsStart(cl platform.Cluster, m platform.Member, nu int) (map[string][]util.UnitState, error) {
listUnitStates, err := cl.WaitForNActiveUnits(m, nu)
if err != nil {
return nil, fmt.Errorf("Failed to run list-units: %v", err)
}
return listUnitStates, nil
}
开发者ID:pulcy,项目名称:j2,代码行数:7,代码来源:unit_action_test.go
示例2: waitForNUnitsSubmit
func waitForNUnitsSubmit(cl platform.Cluster, m platform.Member, nu int) (map[string][]util.UnitFileState, error) {
// wait until the unit gets processed up to 15 seconds
listUnitStates, err := cl.WaitForNUnitFiles(m, nu)
if err != nil {
return nil, fmt.Errorf("Failed to run list-unit-files: %v", err)
}
return listUnitStates, nil
}
开发者ID:pulcy,项目名称:j2,代码行数:8,代码来源:unit_action_test.go
示例3: cleanUnits
func cleanUnits(cl platform.Cluster, m platform.Member, cmd string, ufs []string, nu int) (err error) {
for i := 0; i < nu; i++ {
if _, _, err := cl.Fleetctl(m, cmd, ufs[i]); err != nil {
return fmt.Errorf("Failed to %s unit: %v", cmd, err)
}
}
return nil
}
开发者ID:pulcy,项目名称:j2,代码行数:8,代码来源:unit_action_test.go
示例4: waitForFleetdSocket
// waitForFleetdSocket returns if /var/run/fleet.sock exists, periodically
// checking for states.
func waitForFleetdSocket(cluster platform.Cluster, m0 platform.Member) (err error) {
_, err = util.WaitForState(
func() bool {
stdout, _, _ := cluster.MemberCommand(m0, "test -S /var/run/fleet.sock && echo 1")
if strings.TrimSpace(stdout) == "" {
fmt.Errorf("Fleetd is not fully started, retrying...")
return false
}
return true
},
)
if err != nil {
return fmt.Errorf("Fleetd socket not found: %v", err)
}
return nil
}
开发者ID:jonboulle,项目名称:fleet,代码行数:19,代码来源:server_test.go
示例5: launchUnitsCmd
func launchUnitsCmd(cluster platform.Cluster, m platform.Member, cmd string, numUnits int) (unitFiles []string, err error) {
args := []string{cmd}
for i := 0; i < numUnits; i++ {
unitFile := fmt.Sprintf("fixtures/units/[email protected]%d.service", i+1)
args = append(args, unitFile)
unitFiles = append(unitFiles, path.Base(unitFile))
}
if stdout, stderr, err := cluster.Fleetctl(m, args...); err != nil {
return nil,
fmt.Errorf("Unable to %s batch of units: \nstdout: %s\nstderr: %s\nerr: %v",
cmd, stdout, stderr, err)
} else if strings.Contains(stderr, "Error") {
return nil,
fmt.Errorf("Failed to correctly %s batch of units: \nstdout: %s\nstderr: %s\nerr: %v",
cmd, stdout, stderr, err)
}
return unitFiles, nil
}
开发者ID:pulcy,项目名称:j2,代码行数:20,代码来源:unit_action_test.go
示例6: waitForReloadConfig
// waitForReloadConfig returns if a message "Reloading configuration" exists
// in the journal, periodically checking for the journal up to the timeout.
func waitForReloadConfig(cluster platform.Cluster, m0 platform.Member) (err error) {
_, err = util.WaitForState(
func() bool {
// NOTE: journalctl should run just simply like "journalctl -u fleet",
// without being piped with grep. Doing
// "journalctl -u fleet | grep \"Reloading configuration\"" is racy
// in a subtle way, so that it sometimes fails only on semaphoreci.
// - dpark 20160408
stdout, _, _ := cluster.MemberCommand(m0, "sudo", "journalctl --priority=info _PID=$(pidof fleetd)")
journalfleet := strings.TrimSpace(stdout)
if !strings.Contains(journalfleet, "Reloading configuration") {
fmt.Errorf("Fleetd is not fully reconfigured, retrying... entire fleet journal:\n%v", journalfleet)
return false
}
return true
},
)
if err != nil {
return fmt.Errorf("Reloading configuration log not found: %v", err)
}
return nil
}
开发者ID:jonboulle,项目名称:fleet,代码行数:25,代码来源:server_test.go
注:本文中的github.com/coreos/fleet/functional/platform.Cluster类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论