From 9c3d54de90caa316bc3eefc9430604e8aa4fa985 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 20:43:04 +0100 Subject: [PATCH 1/7] Check flaky test. --- iptc/test/test_targets.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index a28f655..c0a04b5 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -397,9 +397,12 @@ def tearDown(self): def test_ct(self): self.chain.insert_rule(self.rule) - t = self.chain.rules[0].target - self.assertEquals(t.name, "CT") - self.assertTrue(t.notrack is not None) + try: + t = self.chain.rules[0].target + self.assertEquals(t.name, "CT") + self.assertTrue(t.notrack is not None) + except: + os.system("iptables -t raw -L -n") def suite(): From 5b3501dadd81dc09a5afbba43caa98da4d7e7cef Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 20:54:25 +0100 Subject: [PATCH 2/7] Check flaky test. --- iptc/test/test_targets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index c0a04b5..a0e58c0 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -402,6 +402,7 @@ def test_ct(self): self.assertEquals(t.name, "CT") self.assertTrue(t.notrack is not None) except: + import os os.system("iptables -t raw -L -n") From cf365bd4e23488ca20326f6d688b2253bc7fbbaa Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 21:00:13 +0100 Subject: [PATCH 3/7] Check flaky test. --- iptc/test/test_targets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index a0e58c0..d78b51b 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -404,6 +404,7 @@ def test_ct(self): except: import os os.system("iptables -t raw -L -n") + raise def suite(): From b687bb2b98600619d4addff97cffbff01e9d9148 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 21:05:01 +0100 Subject: [PATCH 4/7] Check flaky test. --- iptc/test/test_targets.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index d78b51b..3409ee7 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -402,6 +402,12 @@ def test_ct(self): self.assertEquals(t.name, "CT") self.assertTrue(t.notrack is not None) except: + import sys + print >> sys.stderr + print >> sys.stderr, self.rule + print >> sys.stderr, self.rule.target + print >> sys.stderr, self.rule.target.notrack + print >> sys.stderr import os os.system("iptables -t raw -L -n") raise From 3b356c41817aa4ca37369d488ba0bccd70f29c2a Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 21:18:23 +0100 Subject: [PATCH 5/7] Add __repr__ to IPTCModule. --- iptc/ip4tc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iptc/ip4tc.py b/iptc/ip4tc.py index 45d047c..4449a61 100644 --- a/iptc/ip4tc.py +++ b/iptc/ip4tc.py @@ -262,6 +262,10 @@ def __init__(self): self._ptrptr = None raise NotImplementedError() + def __repr__(self): + return '\n'.join( + [str(kv)for kv in self.get_all_parameters().iteritems()]) + def parse(self, parameter, value): # Parameter name must always be a string. parameter = parameter.encode() From e2ac2fe33e53ca35cb89b813d637e982504dd8f1 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 21:26:05 +0100 Subject: [PATCH 6/7] Check flaky test. --- iptc/test/test_targets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index 3409ee7..0f95e76 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -379,7 +379,7 @@ def setUp(self): self.rule.out_interface = "eth0" self.target = iptc.Target(self.rule, "CT") - self.target.notrack = "true" + self.target.helper = "ftp" self.rule.target = self.target self.chain = iptc.Chain(iptc.Table(iptc.Table.RAW), From 316b7ed87c7524b795676c4d321036bc2b9af814 Mon Sep 17 00:00:00 2001 From: Vilmos Nebehaj Date: Sat, 28 Feb 2015 21:31:59 +0100 Subject: [PATCH 7/7] Check flaky test. --- iptc/test/test_targets.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py index 0f95e76..2cee665 100755 --- a/iptc/test/test_targets.py +++ b/iptc/test/test_targets.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import print_function import unittest import iptc @@ -402,12 +403,11 @@ def test_ct(self): self.assertEquals(t.name, "CT") self.assertTrue(t.notrack is not None) except: - import sys - print >> sys.stderr - print >> sys.stderr, self.rule - print >> sys.stderr, self.rule.target - print >> sys.stderr, self.rule.target.notrack - print >> sys.stderr + print() + print(self.rule) + print(self.rule.target) + print(self.rule.target.notrack) + print() import os os.system("iptables -t raw -L -n") raise