mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
run_remote.go: factor out registerGceHostIP()
Prep for future patch.
This commit is contained in:
parent
806e38aeb7
commit
36233b985b
@ -436,28 +436,30 @@ func getImageMetadata(input string) *compute.Metadata {
|
|||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run tests in archive against host
|
func registerGceHostIP(host string) error {
|
||||||
func testHost(host string, deleteFiles bool, imageDesc, junitFileName, ginkgoFlagsStr string) *TestResult {
|
|
||||||
instance, err := computeService.Instances.Get(*project, *zone, host).Do()
|
instance, err := computeService.Instances.Get(*project, *zone, host).Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &TestResult{
|
return err
|
||||||
err: err,
|
|
||||||
host: host,
|
|
||||||
exitOk: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if strings.ToUpper(instance.Status) != "RUNNING" {
|
if strings.ToUpper(instance.Status) != "RUNNING" {
|
||||||
err = fmt.Errorf("instance %s not in state RUNNING, was %s", host, instance.Status)
|
return fmt.Errorf("instance %s not in state RUNNING, was %s", host, instance.Status)
|
||||||
return &TestResult{
|
|
||||||
err: err,
|
|
||||||
host: host,
|
|
||||||
exitOk: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
externalIP := getExternalIP(instance)
|
externalIP := getExternalIP(instance)
|
||||||
if len(externalIP) > 0 {
|
if len(externalIP) > 0 {
|
||||||
remote.AddHostnameIP(host, externalIP)
|
remote.AddHostnameIP(host, externalIP)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run tests in archive against host
|
||||||
|
func testHost(host string, deleteFiles bool, imageDesc, junitFileName, ginkgoFlagsStr string) *TestResult {
|
||||||
|
if err := registerGceHostIP(host); err != nil {
|
||||||
|
return &TestResult{
|
||||||
|
err: err,
|
||||||
|
host: host,
|
||||||
|
exitOk: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
path, err := arc.getArchive()
|
path, err := arc.getArchive()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user