From b4363a48214f1bb21bd7934f05a6440bb5d66bb7 Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Thu, 28 May 2015 09:07:23 +0200 Subject: [PATCH] Fix PYTHONHASHSEED bugs in test_security_groups_rpc This fixes the test_security_group_member/rule_updated unit tests[1] that breaks with a randomized PYTHONHASHSEED (see the bug report). The test assumed that several dictionaries had elements in a particular order. Found with PYTHONHASHSEED=2. The fix refactors the test case by injecting values using the same ordering[2]. [1] neutron.tests.unit.agent.test_securitygroups_rpc.\ TestSecurityGroupAgentWithOVSIptables [2] https://github.com/openstack/neutron/blob/\ e8364a72e62d83e5a76bec1d7aa76ecfe2ed53ac/\ neutron/tests/unit/agent/test_securitygroups_rpc.py#L1630-L1635 Partial-bug: #1348818 Note: There are several other unrelated unit tests that also break with a randomized PYTHONHASHSEED, but they are not addressed here. They will be addressed in separate patches. Change-Id: I5077764045a34d1be0e85bb4b80f3655e87692cc --- neutron/tests/unit/agent/test_securitygroups_rpc.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/neutron/tests/unit/agent/test_securitygroups_rpc.py b/neutron/tests/unit/agent/test_securitygroups_rpc.py index 5fd97ba14..726ed3eab 100644 --- a/neutron/tests/unit/agent/test_securitygroups_rpc.py +++ b/neutron/tests/unit/agent/test_securitygroups_rpc.py @@ -1670,10 +1670,12 @@ IPTABLES_RAW_DEVICE_2 = """# Generated by iptables_manager :%(bn)s-PREROUTING - [0:0] [0:0] -A PREROUTING -j %(bn)s-PREROUTING [0:0] -A OUTPUT -j %(bn)s-OUTPUT -[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in qvbtap_port1 -j CT --zone 1 -[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in tap_port1 -j CT --zone 1 -[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in qvbtap_port2 -j CT --zone 1 -[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in tap_port2 -j CT --zone 1 +[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in qvbtap_%(port1)s \ +-j CT --zone 1 +[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in tap_%(port1)s -j CT --zone 1 +[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in qvbtap_%(port2)s \ +-j CT --zone 1 +[0:0] -A %(bn)s-PREROUTING -m physdev --physdev-in tap_%(port2)s -j CT --zone 1 COMMIT # Completed by iptables_manager """ % IPTABLES_ARG -- 2.45.2