mirror of https://github.com/k3s-io/k3s
fix golint failures of test/e2e_node/services
parent
b066e0d783
commit
7fa953fcb5
|
@ -613,5 +613,4 @@ test/e2e_kubeadm
|
|||
test/e2e_node
|
||||
test/e2e_node/remote
|
||||
test/e2e_node/runner/remote
|
||||
test/e2e_node/services
|
||||
test/utils
|
||||
|
|
|
@ -90,6 +90,7 @@ func (a *APIServer) Stop() error {
|
|||
|
||||
const apiserverName = "apiserver"
|
||||
|
||||
// Name returns the name of APIServer.
|
||||
func (a *APIServer) Name() string {
|
||||
return apiserverName
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ func (es *e2eServices) start(t *testing.T) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = es.startApiServer(es.etcdStorage)
|
||||
err = es.startAPIServer(es.etcdStorage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ func (es *e2eServices) startEtcd(t *testing.T) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// startApiServer starts the embedded API server or returns an error.
|
||||
func (es *e2eServices) startApiServer(etcdStorage *storagebackend.Config) error {
|
||||
// startAPIServer starts the embedded API server or returns an error.
|
||||
func (es *e2eServices) startAPIServer(etcdStorage *storagebackend.Config) error {
|
||||
klog.Info("Starting API server")
|
||||
es.apiServer = NewAPIServer(*etcdStorage)
|
||||
return es.apiServer.Start()
|
||||
|
|
|
@ -93,6 +93,7 @@ const (
|
|||
// Ports of different e2e services.
|
||||
kubeletPort = "10250"
|
||||
kubeletReadOnlyPort = "10255"
|
||||
// KubeletRootDirectory specifies the directory where the kubelet runtime information is stored.
|
||||
KubeletRootDirectory = "/var/lib/kubelet"
|
||||
// Health check url of kubelet
|
||||
kubeletHealthCheckURL = "http://127.0.0.1:" + kubeletReadOnlyPort + "/healthz"
|
||||
|
@ -258,7 +259,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
|
|||
cmdArgs = append(cmdArgs,
|
||||
"--kubeconfig", kubeconfigPath,
|
||||
"--root-dir", KubeletRootDirectory,
|
||||
"--v", LOG_VERBOSITY_LEVEL, "--logtostderr",
|
||||
"--v", LogVerbosityLevel, "--logtostderr",
|
||||
"--allow-privileged=true",
|
||||
)
|
||||
|
||||
|
@ -412,9 +413,8 @@ func createRootDirectory(path string) error {
|
|||
if _, err := os.Stat(path); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return os.MkdirAll(path, os.FileMode(0755))
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ func (s *server) start() error {
|
|||
var stopRestartingCh, ackStopRestartingCh chan bool
|
||||
if s.restartOnExit {
|
||||
if len(s.healthCheckUrls) == 0 {
|
||||
return fmt.Errorf("Tried to start %s which has s.restartOnExit == true, but no health check urls provided.", s)
|
||||
return fmt.Errorf("tried to start %s which has s.restartOnExit == true, but no health check urls provided", s)
|
||||
}
|
||||
|
||||
stopRestartingCh = make(chan bool)
|
||||
|
@ -124,11 +124,10 @@ func (s *server) start() error {
|
|||
outPath := path.Join(framework.TestContext.ReportDir, s.outFilename)
|
||||
outfile, err := os.Create(outPath)
|
||||
if err != nil {
|
||||
errCh <- fmt.Errorf("failed to create file %q for `%s` %v.", outPath, s, err)
|
||||
errCh <- fmt.Errorf("failed to create file %q for `%s` %v", outPath, s, err)
|
||||
return
|
||||
} else {
|
||||
klog.Infof("Output file for server %q: %v", s.name, outfile.Name())
|
||||
}
|
||||
klog.Infof("Output file for server %q: %v", s.name, outfile.Name())
|
||||
defer outfile.Close()
|
||||
defer outfile.Sync()
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ func RunE2EServices(t *testing.T) {
|
|||
const (
|
||||
// services.log is the combined log of all services
|
||||
servicesLogFile = "services.log"
|
||||
// LOG_VERBOSITY_LEVEL is consistent with the level used in a cluster e2e test.
|
||||
LOG_VERBOSITY_LEVEL = "4"
|
||||
// LogVerbosityLevel is consistent with the level used in a cluster e2e test.
|
||||
LogVerbosityLevel = "4"
|
||||
)
|
||||
|
||||
// startInternalServices starts the internal services in a separate process.
|
||||
|
|
Loading…
Reference in New Issue