Skip to content

Commit

Permalink
run_remote.go: factor out registerGceHostIP()
Browse files Browse the repository at this point in the history
Prep for future patch.
  • Loading branch information
jlebon committed Nov 22, 2021
1 parent 806e38a commit 36233b9
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/e2e_node/runner/remote/run_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,28 +436,30 @@ func getImageMetadata(input string) *compute.Metadata {
return &ret
}

// Run tests in archive against host
func testHost(host string, deleteFiles bool, imageDesc, junitFileName, ginkgoFlagsStr string) *TestResult {
func registerGceHostIP(host string) error {
instance, err := computeService.Instances.Get(*project, *zone, host).Do()
if err != nil {
return &TestResult{
err: err,
host: host,
exitOk: false,
}
return err
}
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)
}
externalIP := getExternalIP(instance)
if len(externalIP) > 0 {
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,
}
}
externalIP := getExternalIP(instance)
if len(externalIP) > 0 {
remote.AddHostnameIP(host, externalIP)
}

path, err := arc.getArchive()
if err != nil {
Expand Down

0 comments on commit 36233b9

Please sign in to comment.