コード例 #1
0
ファイル: serverspec.py プロジェクト: ryancurrah/salttester
def run(args, logging):
    """
    Runs the serverspec test runner and downloads the test result

    WARNING: Requires the ruby gem yarjuf and requires modification to
    your .rspec and spec_helper files to export results as junit see
    https://github.com/natritmeyer/yarjuf#modifying-the-rspec-file and
    https://github.com/natritmeyer/yarjuf#modifying-the-specspec_helperrb-file

    :param args: A NameSpace object with the arguments required
    :param logging: A python logging object
    :return: An exit code
    """
    serverspec_junit_file = '/tmp/serverspec.xml'
    args.cmd = 'cd {0}; sudo rspec -f JUnit -o {1}'.format(args.serverspec_test_dir,
                                                           serverspec_junit_file)
    args.remote_path = serverspec_junit_file
    args.local_path = './serverspec.xml'

    logging.info('Running serverspec...')
    exit_code, stdout, stderr = cmd.run(args, logging)
    logging.info('Finished serverspec...')

    logging.info('Downloading serverspec results...')
    get_file.run(args, logging)
    logging.info('Finished downloading serverspec results...')
    return exit_code, stdout, stderr
コード例 #2
0
def run(args, logging):
    """
    Runs the serverspec test runner and downloads the test result

    WARNING: Requires the ruby gem yarjuf and requires modification to
    your .rspec and spec_helper files to export results as junit see
    https://github.com/natritmeyer/yarjuf#modifying-the-rspec-file and
    https://github.com/natritmeyer/yarjuf#modifying-the-specspec_helperrb-file

    :param args: A NameSpace object with the arguments required
    :param logging: A python logging object
    :return: An exit code
    """
    serverspec_junit_file = '/tmp/serverspec.xml'
    args.cmd = 'cd {0}; sudo rspec -f JUnit -o {1}'.format(
        args.serverspec_test_dir, serverspec_junit_file)
    args.remote_path = serverspec_junit_file
    args.local_path = './serverspec.xml'

    logging.info('Running serverspec...')
    exit_code, stdout, stderr = cmd.run(args, logging)
    logging.info('Finished serverspec...')

    logging.info('Downloading serverspec results...')
    get_file.run(args, logging)
    logging.info('Finished downloading serverspec results...')
    return exit_code, stdout, stderr
コード例 #3
0
def run(args, logging):
    """
    Runs the highstate test runner and downloads the test result

    WARNING: Requires the custom junit outputter in your salt states dir
    see https://github.com/ryancurrah/salt-ci-demo/blob/master/states/_output/junit.py

    :param args: A NameSpace object with the arguments required
    :param logging: A python logging object
    :return: An exit code
    """
    highstate_junit_file = '/tmp/highstate.xml'
    args.cmd = 'sudo salt-call state.highstate --out=junit ' \
               '--out-file={0}'.format(highstate_junit_file)
    args.remote_path = highstate_junit_file
    args.local_path = './highstate.xml'

    logging.info('Running highstate...')
    exit_code, stdout, stderr = cmd.run(args, logging)
    logging.info('Finished highstate...')

    logging.info('Downloading highstate results...')
    get_file.run(args, logging)
    logging.info('Finished downloading highstate results...')
    return exit_code, stdout, stderr
コード例 #4
0
ファイル: pytest.py プロジェクト: ryancurrah/salttester
def run(args, logging):
    """
    Runs the pytest test runner and downloads the test result

    :param args: A NameSpace object with the arguments required
    :param logging: A python logging object
    :return: An exit code
    """
    pytest_junit_file = '/tmp/pytest.xml'
    args.cmd = 'sudo py.test {0} -v --junit-xml={1}'.format(args.pytest_test_dir, pytest_junit_file)
    args.remote_path = pytest_junit_file
    args.local_path = './pytest.xml'

    logging.info('Running py.test...')
    exit_code, stdout, stderr = cmd.run(args, logging)
    logging.info('Finished py.test...')

    logging.info('Downloading py.test results...')
    get_file.run(args, logging)
    logging.info('Finished downloading py.test results...')
    return exit_code, stdout, stderr
コード例 #5
0
def run(args, logging):
    """
    Runs the pytest test runner and downloads the test result

    :param args: A NameSpace object with the arguments required
    :param logging: A python logging object
    :return: An exit code
    """
    pytest_junit_file = '/tmp/pytest.xml'
    args.cmd = 'sudo py.test {0} -v --junit-xml={1}'.format(
        args.pytest_test_dir, pytest_junit_file)
    args.remote_path = pytest_junit_file
    args.local_path = './pytest.xml'

    logging.info('Running py.test...')
    exit_code, stdout, stderr = cmd.run(args, logging)
    logging.info('Finished py.test...')

    logging.info('Downloading py.test results...')
    get_file.run(args, logging)
    logging.info('Finished downloading py.test results...')
    return exit_code, stdout, stderr