From 0d8a492fbf2343806ec2381bfeef4f54482a70a1 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 22 Feb 2017 14:49:59 +0100 Subject: [PATCH] Add ability to disable dumping logs --- hack/verify-flags/known-flags.txt | 1 + test/e2e/framework/test_context.go | 3 +++ test/e2e/framework/util.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/hack/verify-flags/known-flags.txt b/hack/verify-flags/known-flags.txt index 7cfea27cbe..74a9a76668 100644 --- a/hack/verify-flags/known-flags.txt +++ b/hack/verify-flags/known-flags.txt @@ -141,6 +141,7 @@ deserialization-cache-size dest-file disable-filter disable-kubenet +disable-log-dump discovery-port dns-bind-address dns-port diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 94c76ffd9c..ebde9fc007 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -75,6 +75,8 @@ type TestContextType struct { CreateTestingNS CreateTestingNSFn // If set to true test will dump data about the namespace in which test was running. DumpLogsOnFailure bool + // Disables dumping cluster log from master and nodes after all tests. + DisableLogDump bool // If the garbage collector is enabled in the kube-apiserver and kube-controller-manager. GarbageCollectorEnabled bool // FeatureGates is a set of key=value pairs that describe feature gates for alpha/experimental features. @@ -148,6 +150,7 @@ func RegisterCommonFlags() { flag.BoolVar(&TestContext.GatherMetricsAfterTest, "gather-metrics-at-teardown", false, "If set to true framwork will gather metrics from all components after each test.") flag.StringVar(&TestContext.OutputPrintType, "output-print-type", "hr", "Comma separated list: 'hr' for human readable summaries 'json' for JSON ones.") flag.BoolVar(&TestContext.DumpLogsOnFailure, "dump-logs-on-failure", true, "If set to true test will dump data about the namespace in which test was running.") + flag.BoolVar(&TestContext.DisableLogDump, "disable-log-dump", false, "If set to true, logs from master and nodes won't be gathered after test run.") flag.BoolVar(&TestContext.DeleteNamespace, "delete-namespace", true, "If true tests will delete namespace after completion. It is only designed to make debugging easier, DO NOT turn it off by default.") flag.BoolVar(&TestContext.DeleteNamespaceOnFailure, "delete-namespace-on-failure", true, "If true, framework will delete test namespace on failure. Used only during test debugging.") flag.IntVar(&TestContext.AllowedNotReadyNodes, "allowed-not-ready-nodes", 0, "If non-zero, framework will allow for that many non-ready nodes when checking for all ready nodes.") diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index dec506c6b7..1f8db3fe3c 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -4857,6 +4857,10 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, timeo // CoreDump SSHs to the master and all nodes and dumps their logs into dir. // It shells out to cluster/log-dump.sh to accomplish this. func CoreDump(dir string) { + if TestContext.DisableLogDump { + Logf("Skipping dumping logs from cluster") + return + } cmd := exec.Command(path.Join(TestContext.RepoRoot, "cluster", "log-dump.sh"), dir) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr