From ada550098ac874cdd3ca7c6637421edf6c7f7163 Mon Sep 17 00:00:00 2001 From: Jinwoo 'Joseph' Suh Date: Mon, 20 Aug 2012 07:43:21 -0400 Subject: Debugged extra_specs_ops.py The current extra_specs_ops.py under nova/scheduler/filters has a bug: it crahses if is not followed by a word. For example, if " gpu " is given in extra_specs, current code tries to pop a word after the second that causes a crash. This patch lets it ignore the "" keyword if no word follows the second "" keyword. Debugged bug 1038979 Change-Id: I80a6eafd7ee57a2f3ccbf2fb869655ab84e92cf2 --- nova/tests/scheduler/test_host_filters.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/scheduler/test_host_filters.py b/nova/tests/scheduler/test_host_filters.py index d6f083576..9cda0ccde 100644 --- a/nova/tests/scheduler/test_host_filters.py +++ b/nova/tests/scheduler/test_host_filters.py @@ -670,24 +670,48 @@ class HostFiltersTestCase(test.TestCase): especs={'opt1': ' 12311321'}, passes=True) + def test_compute_filter_passes_extra_specs_with_op_in3(self): + self._do_test_compute_filter_extra_specs( + ecaps={'opt1': '12311321'}, + especs={'opt1': ' 12311321 '}, + passes=True) + def test_compute_filter_fails_extra_specs_with_op_in(self): self._do_test_compute_filter_extra_specs( ecaps={'opt1': '12310321'}, especs={'opt1': ' 11'}, passes=False) + def test_compute_filter_fails_extra_specs_with_op_in2(self): + self._do_test_compute_filter_extra_specs( + ecaps={'opt1': '12310321'}, + especs={'opt1': ' 11 '}, + passes=False) + def test_compute_filter_passes_extra_specs_with_op_or(self): self._do_test_compute_filter_extra_specs( ecaps={'opt1': '12'}, especs={'opt1': ' 11 12'}, passes=True) + def test_compute_filter_passes_extra_specs_with_op_or2(self): + self._do_test_compute_filter_extra_specs( + ecaps={'opt1': '12'}, + especs={'opt1': ' 11 12 '}, + passes=True) + def test_compute_filter_fails_extra_specs_with_op_or(self): self._do_test_compute_filter_extra_specs( ecaps={'opt1': '13'}, especs={'opt1': ' 11 12'}, passes=False) + def test_compute_filter_fails_extra_specs_with_op_or2(self): + self._do_test_compute_filter_extra_specs( + ecaps={'opt1': '13'}, + especs={'opt1': ' 11 12 '}, + passes=False) + def test_compute_filter_passes_extra_specs_with_op_le(self): self._do_test_compute_filter_extra_specs( ecaps={'opt1': 2, 'opt2': 2}, -- cgit