Skip to content

Commit dfcc60d

Browse files
authored
Merge pull request kubernetes#77908 from SataQiu/fix-golint-test-20190515
Fix golint failures of test/e2e_node/services
2 parents 5a233cc + 7fa953f commit dfcc60d

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,5 +604,4 @@ test/e2e_kubeadm
604604
test/e2e_node
605605
test/e2e_node/remote
606606
test/e2e_node/runner/remote
607-
test/e2e_node/services
608607
test/utils

test/e2e_node/services/apiserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func (a *APIServer) Stop() error {
9090

9191
const apiserverName = "apiserver"
9292

93+
// Name returns the name of APIServer.
9394
func (a *APIServer) Name() string {
9495
return apiserverName
9596
}

test/e2e_node/services/internal_services.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (es *e2eServices) start(t *testing.T) error {
6060
if err != nil {
6161
return err
6262
}
63-
err = es.startApiServer(es.etcdStorage)
63+
err = es.startAPIServer(es.etcdStorage)
6464
if err != nil {
6565
return err
6666
}
@@ -116,8 +116,8 @@ func (es *e2eServices) startEtcd(t *testing.T) error {
116116
return nil
117117
}
118118

119-
// startApiServer starts the embedded API server or returns an error.
120-
func (es *e2eServices) startApiServer(etcdStorage *storagebackend.Config) error {
119+
// startAPIServer starts the embedded API server or returns an error.
120+
func (es *e2eServices) startAPIServer(etcdStorage *storagebackend.Config) error {
121121
klog.Info("Starting API server")
122122
es.apiServer = NewAPIServer(*etcdStorage)
123123
return es.apiServer.Start()

test/e2e_node/services/kubelet.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ func RunKubelet() {
9191

9292
const (
9393
// Ports of different e2e services.
94-
kubeletPort = "10250"
95-
kubeletReadOnlyPort = "10255"
94+
kubeletPort = "10250"
95+
kubeletReadOnlyPort = "10255"
96+
// KubeletRootDirectory specifies the directory where the kubelet runtime information is stored.
9697
KubeletRootDirectory = "/var/lib/kubelet"
9798
// Health check url of kubelet
9899
kubeletHealthCheckURL = "http://127.0.0.1:" + kubeletReadOnlyPort + "/healthz"
@@ -258,7 +259,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
258259
cmdArgs = append(cmdArgs,
259260
"--kubeconfig", kubeconfigPath,
260261
"--root-dir", KubeletRootDirectory,
261-
"--v", LOG_VERBOSITY_LEVEL, "--logtostderr",
262+
"--v", LogVerbosityLevel, "--logtostderr",
262263
"--allow-privileged=true",
263264
)
264265

@@ -412,9 +413,8 @@ func createRootDirectory(path string) error {
412413
if _, err := os.Stat(path); err != nil {
413414
if os.IsNotExist(err) {
414415
return os.MkdirAll(path, os.FileMode(0755))
415-
} else {
416-
return err
417416
}
417+
return err
418418
}
419419
return nil
420420
}

test/e2e_node/services/server.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (s *server) start() error {
106106
var stopRestartingCh, ackStopRestartingCh chan bool
107107
if s.restartOnExit {
108108
if len(s.healthCheckUrls) == 0 {
109-
return fmt.Errorf("Tried to start %s which has s.restartOnExit == true, but no health check urls provided.", s)
109+
return fmt.Errorf("tried to start %s which has s.restartOnExit == true, but no health check urls provided", s)
110110
}
111111

112112
stopRestartingCh = make(chan bool)
@@ -124,11 +124,10 @@ func (s *server) start() error {
124124
outPath := path.Join(framework.TestContext.ReportDir, s.outFilename)
125125
outfile, err := os.Create(outPath)
126126
if err != nil {
127-
errCh <- fmt.Errorf("failed to create file %q for `%s` %v.", outPath, s, err)
127+
errCh <- fmt.Errorf("failed to create file %q for `%s` %v", outPath, s, err)
128128
return
129-
} else {
130-
klog.Infof("Output file for server %q: %v", s.name, outfile.Name())
131129
}
130+
klog.Infof("Output file for server %q: %v", s.name, outfile.Name())
132131
defer outfile.Close()
133132
defer outfile.Sync()
134133

test/e2e_node/services/services.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func RunE2EServices(t *testing.T) {
121121
const (
122122
// services.log is the combined log of all services
123123
servicesLogFile = "services.log"
124-
// LOG_VERBOSITY_LEVEL is consistent with the level used in a cluster e2e test.
125-
LOG_VERBOSITY_LEVEL = "4"
124+
// LogVerbosityLevel is consistent with the level used in a cluster e2e test.
125+
LogVerbosityLevel = "4"
126126
)
127127

128128
// startInternalServices starts the internal services in a separate process.

0 commit comments

Comments
 (0)