From 51f433d9a6a75d02969da2977dd9b288b701c6b5 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 8 Jun 2016 13:36:46 +0200 Subject: [PATCH] Reduce huge amount of logs in large cluster tests --- test/e2e/framework/util.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index ee5cd046287..e5ce94ed017 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -2604,7 +2604,7 @@ func waitListSchedulableNodesOrDie(c *client.Client) *api.NodeList { func isNodeSchedulable(node *api.Node) bool { nodeReady := IsNodeConditionSetAsExpected(node, api.NodeReady, true) networkReady := IsNodeConditionUnset(node, api.NodeNetworkUnavailable) || - IsNodeConditionSetAsExpected(node, api.NodeNetworkUnavailable, false) + IsNodeConditionSetAsExpectedSilent(node, api.NodeNetworkUnavailable, false) return !node.Spec.Unschedulable && nodeReady && networkReady } @@ -3412,7 +3412,7 @@ func WaitForNodeToBeNotReady(c *client.Client, name string, timeout time.Duratio return WaitForNodeToBe(c, name, api.NodeReady, false, timeout) } -func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool { +func isNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue, silent bool) bool { // Check the node readiness condition (logging all). for _, cond := range node.Status.Conditions { // Ensure that the condition type and the status matches as desired. @@ -3420,16 +3420,28 @@ func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditio if (cond.Status == api.ConditionTrue) == wantTrue { return true } else { - Logf("Condition %s of node %s is %v instead of %t. Reason: %v, message: %v", - conditionType, node.Name, cond.Status == api.ConditionTrue, wantTrue, cond.Reason, cond.Message) + if !silent { + Logf("Condition %s of node %s is %v instead of %t. Reason: %v, message: %v", + conditionType, node.Name, cond.Status == api.ConditionTrue, wantTrue, cond.Reason, cond.Message) + } return false } } } - Logf("Couldn't find condition %v on node %v", conditionType, node.Name) + if !silent { + Logf("Couldn't find condition %v on node %v", conditionType, node.Name) + } return false } +func IsNodeConditionSetAsExpected(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool { + return isNodeConditionSetAsExpected(node, conditionType, wantTrue, false) +} + +func IsNodeConditionSetAsExpectedSilent(node *api.Node, conditionType api.NodeConditionType, wantTrue bool) bool { + return isNodeConditionSetAsExpected(node, conditionType, wantTrue, true) +} + func IsNodeConditionUnset(node *api.Node, conditionType api.NodeConditionType) bool { for _, cond := range node.Status.Conditions { if cond.Type == conditionType {