]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Predictable iptables chains output order
authorHenry Gessau <gessau@cisco.com>
Sun, 27 Jul 2014 02:05:02 +0000 (22:05 -0400)
committerHenry Gessau <gessau@cisco.com>
Tue, 26 Aug 2014 20:38:59 +0000 (16:38 -0400)
commit9e3111250bceece8e36cd9fe60b80393515aa423
treea24442ed29a78346c30e7a2563e9e675f664bb8e
parent2f7932055247df3ac5ec4783e029cfeda0466f71
Predictable iptables chains output order

This fixes the iptables unit tests that break with a randomized PYTHONHASHSEED
(see the bug report).

The chains for iptables are stored as sets to avoid duplicates. When they are
output by iptables_manager their order can therefore be unpredictable. This was
found hash seed 1016732220.

To fix this we:
 - Sort the chains output by iptables_manager
 - Update the unit tests to check for sorted chains

When multiple tables are processed, they can be processed in any order or
dumped in any order. Found with hash seed 3728666619.

To fix this we:
 - Traverse the tables in sorted order for dumping
 - Fix tests to allow for tables to be processed in any order

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.

Partial-bug: #1348818

Change-Id: Ic3f4cd85316c9fc2e78bc7f5e900cfac87baf39d
neutron/agent/linux/iptables_manager.py
neutron/tests/tools.py
neutron/tests/unit/test_iptables_manager.py