@@ -105,12 +105,14 @@ var (
105
105
suite remote.TestSuite
106
106
)
107
107
108
+ // Archive contains path info in the archive.
108
109
type Archive struct {
109
110
sync.Once
110
111
path string
111
112
err error
112
113
}
113
114
115
+ // TestResult contains some information about the test results.
114
116
type TestResult struct {
115
117
output string
116
118
err error
@@ -129,22 +131,24 @@ type TestResult struct {
129
131
// project: gce-image-project
130
132
// machine: for benchmark only, the machine type (GCE instance) to run test
131
133
// tests: for benchmark only, a list of ginkgo focus strings to match tests
132
-
133
134
// TODO(coufon): replace 'image' with 'node' in configurations
134
135
// and we plan to support testing custom machines other than GCE by specifying host
135
136
type ImageConfig struct {
136
137
Images map [string ]GCEImage `json:"images"`
137
138
}
138
139
140
+ // Accelerator contains type and count about resource.
139
141
type Accelerator struct {
140
142
Type string `json:"type,omitempty"`
141
143
Count int64 `json:"count,omitempty"`
142
144
}
143
145
146
+ // Resources contains accelerators array.
144
147
type Resources struct {
145
148
Accelerators []Accelerator `json:"accelerators,omitempty"`
146
149
}
147
150
151
+ // GCEImage contains some information about CGE Image.
148
152
type GCEImage struct {
149
153
Image string `json:"image,omitempty"`
150
154
ImageDesc string `json:"image_description,omitempty"`
@@ -428,23 +432,23 @@ func testHost(host string, deleteFiles bool, imageDesc, junitFilePrefix, ginkgoF
428
432
}
429
433
}
430
434
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 )
432
436
return & TestResult {
433
437
err : err ,
434
438
host : host ,
435
439
exitOk : false ,
436
440
}
437
441
}
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 )
441
445
}
442
446
443
447
path , err := arc .getArchive ()
444
448
if err != nil {
445
449
// Don't log fatal because we need to do any needed cleanup contained in "defer" statements
446
450
return & TestResult {
447
- err : fmt .Errorf ("unable to create test archive: %v. " , err ),
451
+ err : fmt .Errorf ("unable to create test archive: %v" , err ),
448
452
}
449
453
}
450
454
@@ -643,12 +647,12 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
643
647
continue
644
648
}
645
649
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 )
647
651
continue
648
652
}
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 )
652
656
}
653
657
// TODO(random-liu): Remove the docker version check. Use some other command to check
654
658
// instance readiness.
@@ -699,7 +703,7 @@ func isCloudInitUsed(metadata *compute.Metadata) bool {
699
703
return false
700
704
}
701
705
702
- func getExternalIp (instance * compute.Instance ) string {
706
+ func getExternalIP (instance * compute.Instance ) string {
703
707
for i := range instance .NetworkInterfaces {
704
708
ni := instance .NetworkInterfaces [i ]
705
709
for j := range ni .AccessConfigs {
0 commit comments