def test_empty(self): """Test generation of an empty config.""" config = storage.generate_life_cycle_config('') expected_config = { 'rule': [{ 'action': { 'type': '', }, 'condition': {}, }], } self.assertEqual(config, expected_config)
def test_delete_with_age(self): """Test generation of a config for deletion with age condition.""" config = storage.generate_life_cycle_config('Delete', age=7) expected_config = { 'rule': [{ 'action': { 'type': 'Delete', }, 'condition': { 'age': 7, }, }], } self.assertEqual(config, expected_config)
def test_delete_with_age_and_new_versions(self): """Test generation of a config for deletion with age and numNewerVersions condition.""" config = storage.generate_life_cycle_config('Delete', age=30, num_newer_versions=10) expected_config = { 'rule': [{ 'action': { 'type': 'Delete', }, 'condition': { 'age': 30, 'numNewerVersions': 10, }, }], } self.assertEqual(config, expected_config)
from handlers import base_handler from libs import handler from metrics import logs from system import environment AFL_BUILD_BUCKET = 'clusterfuzz-builds-afl' LIBFUZZER_BUILD_BUCKET = 'clusterfuzz-builds' NO_ENGINE_BUILD_BUCKET = 'clusterfuzz-builds-no-engine' BUCKET_PROJECT_URL = 'clusterfuzz-external.appspot.com' BUILD_URL_TEMPLATE = ('https://commondatastorage.googleapis.com/{bucket}/' '{project}/{project}-{sanitizer}-([0-9]+).zip') BUILD_BUCKET_PATH_TEMPLATE = ( 'gs://{bucket}/{project}/{project}-{sanitizer}-([0-9]+).zip') IMAGE_BUCKET_NAME = 'artifacts.clusterfuzz-images.appspot.com' BACKUPS_LIFECYCLE = storage.generate_life_cycle_config('Delete', age=100) LOGS_LIFECYCLE = storage.generate_life_cycle_config('Delete', age=14) QUARANTINE_LIFECYCLE = storage.generate_life_cycle_config('Delete', age=90) JOB_TEMPLATE = ('RELEASE_BUILD_BUCKET_PATH = {build_bucket_path}\n' 'FUZZ_LOGS_BUCKET = {logs_bucket}\n' 'CORPUS_BUCKET = {corpus_bucket}\n' 'QUARANTINE_BUCKET = {quarantine_bucket}\n' 'BACKUP_BUCKET = {backup_bucket}\n' 'AUTOMATIC_LABELS = Proj-{project},Engine-{engine}\n' 'PROJECT_NAME = {project}\n' 'SUMMARY_PREFIX = {project}\n' 'REVISION_VARS_URL = {revision_vars_url}\n' 'MANAGED = True\n') OBJECT_VIEWER_IAM_ROLE = 'roles/storage.objectViewer'