summaryrefslogtreecommitdiff
path: root/ick2/buildgraph_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ick2/buildgraph_tests.py')
-rw-r--r--ick2/buildgraph_tests.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/ick2/buildgraph_tests.py b/ick2/buildgraph_tests.py
index a81d2c6..e661294 100644
--- a/ick2/buildgraph_tests.py
+++ b/ick2/buildgraph_tests.py
@@ -166,6 +166,21 @@ class BuildGraphTests(unittest.TestCase):
self.assertEqual(graph.find_actions('ready'), ['1'])
self.assertEqual(graph.find_actions('blocked'), ['2'])
+ def test_tracks_nothing_to_do(self):
+ pipeline_as_dict = {
+ 'actions': [
+ {
+ 'action': 'foo',
+ },
+ {
+ 'action': 'bar',
+ },
+ ],
+ }
+ pipeline = ick2.resource_from_dict(pipeline_as_dict)
+ graph = ick2.BuildGraph()
+ graph.append_pipeline(pipeline)
+
def test_doesnt_unblock_when_deps_are_not_done(self):
pipeline_as_dict = {
'actions': [
@@ -178,12 +193,24 @@ class BuildGraphTests(unittest.TestCase):
],
}
pipeline = ick2.resource_from_dict(pipeline_as_dict)
+
graph = ick2.BuildGraph()
+ self.assertFalse(graph.has_more_to_do())
+
graph.append_pipeline(pipeline)
+ graph.set_action_status('1', 'building')
+ self.assertEqual(graph.get_action_status('2'), 'blocked')
+ self.assertTrue(graph.has_more_to_do())
- graph.unblock()
- self.assertEqual(graph.get_action_status('1'), 'ready')
+ graph.set_action_status('1', 'done')
self.assertEqual(graph.get_action_status('2'), 'blocked')
+ self.assertTrue(graph.has_more_to_do())
+
+ graph.set_action_status('2', 'ready')
+ self.assertTrue(graph.has_more_to_do())
+
+ graph.set_action_status('2', 'done')
+ self.assertFalse(graph.has_more_to_do())
def test_unblocks_when_deps_are_done(self):
pipeline_as_dict = {