예제 #1
0
    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)

        resp = self.client.testruns_last(cluster_id)

        assertions = base.Response([{
            'testset':
            'test_with_error',
            'status':
            'finished',
            'cluster_id':
            4,
            'tests': [{
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.test_with_error.WithErrorTest.'
                       'test_supposed_to_be_fail'),
                'status':
                'error'
            }, {
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.test_with_error.WithErrorTest.'
                       'test_supposed_to_be_success'),
                'status':
                'error'
            }]
        }])

        self.compare(resp, assertions)
예제 #2
0
    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)

        resp = self.client.testruns_last(cluster_id)

        assertions = base.Response([{
            'testset': 'stopped_test',
            'status': 'running',
            'tests': [],
            'meta': None,
            'cluster_id': 1
        }])

        self.compare(resp, assertions)

        self.client.stop_testrun_last(testset, cluster_id)
        time.sleep(5)
        resp = self.client.testruns_last(cluster_id)

        assertions.stopped_test['status'] = 'finished'
        self.compare(resp, assertions)
예제 #3
0
    def test_dependent_testsets(self):
        testsets = ['gemini_first', 'gemini_second']
        cluster_id = 5

        # make sure we have all needed data in db
        self.adapter.testsets(cluster_id)

        self.client.start_multiple_testruns(testsets, cluster_id)
        time.sleep(5)

        resp = self.client.testruns()

        assertions = base.Response([{
            'testset':
            'gemini_first',
            'status':
            'running',
            'tests': [{
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.dependent_testsets.'
                       'gemini_first_test.TestGeminiFirst.'
                       'test_fake_long_succes_gf'),
                'status':
                'running'
            }, {
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.dependent_testsets.'
                       'gemini_first_test.TestGeminiFirst.'
                       'test_fake_quick_success_gf'),
                'status':
                'wait_running'
            }]
        }, {
            'testset':
            'gemini_second',
            'status':
            'running',
            'tests': [{
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.dependent_testsets.'
                       'gemini_second_test.TestGeminiSecond.'
                       'test_fake_long_succes_gs'),
                'status':
                'wait_running'
            }, {
                'id': ('fuel_plugin.testing.fixture.'
                       'dummy_tests.dependent_testsets.'
                       'gemini_second_test.TestGeminiSecond.'
                       'test_fake_quick_success_gs'),
                'status':
                'wait_running'
            }]
        }])

        self.compare(resp, assertions)
예제 #4
0
    def test_env_variables_are_set(self):
        assertions = base.Response([
            {
                'testset':
                'environment_variables',
                'status':
                'finished',
                'tests': [
                    {
                        'id': ('fuel_plugin.testing.fixture.'
                               'dummy_tests.test_environment_variables.'
                               'TestEnvVariables.'
                               'test_os_credentials_env_variables'),
                        'status':
                        'success'
                    },
                ]
            },
        ])

        def check_testrun_res():
            resp = self.client.testruns()
            self.compare(resp, assertions)

        cluster_id = 1
        testset = 'environment_variables'
        tests = [('fuel_plugin.testing.fixture.'
                  'dummy_tests.test_environment_variables.'
                  'TestEnvVariables.'
                  'test_os_credentials_env_variables')]

        # make sure we have all needed data in db
        self.adapter.testsets(cluster_id)

        self.adapter.start_testrun(testset, cluster_id)
        time.sleep(5)

        check_testrun_res()

        self.client.restart_tests_last(testset, tests, cluster_id)
        time.sleep(5)

        check_testrun_res()
예제 #5
0
    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)

        resp = self.client.testruns_last(cluster_id)

        assertions = base.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(resp, assertions)
        time.sleep(30)

        resp = self.client.testruns_last(cluster_id)

        assertions.general_test['status'] = 'finished'
        assertions.stopped_test['status'] = 'finished'

        self.compare(resp, assertions)
예제 #6
0
    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.testing.fixture.dummy_tests.'
                  'general_test.Dummy_test.test_fast_pass'),
                 ('fuel_plugin.testing.fixture.dummy_tests.'
                  'general_test.Dummy_test.test_fast_fail')]
        disabled_test = [('fuel_plugin.testing.fixture.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)

        resp = self.client.restart_tests_last(testset, disabled_test,
                                              cluster_id)

        assertions = base.Response([{
            'testset':
            'general_test',
            'status':
            'running',
            'tests': [{
                'status':
                'disabled',
                'name':
                'Fast fail with step',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fail_with_step'),
            }, {
                'status':
                'wait_running',
                'name':
                'And fast error',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_error'),
            }, {
                'status':
                'failure',
                'name':
                'Fast fail',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_fail'),
            }, {
                'status':
                'success',
                'name':
                'fast pass test',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_pass'),
            }, {
                'status':
                'disabled',
                'name':
                'Will sleep 5 sec',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_long_pass'),
            }, {
                'status':
                'disabled',
                'name':
                'Skip',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_skip'),
            }, {
                'status':
                'disabled',
                'name':
                'Skip with exception',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_skip_directly'),
            }],
            'cluster_id':
            1,
        }])
        self.compare(resp, assertions)
        time.sleep(5)

        resp = 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(resp, assertions)
예제 #7
0
    def test_single_test_restart(self):
        """Verify that you restart individual tests for given testrun."""
        testset = "general_test"
        tests = [('fuel_plugin.testing.fixture.dummy_tests.'
                  'general_test.Dummy_test.test_fast_pass'),
                 ('fuel_plugin.testing.fixture.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)

        resp = self.client.restart_tests_last(testset, tests, cluster_id)

        assertions = base.Response([{
            'testset':
            'general_test',
            'status':
            'running',
            'tests': [{
                'status':
                'failure',
                'name':
                'Fast fail with step',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fail_with_step'),
            }, {
                'status':
                'error',
                'name':
                'And fast error',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_error'),
            }, {
                'status':
                'wait_running',
                'name':
                'Fast fail',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_fail'),
            }, {
                'status':
                'wait_running',
                'name':
                'fast pass test',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_fast_pass'),
            }, {
                'status':
                'success',
                'name':
                'Will sleep 5 sec',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_long_pass'),
            }, {
                'status':
                'skipped',
                'name':
                'Skip',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_skip'),
            }, {
                'status':
                'skipped',
                'name':
                'Skip with exception',
                'id': ('fuel_plugin.testing.fixture.dummy_tests.'
                       'general_test.Dummy_test.test_skip_directly'),
            }],
            'cluster_id':
            1,
        }])

        self.compare(resp, assertions)
        time.sleep(10)

        resp = 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(resp, assertions)