Beispiel #1
0
 def test_run_model_taskrunner_error(self):
     mock_taskrunner = MockTaskRunnerError()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     publisher = PublisherStub(*[None]*4)
     hub._publishers._publishers.append(publisher)
     hub.run()
     self.assertTrue(isinstance(publisher.exception, OTSException))
Beispiel #2
0
 def test_run_results_missing(self):
     mock_taskrunner = MockTaskRunnerResultsMissing()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     publisher = PublisherStub(*[None]*4)
     hub._publishers._publishers.append(publisher)
     hub.run()
     self.assertTrue(isinstance(publisher.exception, PackageException))
Beispiel #3
0
 def test_no_image(self):
     mock_taskrunner = MockTaskRunnerResultsPass()
     hub = Hub("example_sw_product", 111)
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id = hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "Missing `image` parameter"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #4
0
 def test_non_existent_sw_product(self):
     mock_taskrunner = MockTaskRunnerResultsPass()
     hub = Hub("None", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id = hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "not found in sw products"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #5
0
 def test_fail_run(self):
     mock_taskrunner = MockTaskRunnerResultsFail()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id = hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "Testrun finished with result: FAIL"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #6
0
 def test_no_image(self):
     mock_taskrunner = MockTaskRunnerResultsPass()
     hub = Hub("example_sw_product", 111)
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id =  hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "Missing `image` parameter"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #7
0
 def test_non_existent_sw_product(self):
     mock_taskrunner = MockTaskRunnerResultsPass()
     hub = Hub("None", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id =  hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "not found in sw products"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #8
0
 def test_fail_run(self):
     mock_taskrunner = MockTaskRunnerResultsFail()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id =  hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     string = "Testrun finished with result: FAIL"
     self.assert_log_contains_string(content, testrun_id, string)
Beispiel #9
0
 def test_run_global_timeout(self):
     #Not really a test more an illustration of behaviour
     mock_taskrunner = MockTaskRunnerTimeout()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     publisher = PublisherStub(*[None]*4)
     hub._publishers._publishers.append(publisher)
     hub.run()
     self.assertTrue(isinstance(publisher.exception, 
                                OtsExecutionTimeoutError))
Beispiel #10
0
def demo():
    """
    A rough and ready demo
    """
    taskrunner = taskrunner_factory("foo", 2, 1)
    taskrunner.add_task(["sleep", "1"])
    taskrunner.add_task(["echo", "hello world"])

    hub = Hub("example_sw_product", 1111,  **options_dict)
    hub._taskrunner = taskrunner
    hub.run()
Beispiel #11
0
def demo():
    """
    A rough and ready demo
    """
    taskrunner = taskrunner_factory("foo", 2, 1)
    taskrunner.add_task(["sleep", "1"])
    taskrunner.add_task(["echo", "hello world"])

    hub = Hub("example_sw_product", 1111, **options_dict)
    hub._taskrunner = taskrunner
    hub.run()
Beispiel #12
0
 def test_timeout(self):
     mock_taskrunner = MockTaskRunnerTimeout()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id = hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     self.assertTrue(has_errors(content, testrun_id))
     string = "Result set to ERROR"
     self.assertTrue(has_message(content, testrun_id, string))
Beispiel #13
0
 def test_timeout(self):
     mock_taskrunner = MockTaskRunnerTimeout()
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner
     ret_val = hub.run()
     testrun_id =  hub.testrun_uuid
     self.assert_has_latest(testrun_id)
     content = self.get_log_content(testrun_id)
     self.assertTrue(has_errors(content, testrun_id))
     string = "Result set to ERROR"
     self.assertTrue(has_message(content, testrun_id, string))
Beispiel #14
0
def run(parent, text):
    """
    Run a Stubbed Testrunner on the Hub

    @type parent : C{QWidget}
    @param parent : The Parent Widget

    @type text : C{str}
    @param text : Demonstrate extension of API
    """
    mock_taskrunner = MockTaskRunnerResultsPass()
    options_dict["parent"] = parent
    options_dict["text"] = text
    hub = Hub("example_sw_product", 111, **options_dict)
    #The taskrunner is replaced by the Mock here!
    hub._taskrunner = mock_taskrunner
    print "Result", hub.run()
Beispiel #15
0
def run(parent, text):
    """
    Run a Stubbed Testrunner on the Hub

    @type parent : C{QWidget}
    @param parent : The Parent Widget

    @type text : C{str}
    @param text : Demonstrate extension of API
    """
    mock_taskrunner = MockTaskRunnerResultsPass()
    options_dict["parent"] = parent
    options_dict["text"] = text
    hub = Hub("example_sw_product", 111, **options_dict)
    #The taskrunner is replaced by the Mock here!
    hub._taskrunner = mock_taskrunner
    print "Result", hub.run()
Beispiel #16
0
 def test_run_results_fail(self):
     mock_taskrunner = MockTaskRunnerResultsFail() 
     hub = Hub("example_sw_product", 111, image="image")
     hub._taskrunner = mock_taskrunner 
     ret_val = hub.run()
     self.assertFalse(ret_val.wasSuccessful())