示例#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))
示例#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))
示例#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)
示例#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)
示例#5
0
def demo(image):
    """
    A Demo that run the full tool chain downstream of the hub

    @type: C{str}
    @param: The image url
    """
    options_dict["image"] = image
    hub = Hub("example_sw_product", 1111,  **options_dict)
    hub.run()
示例#6
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)
示例#7
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)
示例#8
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)
示例#9
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)
示例#10
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))
示例#11
0
def demo(image):
    """
    A Demo that run the full tool chain downstream of the hub

    @type: C{str}
    @param: The image url
    """
    options_dict["image"] = image
    hub = Hub("example_sw_product", 1111, **options_dict)
    hub.run()
示例#12
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()
示例#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))
示例#14
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()
示例#15
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))
示例#16
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()
示例#17
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()
示例#18
0
def _run_hub(queue, sw_product, request_id, options_dict):
    """
    Function to run a hub and save the testrun result to queue.
    
    @param queue: Process queue
    @type queue: C{multiprocess.Queue}

    @param sw_product: Software product
    @type sw_product: C{str}

    @param request_id: request ID
    @type request_id: C{str}

    @param options_dict: Options dictionary for Hub
    @type options_dict: C{dict}
    
    """
    
    hub = Hub(sw_product, request_id, **options_dict)
    result = hub.run()
    
    queue.put({hub.testrun_uuid : result})
示例#19
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())