diff options
author | bdemers <bdemers@apache.org> | 2015-08-07 23:54:35 -0400 |
---|---|---|
committer | bdemers <bdemers@apache.org> | 2015-10-19 10:32:20 -0400 |
commit | 455cabdee3158e7b2181c96e6d3b791f812c7fee (patch) | |
tree | 469a8886c5a44c4e0f20111017d57daf163f3164 /os_net_config/tests | |
parent | a7d9cc1129370f543ab05935bcff17896d09be70 (diff) |
Added natural sort for interfaces in utils.ordered_active_nics()
This way device eth10 is after eth9, and not directly after eth1
Change-Id: I81eba97cccf6c4f314f9037d16ee1f244dbade02
Closes-Bug: #1482818
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/os_net_config/tests/test_utils.py b/os_net_config/tests/test_utils.py index e7326d3..b6531a6 100644 --- a/os_net_config/tests/test_utils.py +++ b/os_net_config/tests/test_utils.py @@ -33,7 +33,8 @@ class TestUtils(base.TestCase): return True self.stubs.Set(utils, '_is_active_nic', test_is_active_nic) - for nic in ['a1', 'em1', 'em2', 'eth2', 'z1']: + for nic in ['a1', 'em1', 'em2', 'eth2', 'z1', + 'enp8s0', 'enp10s0', 'enp1s0f0']: with open(os.path.join(tmpdir, nic), 'w') as f: f.write(nic) @@ -42,6 +43,9 @@ class TestUtils(base.TestCase): self.assertEqual('em2', nics[1]) self.assertEqual('eth2', nics[2]) self.assertEqual('a1', nics[3]) - self.assertEqual('z1', nics[4]) + self.assertEqual('enp1s0f0', nics[4]) + self.assertEqual('enp8s0', nics[5]) + self.assertEqual('enp10s0', nics[6]) + self.assertEqual('z1', nics[7]) shutil.rmtree(tmpdir) |