Пример #1
0
    def test_git_type_demo_project_config(self):
        master = self.cluster.start_master()
        self.cluster.start_slave(num_executors_per_slave=10)

        build_resp = master.post_new_build({
            'type': 'git',
            'url': 'https://github.com/boxengservices/ClusterRunnerDemo.git',
            'job_name': 'Simple',
        })
        build_id = build_resp['build_id']
        master.block_until_build_finished(
            build_id,
            timeout=20)  # extra time here to allow for cloning the repo

        # Each atom of the demo project just echoes one of the numbers 1 through 10.
        expected_artifact_contents = [
            Directory('artifact_{}_0'.format(i), [
                File('clusterrunner_command'),
                File('clusterrunner_console_output',
                     contents='{}\n\n'.format(i + 1)),
                File('clusterrunner_exit_code', contents='0\n'),
                File('clusterrunner_time'),
            ]) for i in range(10)
        ]
        expected_artifact_contents.append(File('results.tar.gz'))

        self.assert_build_has_successful_status(build_id=build_id)
        self.assert_build_status_contains_expected_data(build_id=build_id,
                                                        expected_data={
                                                            'num_atoms': 10,
                                                            'num_subjobs': 10
                                                        })
        self.assert_build_artifact_contents_match_expected(
            build_id=build_id,
            expected_build_artifact_contents=expected_artifact_contents)
    def test_git_type_demo_project_config(self):
        master = self.cluster.start_master()
        self.cluster.start_slave(num_executors_per_slave=10)

        build_resp = master.post_new_build({
            'type': 'git',
            'url': 'https://github.com/boxengservices/ClusterRunnerDemo.git',
            'job_name': 'Simple',
        })
        build_id = build_resp['build_id']
        self.assertTrue(
            master.block_until_build_finished(build_id, timeout=30),
            'The build should finish building within the timeout.')

        # Each atom of the demo project just echoes one of the numbers 1 through 10.
        expected_artifact_contents = [
            Directory('artifact_{}_0'.format(i), [
                File('clusterrunner_command'),
                File('clusterrunner_console_output',
                     contents='{}\n\n'.format(i + 1)),
                File('clusterrunner_exit_code', contents='0\n'),
                File('clusterrunner_time'),
            ]) for i in range(10)
        ]
        expected_artifact_contents.append(
            File(BuildArtifact.ARTIFACT_TARFILE_NAME))
        expected_artifact_contents.append(
            File(BuildArtifact.ARTIFACT_ZIPFILE_NAME))

        self.assert_build_has_successful_status(build_id=build_id)
        self.assert_build_status_contains_expected_data(build_id=build_id,
                                                        expected_data={
                                                            'num_atoms': 10,
                                                            'num_subjobs': 10
                                                        })
        self.assert_build_artifact_contents_match_expected(
            build_id=build_id,
            expected_build_artifact_contents=expected_artifact_contents)
Пример #3
0
from test.framework.functional.fs_item import File, Directory


# These are the files that we expect to be present in every atom artifact directory.
DEFAULT_ATOM_FILES = [
    File('clusterrunner_command'),
    File('clusterrunner_console_output'),
    File('clusterrunner_exit_code'),
    File('clusterrunner_time'),
]


class FunctionalTestJobConfig(object):
    def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_atoms,
                 expected_artifact_contents=None, expected_project_dir_contents=None):
        self.config = config
        self.expected_to_fail = expected_to_fail
        self.expected_num_subjobs = expected_num_subjobs
        self.expected_num_atoms = expected_num_atoms
        self.expected_artifact_contents = expected_artifact_contents
        self.expected_project_dir_contents = expected_project_dir_contents


# This is a very basic job where each atom just creates a simple text file.
BASIC_JOB = FunctionalTestJobConfig(
    config={
        'posix': """
BasicJob:
    commands:
        - echo $TOKEN > $ARTIFACT_DIR/result.txt
    atomizers:
Пример #4
0
from test.framework.functional.fs_item import File, Directory

# These are the files that we expect to be present in every atom artifact directory.
DEFAULT_ATOM_FILES = [
    File('clusterrunner_command'),
    File('clusterrunner_console_output'),
    File('clusterrunner_exit_code'),
    File('clusterrunner_time'),
]


class FunctionalTestJobConfig(object):
    def __init__(self,
                 config,
                 expected_to_fail,
                 expected_num_subjobs,
                 expected_num_atoms,
                 expected_artifact_contents=None,
                 expected_project_dir_contents=None):
        self.config = config
        self.expected_to_fail = expected_to_fail
        self.expected_num_subjobs = expected_num_subjobs
        self.expected_num_atoms = expected_num_atoms
        self.expected_artifact_contents = expected_artifact_contents
        self.expected_project_dir_contents = expected_project_dir_contents


# This is a very basic job where each atom just creates a simple text file.
BASIC_JOB = FunctionalTestJobConfig(
    config={
        'posix':