def test_stop_testset(self): """Verify that long running testrun can be stopped """ testset = "stopped_test" cluster_id = 1 #make sure we have all needed data in db #for this test case self.adapter.testsets(cluster_id) self.client.start_testrun(testset, cluster_id) time.sleep(20) r = self.client.testruns_last(cluster_id) assertions = Response([ { 'testset': 'stopped_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1 } ]) self.compare(r, assertions) self.client.stop_testrun_last(testset, cluster_id) r = self.client.testruns_last(cluster_id) assertions.stopped_test['status'] = 'finished' #for test in assertions.stopped_test['tests']: # if test['name'] == 'This is long running tests': # test['status'] = 'stopped' self.compare(r, assertions)
def test_run_testset(self): """Verify that test status changes in time from running to success """ testset = "general_test" cluster_id = 1 self.client.start_testrun(testset, cluster_id) time.sleep(3) r = self.client.testruns_last(cluster_id) assertions = Response([{'status': 'running', 'testset': 'general_test', 'tests': [ {'id': 'fast_pass', 'status': 'success', 'name': 'fast pass test', 'description': """ This is a simple always pass test """,}, {'id': 'long_pass', 'status': 'running'}, {'id': 'fail_step', 'message': 'Fake fail message', 'status': 'failure'}, {'id': 'fast_error', 'message': '', 'status': 'error'}, {'id': 'fast_fail', 'message': 'Something goes wroooong', 'status': 'failure'}]}]) print r print assertions self.compare(r, assertions) time.sleep(10) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.long_pass['status'] = 'success' self.compare(r, assertions)
def test_single_test_restart(self): """Verify that you restart individual tests for given testrun""" testset = "general_test" tests = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail'] cluster_id = 60 self.client.run_testset_with_timeout(testset, cluster_id, 10) r = self.client.restart_tests_last(testset, tests, cluster_id) assertions = Response([ {'status': 'running', 'testset': 'general_test', 'tests': [ {'id': 'fast_pass', 'status': 'wait_running'}, {'id': 'long_pass', 'status': 'success'}, {'id': 'fast_error', 'status': 'error'}, {'id': 'fast_fail', 'status': 'wait_running'}]}]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.fast_pass['status'] = 'success' assertions.fast_fail['status'] = 'failure' self.compare(r, assertions)
def test_restart_combinations(self): """Verify that you can restart both tests that ran and did not run during single test start""" testset = "general_test" tests = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail'] disabled_test = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_error', ] cluster_id = 70 self.client.run_with_timeout(testset, tests, cluster_id, 70) self.client.restart_with_timeout(testset, tests, cluster_id, 10) r = self.client.restart_tests_last(testset, disabled_test, cluster_id) assertions = Response([ {'status': 'running', 'testset': 'general_test', 'tests': [ {'status': 'wait_running', 'id': 'fast_error'}, {'status': 'failure', 'id': 'fast_fail'}, {'status': 'success', 'id': 'fast_pass'}, {'status': 'disabled', 'id': 'long_pass'}]}]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.fast_error['status'] = 'error' self.compare(r, assertions)
def test_stop_testset(self): """Verify that long running testrun can be stopped """ testset = "stopped_test" cluster_id = 2 self.client.start_testrun(testset, cluster_id) time.sleep(10) r = self.client.testruns_last(cluster_id) assertions = Response([ {'status': 'running', 'testset': 'stopped_test', 'tests': [ {'id': 'not_long', 'status': 'success'}, {'id': 'so_long', 'status': 'success'}, {'id': 'really_long', 'status': 'running'}]}]) self.compare(r, assertions) self.client.stop_testrun_last(testset, cluster_id) r = self.client.testruns_last(cluster_id) assertions.stopped_test['status'] = 'finished' assertions.really_long['status'] = 'stopped' self.compare(r, assertions)
def test_run_single_test(self): """Verify that you can run individual tests from given testset""" testset = "general_test" tests = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail'] cluster_id = 50 r = self.client.start_testrun_tests(testset, tests, cluster_id) assertions = Response([ {'status': 'running', 'testset': 'general_test', 'tests': [ {'status': 'disabled', 'id': 'fast_error'}, {'status': 'wait_running', 'id': 'fast_fail'}, {'status': 'wait_running', 'id': 'fast_pass'}, {'status': 'disabled', 'id': 'long_pass'}]}]) self.compare(r, assertions) time.sleep(2) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.fast_fail['status'] = 'failure' assertions.fast_pass['status'] = 'success' self.compare(r, assertions)
def test_stop_testset(self): """Verify that long running testrun can be stopped """ testset = "stopped_test" cluster_id = 1 #make sure we have all needed data in db #for this test case self.adapter.testsets(cluster_id) self.client.start_testrun(testset, cluster_id) time.sleep(20) r = self.client.testruns_last(cluster_id) assertions = Response([{ 'testset': 'stopped_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1 }]) self.compare(r, assertions) self.client.stop_testrun_last(testset, cluster_id) r = self.client.testruns_last(cluster_id) assertions.stopped_test['status'] = 'finished' self.compare(r, assertions)
def test_run_testset(self): """Verify that test status changes in time from running to success """ testsets = ["general_test", "stopped_test"] cluster_id = 1 #make sure we have data about test_sets in db self.adapter.testsets(cluster_id) for testset in testsets: self.client.start_testrun(testset, cluster_id) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions = Response( [ { 'testset': 'general_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, }, { 'testset': 'stopped_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, } ] ) self.compare(r, assertions) time.sleep(30) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.stopped_test['status'] = 'finished' #for test in assertions.general_test['tests']: # if test['name'] == 'Will sleep 5 sec': # test['status'] = 'success' #for test in assertions.stopped_test['tests']: # if test['name'] == 'This is long running tests': # test['status'] = 'success' # test['message'] = '' # if test['name'] == 'What i am doing here? You ask me????': # test['status'] = 'success' self.compare(r, assertions)
def test_nose_adapter_error_while_running_tests(self): testset = 'test_with_error' cluster_id = 4 #make sure we have all needed data in db self.adapter.testsets(cluster_id) self.client.start_testrun(testset, cluster_id) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions = Response([{ 'testset': 'test_with_error', 'status': 'finished', 'cluster_id': 4, 'tests': [{ 'id': ('fuel_plugin.tests.functional.' 'dummy_tests.test_with_error.WithErrorTest.' 'test_supposed_to_be_fail'), 'status': 'error' }, { 'id': ('fuel_plugin.tests.functional.' 'dummy_tests.test_with_error.WithErrorTest.' 'test_supposed_to_be_success'), 'status': 'error' }] }]) self.compare(r, assertions)
def test_run_testset(self): """Verify that test status changes in time from running to success """ testsets = ["general_test", "stopped_test"] cluster_id = 1 #make sure we have data about test_sets in db self.adapter.testsets(cluster_id) for testset in testsets: self.client.start_testrun(testset, cluster_id) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions = Response( [ { 'testset': 'general_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, }, { 'testset': 'stopped_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, } ] ) self.compare(r, assertions) time.sleep(30) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.stopped_test['status'] = 'finished' self.compare(r, assertions)
def test_run_testset(self): """Verify that test status changes in time from running to success """ testsets = ["general_test", "stopped_test"] cluster_id = 1 #make sure we have data about test_sets in db self.adapter.testsets(cluster_id) for testset in testsets: self.client.start_testrun(testset, cluster_id) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions = Response([{ 'testset': 'general_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, }, { 'testset': 'stopped_test', 'status': 'running', 'tests': [], 'meta': None, 'cluster_id': 1, }]) self.compare(r, assertions) time.sleep(30) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' assertions.stopped_test['status'] = 'finished' self.compare(r, assertions)
def test_restart_combinations(self): """Verify that you can restart both tests that ran and did not run during single test start""" testset = "general_test" tests = [ 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail' ] disabled_test = ['fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_error', ] cluster_id = 1 #make sure we have all needed data in db self.adapter.testsets(cluster_id) self.client.run_with_timeout(testset, tests, cluster_id, 70) self.client.restart_with_timeout(testset, tests, cluster_id, 10) r = self.client.restart_tests_last(testset, disabled_test, cluster_id) assertions = Response([ { 'testset': 'general_test', 'status': 'running', 'tests': [ { 'status': 'disabled', 'name': 'Fast fail with step', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fail_with_step', }, { 'status': 'wait_running', 'name': 'And fast error', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_error', }, { 'status': 'failure', 'name': 'Fast fail', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail', }, { 'status': 'success', 'name': 'fast pass test', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', }, { 'status': 'disabled', 'name': 'Will sleep 5 sec', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_long_pass', } ], 'cluster_id': '1', } ]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' for test in assertions.general_test['tests']: if test['name'] == 'And fast error': test['status'] = 'error' self.compare(r, assertions)
def test_single_test_restart(self): """Verify that you restart individual tests for given testrun""" testset = "general_test" tests = [ 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail' ] cluster_id = 1 #make sure we have all needed data in db self.adapter.testsets(cluster_id) self.client.run_testset_with_timeout(testset, cluster_id, 10) r = self.client.restart_tests_last(testset, tests, cluster_id) assertions = Response([ { 'testset': 'general_test', 'status': 'running', 'tests': [ { 'status': 'failure', 'name': 'Fast fail with step', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fail_with_step', }, { 'status': 'error', 'name': 'And fast error', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_error', }, { 'status': 'wait_running', 'name': 'Fast fail', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_fail', }, { 'status': 'wait_running', 'name': 'fast pass test', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_fast_pass', }, { 'status': 'success', 'name': 'Will sleep 5 sec', 'id': 'fuel_plugin.tests.functional.dummy_tests.general_test.Dummy_test.test_long_pass', } ], 'cluster_id': '1', } ]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' for test in assertions.general_test['tests']: if test['name'] == 'Fast fail': test['status'] = 'failure' elif test['name'] == 'fast pass test': test['status'] = 'success' self.compare(r, assertions)
def test_restart_combinations(self): """Verify that you can restart both tests that ran and did not run during single test start""" testset = "general_test" tests = [('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_pass'), ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_fail')] disabled_test = [('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_error')] cluster_id = 1 #make sure we have all needed data in db self.adapter.testsets(cluster_id) self.client.run_with_timeout(testset, tests, cluster_id, 70) self.client.restart_with_timeout(testset, tests, cluster_id, 10) r = self.client.restart_tests_last(testset, disabled_test, cluster_id) assertions = Response([{ 'testset': 'general_test', 'status': 'running', 'tests': [{ 'status': 'disabled', 'name': 'Fast fail with step', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fail_with_step'), }, { 'status': 'wait_running', 'name': 'And fast error', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_error'), }, { 'status': 'failure', 'name': 'Fast fail', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_fail'), }, { 'status': 'success', 'name': 'fast pass test', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_pass'), }, { 'status': 'disabled', 'name': 'Will sleep 5 sec', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_long_pass'), }], 'cluster_id': '1', }]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' for test in assertions.general_test['tests']: if test['name'] == 'And fast error': test['status'] = 'error' self.compare(r, assertions)
def test_single_test_restart(self): """Verify that you restart individual tests for given testrun""" testset = "general_test" tests = [('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_pass'), ('fuel_plugin.tests.functional.dummy_tests.general_test.' 'Dummy_test.test_fast_fail')] cluster_id = 1 #make sure we have all needed data in db self.adapter.testsets(cluster_id) self.client.run_testset_with_timeout(testset, cluster_id, 10) r = self.client.restart_tests_last(testset, tests, cluster_id) assertions = Response([{ 'testset': 'general_test', 'status': 'running', 'tests': [{ 'status': 'failure', 'name': 'Fast fail with step', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fail_with_step'), }, { 'status': 'error', 'name': 'And fast error', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_error'), }, { 'status': 'wait_running', 'name': 'Fast fail', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_fail'), }, { 'status': 'wait_running', 'name': 'fast pass test', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_fast_pass'), }, { 'status': 'success', 'name': 'Will sleep 5 sec', 'id': ('fuel_plugin.tests.functional.dummy_tests.' 'general_test.Dummy_test.test_long_pass'), }], 'cluster_id': '1', }]) self.compare(r, assertions) time.sleep(5) r = self.client.testruns_last(cluster_id) assertions.general_test['status'] = 'finished' for test in assertions.general_test['tests']: if test['name'] == 'Fast fail': test['status'] = 'failure' elif test['name'] == 'fast pass test': test['status'] = 'success' self.compare(r, assertions)