Commit 97a2cbc6 authored by Dan Winship's avatar Dan Winship

Fix some incorrect test debug output on error

parent cb2252b5
...@@ -184,10 +184,10 @@ func TestEnsureRuleAlreadyExists(t *testing.T) { ...@@ -184,10 +184,10 @@ func TestEnsureRuleAlreadyExists(t *testing.T) {
t.Errorf("expected exists = true") t.Errorf("expected exists = true")
} }
if fcmd.CombinedOutputCalls != 2 { if fcmd.CombinedOutputCalls != 2 {
t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 2 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
if !util.NewStringSet(fcmd.CombinedOutputLog[1]...).HasAll("iptables", "-t", "nat", "-C", "OUTPUT", "abc", "123") { if !util.NewStringSet(fcmd.CombinedOutputLog[1]...).HasAll("iptables", "-t", "nat", "-C", "OUTPUT", "abc", "123") {
t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[0]) t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[1])
} }
} }
...@@ -223,7 +223,7 @@ func TestEnsureRuleNew(t *testing.T) { ...@@ -223,7 +223,7 @@ func TestEnsureRuleNew(t *testing.T) {
t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
if !util.NewStringSet(fcmd.CombinedOutputLog[2]...).HasAll("iptables", "-t", "nat", "-A", "OUTPUT", "abc", "123") { if !util.NewStringSet(fcmd.CombinedOutputLog[2]...).HasAll("iptables", "-t", "nat", "-A", "OUTPUT", "abc", "123") {
t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[1]) t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[2])
} }
} }
...@@ -250,7 +250,7 @@ func TestEnsureRuleErrorChecking(t *testing.T) { ...@@ -250,7 +250,7 @@ func TestEnsureRuleErrorChecking(t *testing.T) {
t.Errorf("expected failure") t.Errorf("expected failure")
} }
if fcmd.CombinedOutputCalls != 2 { if fcmd.CombinedOutputCalls != 2 {
t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 2 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
} }
...@@ -307,10 +307,10 @@ func TestDeleteRuleAlreadyExists(t *testing.T) { ...@@ -307,10 +307,10 @@ func TestDeleteRuleAlreadyExists(t *testing.T) {
t.Errorf("expected success, got %v", err) t.Errorf("expected success, got %v", err)
} }
if fcmd.CombinedOutputCalls != 2 { if fcmd.CombinedOutputCalls != 2 {
t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 2 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
if !util.NewStringSet(fcmd.CombinedOutputLog[1]...).HasAll("iptables", "-t", "nat", "-C", "OUTPUT", "abc", "123") { if !util.NewStringSet(fcmd.CombinedOutputLog[1]...).HasAll("iptables", "-t", "nat", "-C", "OUTPUT", "abc", "123") {
t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[0]) t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[1])
} }
} }
...@@ -343,7 +343,7 @@ func TestDeleteRuleNew(t *testing.T) { ...@@ -343,7 +343,7 @@ func TestDeleteRuleNew(t *testing.T) {
t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
if !util.NewStringSet(fcmd.CombinedOutputLog[2]...).HasAll("iptables", "-t", "nat", "-D", "OUTPUT", "abc", "123") { if !util.NewStringSet(fcmd.CombinedOutputLog[2]...).HasAll("iptables", "-t", "nat", "-D", "OUTPUT", "abc", "123") {
t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[1]) t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[2])
} }
} }
...@@ -370,7 +370,7 @@ func TestDeleteRuleErrorChecking(t *testing.T) { ...@@ -370,7 +370,7 @@ func TestDeleteRuleErrorChecking(t *testing.T) {
t.Errorf("expected failure") t.Errorf("expected failure")
} }
if fcmd.CombinedOutputCalls != 2 { if fcmd.CombinedOutputCalls != 2 {
t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls) t.Errorf("expected 2 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment