Exemplo n.º 1
0
    def test_main(self):
        suite_name = 'SUITE'
        throttle = '3'
        machine_type = 'burnupi'

        def prepare_and_schedule(**kwargs):
            assert kwargs['job_config']['suite'] == suite_name
            assert kwargs['throttle'] == throttle

        def fake_str(*args, **kwargs):
            return 'fake'

        def fake_bool(*args, **kwargs):
            return True

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                prepare_and_schedule=prepare_and_schedule,
                package_version_for_hash=fake_str,
                git_branch_exists=fake_bool,
                git_ls_remote=fake_str,
        ):
            main([
                '--suite',
                suite_name,
                '--throttle',
                throttle,
                '--machine-type',
                machine_type,
            ])
Exemplo n.º 2
0
    def test_schedule_suite(self):
        suite_name = 'noop'
        suite_dir = os.path.dirname(__file__)
        throttle = '3'
        machine_type = 'burnupi'

        with patch.multiple(
            'teuthology.suite.util',
            fetch_repos=DEFAULT,
            teuthology_schedule=DEFAULT,
            get_arch=lambda x: 'x86_64',
            get_gitbuilder_hash=DEFAULT,
            git_ls_remote=lambda *args: '12345',
            package_version_for_hash=DEFAULT,
        ) as m:
            m['package_version_for_hash'].return_value = 'fake-9.5'
            config.suite_verify_ceph_hash = True
            main([
                '--ceph', 'master',
                '--suite', suite_name,
                '--suite-dir', suite_dir,
                '--suite-relpath', '',
                '--throttle', throttle,
                '--machine-type', machine_type
            ])
            m_sleep.assert_called_with(int(throttle))
Exemplo n.º 3
0
    def test_main(self):
        suite_name = 'SUITE'
        throttle = '3'
        machine_type = 'burnupi'

        def prepare_and_schedule(obj):
            assert obj.base_config.suite == suite_name
            assert obj.args.throttle == throttle

        def fake_str(*args, **kwargs):
            return 'fake'

        def fake_bool(*args, **kwargs):
            return True

        with patch.multiple(
                'teuthology.suite.run.util',
                fetch_repos=DEFAULT,
                package_version_for_hash=fake_str,
                git_branch_exists=fake_bool,
                git_ls_remote=fake_str,
                ):
            with patch.multiple(
                'teuthology.suite.run.Run',
                prepare_and_schedule=prepare_and_schedule,
            ):
                main([
                    '--suite', suite_name,
                    '--throttle', throttle,
                    '--machine-type', machine_type,
                ])
Exemplo n.º 4
0
    def test_main(self):
        suite_name = 'SUITE'
        throttle = '3'
        machine_type = 'burnupi'

        def prepare_and_schedule(**kwargs):
            assert kwargs['job_config']['suite'] == suite_name
            assert kwargs['throttle'] == throttle

        def fake_str(*args, **kwargs):
            return 'fake'

        def fake_bool(*args, **kwargs):
            return True

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                prepare_and_schedule=prepare_and_schedule,
                get_hash=fake_str,
                package_version_for_hash=fake_str,
                git_branch_exists=fake_bool,
                git_ls_remote=fake_str,
                ):
            main(['--suite', suite_name,
                  '--throttle', throttle,
                  '--machine-type', machine_type,
                  ])
Exemplo n.º 5
0
    def test_schedule_suite(self):
        suite_name = 'noop'
        suite_dir = os.path.dirname(__file__)
        throttle = '3'
        machine_type = 'burnupi'

        with patch.multiple(
            'teuthology.suite.util',
            fetch_repos=DEFAULT,
            teuthology_schedule=DEFAULT,
            get_arch=lambda x: 'x86_64',
            get_gitbuilder_hash=DEFAULT,
            git_ls_remote=lambda *args: '12345',
            package_version_for_hash=DEFAULT,
        ) as m:
            m['package_version_for_hash'].return_value = 'fake-9.5'
            config.suite_verify_ceph_hash = True
            main([
                '--ceph', 'master',
                '--suite', suite_name,
                '--suite-dir', suite_dir,
                '--suite-relpath', '',
                '--throttle', throttle,
                '--machine-type', machine_type
            ])
            m_sleep.assert_called_with(int(throttle))
Exemplo n.º 6
0
    def test_main(self):
        suite_name = 'SUITE'
        throttle = '3'
        machine_type = 'burnupi'

        def prepare_and_schedule(obj):
            assert obj.base_config.suite == suite_name
            assert obj.args.throttle == throttle

        def fake_str(*args, **kwargs):
            return 'fake'

        def fake_bool(*args, **kwargs):
            return True

        with patch.multiple(
                'teuthology.suite.run.util',
                fetch_repos=DEFAULT,
                package_version_for_hash=fake_str,
                git_branch_exists=fake_bool,
                git_ls_remote=fake_str,
        ):
            with patch.multiple(
                    'teuthology.suite.run.Run',
                    prepare_and_schedule=prepare_and_schedule,
            ):
                main([
                    '--suite',
                    suite_name,
                    '--throttle',
                    throttle,
                    '--machine-type',
                    machine_type,
                ])
Exemplo n.º 7
0
    def test_schedule_suite(self):
        suite_name = 'noop'
        throttle = '3'
        machine_type = 'burnupi'

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                teuthology_schedule=DEFAULT,
                sleep=DEFAULT,
                ) as m:
            main(['--suite', suite_name,
                  '--suite-dir', 'teuthology/test',
                  '--throttle', throttle,
                  '--machine-type', machine_type])
            m['sleep'].assert_called_with(int(throttle))
Exemplo n.º 8
0
    def test_main(self):
        suite_name = 'SUITE'
        throttle = '3'
        machine_type = 'burnupi'
        def prepare_and_schedule(**kwargs):
            assert kwargs['job_config']['suite'] == suite_name
            assert kwargs['throttle'] == throttle

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                prepare_and_schedule=prepare_and_schedule,
                ):
            main(['--suite', suite_name,
                  '--throttle', throttle,
                  '--machine-type', machine_type])
Exemplo n.º 9
0
    def test_schedule_suite(self):
        suite_name = 'noop'
        throttle = '3'
        machine_type = 'burnupi'

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                teuthology_schedule=DEFAULT,
                sleep=DEFAULT,
                get_arch=lambda x: 'x86_64',
                git_ls_remote=lambda *args: '12345',
                package_version_for_hash=DEFAULT,
        ) as m:
            m['package_version_for_hash'].return_value = 'fake-9.5'
            config.suite_verify_ceph_hash = True
            main([
                '--suite', suite_name, '--suite-dir', 'teuthology/test',
                '--throttle', throttle, '--machine-type', machine_type
            ])
            m['sleep'].assert_called_with(int(throttle))
Exemplo n.º 10
0
    def test_schedule_suite(self):
        suite_name = 'noop'
        throttle = '3'
        machine_type = 'burnupi'

        with patch.multiple(
                suite,
                fetch_repos=DEFAULT,
                teuthology_schedule=DEFAULT,
                sleep=DEFAULT,
                get_arch=lambda x: 'x86_64',
                git_ls_remote=lambda *args: '12345',
                package_version_for_hash=DEFAULT,
                ) as m:
            m['package_version_for_hash'].return_value = 'fake-9.5'
            config.suite_verify_ceph_hash = True
            main(['--suite', suite_name,
                  '--suite-dir', 'teuthology/test',
                  '--throttle', throttle,
                  '--machine-type', machine_type])
            m['sleep'].assert_called_with(int(throttle))