Exemple #1
0
    def test_can_run_funkload(self):
        team = TeamFactory.create()
        TeamFactory.add_projects(team, 1)
        user = team.owner
        project = team.projects[0]
        load_test = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
        load_test.pressure = "small"

        conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
        test = conf.tests[0]

        DEFAULT_CYCLES = {
            "small": [10, 20],
            "medium": [10, 20, 30],
            "large": [30, 75, 100],
        }

        fl_result = FunkLoadBenchRunner.run(root_path, test, self.base_url, cycles=DEFAULT_CYCLES, duration=5)

        expect(fl_result).not_to_be_null()
        expect(fl_result.exit_code).to_equal(0)

        expect(fl_result.text).to_include("SUCCESSFUL")

        expect(fl_result.log).to_be_empty()

        expect(fl_result.result).not_to_be_null()
        expect(fl_result.config).not_to_be_null()

        result = LoadTest.get_data_from_funkload_results(fl_result.config, fl_result.result)

        load_test.add_result(result, fl_result.text)

        expect(load_test.results).to_length(1)
Exemple #2
0
    def _run_config_tests(self, cfg, base_path, load_test, workers, cycles, duration):
        logging.debug("running tests")
        for test in cfg.tests:
            kw = dict(
                root_path=base_path,
                test=test,
                base_url=load_test.base_url,
                cycles=cycles,
                duration=duration
            )

            if workers:
                kw['workers'] = workers

            fl_result = FunkLoadBenchRunner.run(**kw)

            if fl_result.exit_code != 0:
                load_test.status = "Failed"
                load_test.error = fl_result.text
                load_test.save()
                return

            logging.debug("create result for %s" % test.test_name)
            result = LoadTest.get_data_from_funkload_results(fl_result.config, fl_result.result)

            load_test.add_result(result, log=fl_result.text)
Exemple #3
0
    def test_can_run_funkload(self):
        team = TeamFactory.create()
        TeamFactory.add_projects(team, 1)
        user = team.owner
        project = team.projects[0]
        load_test = LoadTestFactory.add_to_project(1,
                                                   user=user,
                                                   team=team,
                                                   project=project)
        load_test.pressure = "small"

        conf = WightConfig.load(join(root_path, 'bench', 'wight.yml'))
        test = conf.tests[0]

        DEFAULT_CYCLES = {
            "small": [10, 20],
            "medium": [10, 20, 30],
            "large": [30, 75, 100],
        }

        fl_result = FunkLoadBenchRunner.run(root_path,
                                            test,
                                            self.base_url,
                                            cycles=DEFAULT_CYCLES,
                                            duration=5)

        expect(fl_result).not_to_be_null()
        expect(fl_result.exit_code).to_equal(0)

        expect(fl_result.text).to_include("SUCCESSFUL")

        expect(fl_result.log).to_be_empty()

        expect(fl_result.result).not_to_be_null()
        expect(fl_result.config).not_to_be_null()

        result = LoadTest.get_data_from_funkload_results(
            fl_result.config, fl_result.result)

        load_test.add_result(result, fl_result.text)

        expect(load_test.results).to_length(1)