Skip to content

Commit 2f58d2e

Browse files
authored
Merge pull request kubernetes#85890 from tanjunchen/fix-golint-test-e2e_node-ruuner
fix golint check in test/e2e_node/runner/remote
2 parents b1766b7 + 29eb15c commit 2f58d2e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,5 +520,4 @@ staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/fischer
520520
staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder
521521
test/e2e/common
522522
test/e2e/storage/vsphere
523-
test/e2e_node/runner/remote
524523
test/utils

test/e2e_node/runner/remote/run_remote.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ var (
105105
suite remote.TestSuite
106106
)
107107

108+
// Archive contains path info in the archive.
108109
type Archive struct {
109110
sync.Once
110111
path string
111112
err error
112113
}
113114

115+
// TestResult contains some information about the test results.
114116
type TestResult struct {
115117
output string
116118
err error
@@ -129,22 +131,24 @@ type TestResult struct {
129131
// project: gce-image-project
130132
// machine: for benchmark only, the machine type (GCE instance) to run test
131133
// tests: for benchmark only, a list of ginkgo focus strings to match tests
132-
133134
// TODO(coufon): replace 'image' with 'node' in configurations
134135
// and we plan to support testing custom machines other than GCE by specifying host
135136
type ImageConfig struct {
136137
Images map[string]GCEImage `json:"images"`
137138
}
138139

140+
// Accelerator contains type and count about resource.
139141
type Accelerator struct {
140142
Type string `json:"type,omitempty"`
141143
Count int64 `json:"count,omitempty"`
142144
}
143145

146+
// Resources contains accelerators array.
144147
type Resources struct {
145148
Accelerators []Accelerator `json:"accelerators,omitempty"`
146149
}
147150

151+
// GCEImage contains some information about CGE Image.
148152
type GCEImage struct {
149153
Image string `json:"image,omitempty"`
150154
ImageDesc string `json:"image_description,omitempty"`
@@ -428,23 +432,23 @@ func testHost(host string, deleteFiles bool, imageDesc, junitFilePrefix, ginkgoF
428432
}
429433
}
430434
if strings.ToUpper(instance.Status) != "RUNNING" {
431-
err = fmt.Errorf("instance %s not in state RUNNING, was %s.", host, instance.Status)
435+
err = fmt.Errorf("instance %s not in state RUNNING, was %s", host, instance.Status)
432436
return &TestResult{
433437
err: err,
434438
host: host,
435439
exitOk: false,
436440
}
437441
}
438-
externalIp := getExternalIp(instance)
439-
if len(externalIp) > 0 {
440-
remote.AddHostnameIP(host, externalIp)
442+
externalIP := getExternalIP(instance)
443+
if len(externalIP) > 0 {
444+
remote.AddHostnameIP(host, externalIP)
441445
}
442446

443447
path, err := arc.getArchive()
444448
if err != nil {
445449
// Don't log fatal because we need to do any needed cleanup contained in "defer" statements
446450
return &TestResult{
447-
err: fmt.Errorf("unable to create test archive: %v.", err),
451+
err: fmt.Errorf("unable to create test archive: %v", err),
448452
}
449453
}
450454

@@ -643,12 +647,12 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
643647
continue
644648
}
645649
if strings.ToUpper(instance.Status) != "RUNNING" {
646-
err = fmt.Errorf("instance %s not in state RUNNING, was %s.", name, instance.Status)
650+
err = fmt.Errorf("instance %s not in state RUNNING, was %s", name, instance.Status)
647651
continue
648652
}
649-
externalIp := getExternalIp(instance)
650-
if len(externalIp) > 0 {
651-
remote.AddHostnameIP(name, externalIp)
653+
externalIP := getExternalIP(instance)
654+
if len(externalIP) > 0 {
655+
remote.AddHostnameIP(name, externalIP)
652656
}
653657
// TODO(random-liu): Remove the docker version check. Use some other command to check
654658
// instance readiness.
@@ -699,7 +703,7 @@ func isCloudInitUsed(metadata *compute.Metadata) bool {
699703
return false
700704
}
701705

702-
func getExternalIp(instance *compute.Instance) string {
706+
func getExternalIP(instance *compute.Instance) string {
703707
for i := range instance.NetworkInterfaces {
704708
ni := instance.NetworkInterfaces[i]
705709
for j := range ni.AccessConfigs {

0 commit comments

Comments
 (0)