Adding logs command integration tests
parent
0f6b92d7ad
commit
44c3a6a126
|
@ -24,11 +24,6 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
)
|
||||
|
||||
const (
|
||||
remoteLocalKubeErrPath = "/var/log/localkube.err"
|
||||
remoteLocalKubeOutPath = "/var/log/localkube.out"
|
||||
)
|
||||
|
||||
// Kill any running instances.
|
||||
var stopCommand = "sudo killall localkube | true"
|
||||
|
||||
|
@ -37,7 +32,7 @@ var startCommandFmtStr = `
|
|||
PATH=/usr/local/sbin:$PATH nohup sudo /usr/local/bin/localkube %s --generate-certs=false --logtostderr=true > %s 2> %s < /dev/null &
|
||||
`
|
||||
|
||||
var logsCommand = fmt.Sprintf("tail -n +1 %s %s", remoteLocalKubeErrPath, remoteLocalKubeOutPath)
|
||||
var logsCommand = fmt.Sprintf("tail -n +1 %s %s", constants.RemoteLocalKubeErrPath, constants.RemoteLocalKubeOutPath)
|
||||
|
||||
func GetStartCommand() string {
|
||||
flagVals := make([]string, len(constants.LogFlags))
|
||||
|
@ -47,5 +42,5 @@ func GetStartCommand() string {
|
|||
}
|
||||
}
|
||||
flags := strings.Join(flagVals, " ")
|
||||
return fmt.Sprintf(startCommandFmtStr, flags, remoteLocalKubeErrPath, remoteLocalKubeOutPath)
|
||||
return fmt.Sprintf(startCommandFmtStr, flags, constants.RemoteLocalKubeErrPath, constants.RemoteLocalKubeOutPath)
|
||||
}
|
||||
|
|
|
@ -46,3 +46,8 @@ var LogFlags = [...]string{
|
|||
}
|
||||
|
||||
const DefaultIsoUrl = "https://storage.googleapis.com/minikube/minikube-0.1.iso"
|
||||
|
||||
const (
|
||||
RemoteLocalKubeErrPath = "/var/log/localkube.err"
|
||||
RemoteLocalKubeOutPath = "/var/log/localkube.out"
|
||||
)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
// +build integration
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
"k8s.io/minikube/test/integration/util"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClusterLogs(t *testing.T) {
|
||||
minikubeRunner := util.MinikubeRunner{BinaryPath: *binaryPath, T: t}
|
||||
minikubeRunner.RunCommand("start", true)
|
||||
minikubeRunner.CheckStatus("Running")
|
||||
|
||||
logsCmdOutput := minikubeRunner.RunCommand("logs", true)
|
||||
//check for # of lines or check for strings
|
||||
logFiles := []string{constants.RemoteLocalKubeErrPath, constants.RemoteLocalKubeOutPath}
|
||||
for _, logFile := range logFiles {
|
||||
if !strings.Contains(logsCmdOutput, logFile) {
|
||||
t.Fatalf("Error in logsCmdOutput, expected to find: %s. Output: %s", logFile, logsCmdOutput)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue