mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Update log level.
This commit is contained in:
parent
54c874f2c6
commit
02e96df55c
@ -200,7 +200,7 @@ func launchKubelet(host, workspace, results, testArgs string) error {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.Infof("Launch kubelet with command: %v", cmd)
|
glog.V(2).Infof("Launch kubelet with command: %v", cmd)
|
||||||
output, err := SSH(host, cmd...)
|
output, err := SSH(host, cmd...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to launch kubelet with command %v: error - %v output - %q",
|
return fmt.Errorf("failed to launch kubelet with command %v: error - %v output - %q",
|
||||||
@ -285,7 +285,7 @@ func (c *ConformanceRemote) RunTest(host, workspace, results, junitFilePrefix, t
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Run the tests
|
// Run the tests
|
||||||
glog.Infof("Starting tests on %q", host)
|
glog.V(2).Infof("Starting tests on %q", host)
|
||||||
podManifestPath := getPodManifestPath(workspace)
|
podManifestPath := getPodManifestPath(workspace)
|
||||||
cmd := fmt.Sprintf("'timeout -k 30s %fs docker run --rm --privileged=true --net=host -v /:/rootfs -v %s:%s -v %s:/var/result %s'",
|
cmd := fmt.Sprintf("'timeout -k 30s %fs docker run --rm --privileged=true --net=host -v /:/rootfs -v %s:%s -v %s:/var/result %s'",
|
||||||
timeout.Seconds(), podManifestPath, podManifestPath, results, getConformanceImageRepo())
|
timeout.Seconds(), podManifestPath, podManifestPath, results, getConformanceImageRepo())
|
||||||
|
@ -120,7 +120,7 @@ func updateGCIMounterPath(args, host, workspace string) (string, error) {
|
|||||||
return args, fmt.Errorf("could not find GCI mounter script at %q! If this script has been (re)moved, please update the e2e node remote test runner accordingly! Err: %v", source, err)
|
return args, fmt.Errorf("could not find GCI mounter script at %q! If this script has been (re)moved, please update the e2e node remote test runner accordingly! Err: %v", source, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("GCI node and GCI mounter both detected, modifying --experimental-mounter-path accordingly")
|
glog.V(2).Infof("GCI node and GCI mounter both detected, modifying --experimental-mounter-path accordingly")
|
||||||
// Note this implicitly requires the script to be where we expect in the tarball, so if that location changes the error
|
// Note this implicitly requires the script to be where we expect in the tarball, so if that location changes the error
|
||||||
// here will tell us to update the remote test runner.
|
// here will tell us to update the remote test runner.
|
||||||
mounterPath := filepath.Join(workspace, localGCIMounterPath)
|
mounterPath := filepath.Join(workspace, localGCIMounterPath)
|
||||||
@ -154,7 +154,7 @@ func (n *NodeE2ERemote) RunTest(host, workspace, results, junitFilePrefix, testA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run the tests
|
// Run the tests
|
||||||
glog.Infof("Starting tests on %q", host)
|
glog.V(2).Infof("Starting tests on %q", host)
|
||||||
cmd := getSSHCommand(" && ",
|
cmd := getSSHCommand(" && ",
|
||||||
fmt.Sprintf("cd %s", workspace),
|
fmt.Sprintf("cd %s", workspace),
|
||||||
fmt.Sprintf("timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --logtostderr --v 4 --node-name=%s --report-dir=%s --report-prefix=%s %s",
|
fmt.Sprintf("timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --logtostderr --v 4 --node-name=%s --report-dir=%s --report-prefix=%s %s",
|
||||||
|
@ -35,7 +35,7 @@ var resultsDir = flag.String("results-dir", "/tmp/", "Directory to scp test resu
|
|||||||
const archiveName = "e2e_node_test.tar.gz"
|
const archiveName = "e2e_node_test.tar.gz"
|
||||||
|
|
||||||
func CreateTestArchive(suite TestSuite) (string, error) {
|
func CreateTestArchive(suite TestSuite) (string, error) {
|
||||||
glog.Infof("Building archive...")
|
glog.V(2).Infof("Building archive...")
|
||||||
tardir, err := ioutil.TempDir("", "node-e2e-archive")
|
tardir, err := ioutil.TempDir("", "node-e2e-archive")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to create temporary directory %v.", err)
|
return "", fmt.Errorf("failed to create temporary directory %v.", err)
|
||||||
@ -65,7 +65,7 @@ func CreateTestArchive(suite TestSuite) (string, error) {
|
|||||||
// TODO(random-liu): junitFilePrefix is not prefix actually, the file name is junit-junitFilePrefix.xml. Change the variable name.
|
// TODO(random-liu): junitFilePrefix is not prefix actually, the file name is junit-junitFilePrefix.xml. Change the variable name.
|
||||||
func RunRemote(suite TestSuite, archive string, host string, cleanup bool, junitFilePrefix string, testArgs string, ginkgoArgs string) (string, bool, error) {
|
func RunRemote(suite TestSuite, archive string, host string, cleanup bool, junitFilePrefix string, testArgs string, ginkgoArgs string) (string, bool, error) {
|
||||||
// Create the temp staging directory
|
// Create the temp staging directory
|
||||||
glog.Infof("Staging test binaries on %q", host)
|
glog.V(2).Infof("Staging test binaries on %q", host)
|
||||||
workspace := fmt.Sprintf("/tmp/node-e2e-%s", getTimestamp())
|
workspace := fmt.Sprintf("/tmp/node-e2e-%s", getTimestamp())
|
||||||
// Do not sudo here, so that we can use scp to copy test archive to the directdory.
|
// Do not sudo here, so that we can use scp to copy test archive to the directdory.
|
||||||
if output, err := SSHNoSudo(host, "mkdir", workspace); err != nil {
|
if output, err := SSHNoSudo(host, "mkdir", workspace); err != nil {
|
||||||
@ -92,7 +92,7 @@ func RunRemote(suite TestSuite, archive string, host string, cleanup bool, junit
|
|||||||
fmt.Sprintf("cd %s", workspace),
|
fmt.Sprintf("cd %s", workspace),
|
||||||
fmt.Sprintf("tar -xzvf ./%s", archiveName),
|
fmt.Sprintf("tar -xzvf ./%s", archiveName),
|
||||||
)
|
)
|
||||||
glog.Infof("Extracting tar on %q", host)
|
glog.V(2).Infof("Extracting tar on %q", host)
|
||||||
if output, err := SSH(host, "sh", "-c", cmd); err != nil {
|
if output, err := SSH(host, "sh", "-c", cmd); err != nil {
|
||||||
// Exit failure with the error
|
// Exit failure with the error
|
||||||
return "", false, fmt.Errorf("failed to extract test archive: %v, output: %q", err, output)
|
return "", false, fmt.Errorf("failed to extract test archive: %v, output: %q", err, output)
|
||||||
@ -105,7 +105,7 @@ func RunRemote(suite TestSuite, archive string, host string, cleanup bool, junit
|
|||||||
return "", false, fmt.Errorf("failed to create test result directory %q on host %q: %v output: %q", resultDir, host, err, output)
|
return "", false, fmt.Errorf("failed to create test result directory %q on host %q: %v output: %q", resultDir, host, err, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Running test on %q", host)
|
glog.V(2).Infof("Running test on %q", host)
|
||||||
output, err := suite.RunTest(host, workspace, resultDir, junitFilePrefix, testArgs, ginkgoArgs, *testTimeoutSeconds)
|
output, err := suite.RunTest(host, workspace, resultDir, junitFilePrefix, testArgs, ginkgoArgs, *testTimeoutSeconds)
|
||||||
|
|
||||||
aggErrs := []error{}
|
aggErrs := []error{}
|
||||||
@ -115,7 +115,7 @@ func RunRemote(suite TestSuite, archive string, host string, cleanup bool, junit
|
|||||||
collectSystemLog(host, workspace)
|
collectSystemLog(host, workspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Copying test artifacts from %q", host)
|
glog.V(2).Infof("Copying test artifacts from %q", host)
|
||||||
scpErr := getTestArtifacts(host, workspace)
|
scpErr := getTestArtifacts(host, workspace)
|
||||||
if scpErr != nil {
|
if scpErr != nil {
|
||||||
aggErrs = append(aggErrs, scpErr)
|
aggErrs = append(aggErrs, scpErr)
|
||||||
@ -162,17 +162,17 @@ func collectSystemLog(host, workspace string) {
|
|||||||
logPath = fmt.Sprintf("/tmp/%s-%s", getTimestamp(), logName)
|
logPath = fmt.Sprintf("/tmp/%s-%s", getTimestamp(), logName)
|
||||||
destPath = fmt.Sprintf("%s/%s-%s", *resultsDir, host, logName)
|
destPath = fmt.Sprintf("%s/%s-%s", *resultsDir, host, logName)
|
||||||
)
|
)
|
||||||
glog.Infof("Test failed unexpectedly. Attempting to retreiving system logs (only works for nodes with journald)")
|
glog.V(2).Infof("Test failed unexpectedly. Attempting to retreiving system logs (only works for nodes with journald)")
|
||||||
// Try getting the system logs from journald and store it to a file.
|
// Try getting the system logs from journald and store it to a file.
|
||||||
// Don't reuse the original test directory on the remote host because
|
// Don't reuse the original test directory on the remote host because
|
||||||
// it could've be been removed if the node was rebooted.
|
// it could've be been removed if the node was rebooted.
|
||||||
if output, err := SSH(host, "sh", "-c", fmt.Sprintf("'journalctl --system --all > %s'", logPath)); err == nil {
|
if output, err := SSH(host, "sh", "-c", fmt.Sprintf("'journalctl --system --all > %s'", logPath)); err == nil {
|
||||||
glog.Infof("Got the system logs from journald; copying it back...")
|
glog.V(2).Infof("Got the system logs from journald; copying it back...")
|
||||||
if output, err := runSSHCommand("scp", fmt.Sprintf("%s:%s", GetHostnameOrIp(host), logPath), destPath); err != nil {
|
if output, err := runSSHCommand("scp", fmt.Sprintf("%s:%s", GetHostnameOrIp(host), logPath), destPath); err != nil {
|
||||||
glog.Infof("Failed to copy the log: err: %v, output: %q", err, output)
|
glog.V(2).Infof("Failed to copy the log: err: %v, output: %q", err, output)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.Infof("Failed to run journactl (normal if it doesn't exist on the node): %v, output: %q", err, output)
|
glog.V(2).Infof("Failed to run journactl (normal if it doesn't exist on the node): %v, output: %q", err, output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ const (
|
|||||||
|
|
||||||
// Install the cni plugin.
|
// Install the cni plugin.
|
||||||
func installCNI(host, workspace string) error {
|
func installCNI(host, workspace string) error {
|
||||||
glog.Infof("Install CNI on %q", host)
|
glog.V(2).Infof("Install CNI on %q", host)
|
||||||
cniPath := filepath.Join(workspace, cniDirectory)
|
cniPath := filepath.Join(workspace, cniDirectory)
|
||||||
cmd := getSSHCommand(" ; ",
|
cmd := getSSHCommand(" ; ",
|
||||||
fmt.Sprintf("mkdir -p %s", cniPath),
|
fmt.Sprintf("mkdir -p %s", cniPath),
|
||||||
@ -48,7 +48,7 @@ func installCNI(host, workspace string) error {
|
|||||||
|
|
||||||
// configureFirewall configures iptable firewall rules.
|
// configureFirewall configures iptable firewall rules.
|
||||||
func configureFirewall(host string) error {
|
func configureFirewall(host string) error {
|
||||||
glog.Infof("Configure iptables firewall rules on %q", host)
|
glog.V(2).Infof("Configure iptables firewall rules on %q", host)
|
||||||
// TODO: consider calling bootstrap script to configure host based on OS
|
// TODO: consider calling bootstrap script to configure host based on OS
|
||||||
output, err := SSH(host, "iptables", "-L", "INPUT")
|
output, err := SSH(host, "iptables", "-L", "INPUT")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -83,7 +83,7 @@ func configureFirewall(host string) error {
|
|||||||
|
|
||||||
// cleanupNodeProcesses kills all running node processes may conflict with the test.
|
// cleanupNodeProcesses kills all running node processes may conflict with the test.
|
||||||
func cleanupNodeProcesses(host string) {
|
func cleanupNodeProcesses(host string) {
|
||||||
glog.Infof("Killing any existing node processes on %q", host)
|
glog.V(2).Infof("Killing any existing node processes on %q", host)
|
||||||
cmd := getSSHCommand(" ; ",
|
cmd := getSSHCommand(" ; ",
|
||||||
"pkill kubelet",
|
"pkill kubelet",
|
||||||
"pkill kube-apiserver",
|
"pkill kube-apiserver",
|
||||||
|
Loading…
Reference in New Issue
Block a user