def test_from_state_with_node_exists(self, mock_store): ActionRun.from_state( self.state_data, self.parent_context, self.output_path, self.run_node, lambda: None, ) mock_store.get_instance().get_node.assert_called_with( self.state_data['node_name'], self.run_node, )
def test_from_state_before_rendered_command(self): self.state_data['command'] = 'do things %(actionname)s' self.state_data['rendered_command'] = None action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.bare_command, self.state_data['command']) assert not action_run.rendered_command
def test_from_state_after_rendered_command(self): self.state_data['command'] = 'do things theaction' self.state_data['rendered_command'] = self.state_data['command'] action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.bare_command, self.state_data['command']) assert_equal(action_run.rendered_command, self.state_data['command'])
def test_from_state_after_rendered_command(self): self.state_data['command'] = 'do things theaction' self.state_data['rendered_command'] = self.state_data['command'] action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.bare_command, self.state_data['command']) assert_equal(action_run.rendered_command, self.state_data['command'])
def test_from_state_before_rendered_command(self): self.state_data['command'] = 'do things %(actionname)s' self.state_data['rendered_command'] = None action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.bare_command, self.state_data['command']) assert not action_run.rendered_command
def test_from_state_running(self): self.state_data['state'] = 'running' action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert action_run.is_unknown assert_equal(action_run.exit_status, 0) assert_equal(action_run.end_time, self.now)
def test_from_state_running(self): self.state_data['state'] = 'running' action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert action_run.is_unknown assert_equal(action_run.exit_status, 0) assert_equal(action_run.end_time, self.now)
def test_from_state_no_node_name(self): del self.state_data['node_name'] action_run = ActionRun.from_state( self.state_data, self.parent_context, self.output_path, self.run_node, lambda: None, ) assert_equal(action_run.node, self.run_node)
def test_from_state_queued(self): self.state_data['state'] = 'queued' action_run = ActionRun.from_state( self.state_data, self.parent_context, self.output_path, self.run_node, lambda: None, ) assert action_run.is_queued
def test_from_state_with_node_exists(self): anode = turtle.Turtle(name="anode", hostname="box") node_store = node.NodePoolStore.get_instance() node_store.put(anode) action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.node, anode) node_store.clear()
def test_from_state_old_state(self): self.state_data['command'] = 'do things {actionname}' action_run = ActionRun.from_state( self.state_data, self.parent_context, self.output_path, self.run_node, lambda: None, ) assert_equal(action_run.bare_command, self.state_data['command']) assert not action_run.rendered_command
def test_from_state(self): state_data = self.state_data action_run = ActionRun.from_state(state_data, self.parent_context, list(self.output_path), self.run_node) for key, value in self.state_data.iteritems(): if key in ['state', 'node_name']: continue assert_equal(getattr(action_run, key), value) assert action_run.is_succeeded assert not action_run.is_cleanup assert_equal(action_run.output_path[:2], self.output_path)
def test_from_state(self): state_data = self.state_data action_run = ActionRun.from_state(state_data, self.parent_context, list(self.output_path), self.run_node) for key, value in self.state_data.iteritems(): if key in ['state', 'node_name']: continue assert_equal(getattr(action_run, key), value) assert action_run.is_succeeded assert not action_run.is_cleanup assert_equal(action_run.output_path[:2], self.output_path)
def test_from_state_with_node_exists(self, mock_store): ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) mock_store.get_instance().get_node.assert_called_with( self.state_data['node_name'], self.run_node)
def test_from_state_no_node_name(self): del self.state_data['node_name'] action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert_equal(action_run.node, self.run_node)
def test_from_state_queued(self): self.state_data['state'] = 'queued' action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert action_run.is_queued
def test_from_state_queued(self): self.state_data['state'] = 'queued' action_run = ActionRun.from_state(self.state_data, self.parent_context, self.output_path, self.run_node) assert action_run.is_failed assert_equal(action_run.end_time, self.now)