コード例 #1
0
def fetch_coverage_test_selection_data(options):
    """
    Set up the datafiles needed to run coverage-driven test selection (who-tests-what)
    """

    try:
        os.makedirs(COVERAGE_CACHE_BASEPATH)
    except OSError:
        pass  # Directory already exists

    sh('git diff $(git merge-base {} HEAD) > {}/{}'.format(
        getattr(options, 'compare_branch', 'origin/master'),
        COVERAGE_CACHE_BASEPATH, WHO_TESTS_WHAT_DIFF))
    get_file_from_s3(COVERAGE_CACHE_BUCKET, COVERAGE_CACHE_BASELINE,
                     COVERAGE_CACHE_BASEPATH)
コード例 #2
0
def refresh_bokchoy_db_cache_from_s3(fingerprint=None):
    """
    If the cache files for the current fingerprint exist
    in s3 then replace what you have on disk with those.
    If no copy exists on s3 then continue without error.
    """
    if not fingerprint:
        fingerprint = fingerprint_bokchoy_db_files(MIGRATION_OUTPUT_FILES,
                                                   ALL_DB_FILES)

    bucket_name = CACHE_BUCKET_NAME
    path = CACHE_FOLDER
    if is_fingerprint_in_bucket(fingerprint, bucket_name):
        zipfile_name = '{}.tar.gz'.format(fingerprint)
        get_file_from_s3(bucket_name, zipfile_name, path)

        zipfile_path = os.path.join(path, zipfile_name)
        print("Extracting db cache files.")
        extract_files_from_zip(BOKCHOY_DB_FILES, zipfile_path, path)
        os.remove(zipfile_path)