-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing issue where topological generations without scheduler was not …
…checking for locked resources correctly (#639)
- Loading branch information
1 parent
288cf1c
commit 2b542a1
Showing
4 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import unittest | ||
|
||
from servicecatalog_puppet.waluigi.constants import RESOURCES_REQUIRED | ||
|
||
|
||
class TestExternal(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.maxDiff = None | ||
from servicecatalog_puppet.waluigi.locks import external | ||
|
||
self.sut = external | ||
|
||
def test_are_resources_are_free_for_task_dict_with_no_locked_resources(self): | ||
# setup | ||
resources_in_use = dict() | ||
task_parameters = dict() | ||
task_parameters[RESOURCES_REQUIRED] = ["aaaa"] | ||
expected_result = True | ||
|
||
# exercise | ||
actual_result, _ = self.sut.are_resources_are_free_for_task_dict( | ||
task_parameters, resources_in_use | ||
) | ||
|
||
# verify | ||
self.assertEqual(expected_result, actual_result) | ||
|
||
def test_are_resources_are_free_for_task_dict_with_other_locked_resources(self): | ||
# setup | ||
resources_in_use = dict(bbbb="some-other-task") | ||
task_parameters = dict() | ||
task_parameters[RESOURCES_REQUIRED] = ["aaaa"] | ||
expected_result = True | ||
|
||
# exercise | ||
actual_result, _ = self.sut.are_resources_are_free_for_task_dict( | ||
task_parameters, resources_in_use | ||
) | ||
|
||
# verify | ||
self.assertEqual(expected_result, actual_result) | ||
|
||
def test_are_resources_are_free_for_task_dict_with_locked_resources(self): | ||
# setup | ||
resources_in_use = dict(aaaa="some-other-task") | ||
task_parameters = dict() | ||
task_parameters[RESOURCES_REQUIRED] = ["aaaa"] | ||
expected_result = False | ||
|
||
# exercise | ||
actual_result, _ = self.sut.are_resources_are_free_for_task_dict( | ||
task_parameters, resources_in_use | ||
) | ||
|
||
# verify | ||
self.assertEqual(expected_result, actual_result) | ||
|
||
def test_are_resources_are_free_for_task_dict_with_locked_resources_and_more(self): | ||
# setup | ||
resources_in_use = dict(aaaa="some-other-task", bbb="sdsnkdnsk") | ||
task_parameters = dict() | ||
task_parameters[RESOURCES_REQUIRED] = ["aaaa"] | ||
expected_result = False | ||
|
||
# exercise | ||
actual_result, _ = self.sut.are_resources_are_free_for_task_dict( | ||
task_parameters, resources_in_use | ||
) | ||
|
||
# verify | ||
self.assertEqual(expected_result, actual_result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters