Esempio n. 1
0
def context(tmpdir_factory):
    temp_dir = tmpdir_factory.mktemp("context", numbered=True)
    context = Context()
    context.config = {
        'log_dir': os.path.join(str(temp_dir), "log"),
        'artifact_dir': os.path.join(str(temp_dir), "artifact"),
        'work_dir': os.path.join(str(temp_dir), "work"),
        'artifact_upload_timeout': 200,
        'artifact_expiration_hours': 1,
        'reclaim_interval': 0.001,
        'task_script': ('bash', '-c', '>&2 echo bar && echo foo && exit 1'),
        'task_max_timeout': .1,
    }
    context.claim_task = {
        'credentials': {
            'a': 'b'
        },
        'status': {
            'taskId': 'taskId'
        },
        'task': {
            'task_defn': True
        },
        'runId': 'runId',
    }
    return context
Esempio n. 2
0
def context(tmpdir):
    context = Context()
    context.config = {
        'log_dir': os.path.join(tmpdir, "log"),
        'artifact_dir': os.path.join(tmpdir, "artifact"),
        'task_log_dir': os.path.join(tmpdir, "artifact", "public", "logs"),
        'work_dir': os.path.join(tmpdir, "work"),
        'artifact_upload_timeout': 200,
        'artifact_expiration_hours': 1,
        'reclaim_interval': 0.001,
        'task_script': ('bash', '-c', '>&2 echo bar && echo foo && exit 1'),
        'task_max_timeout': .1,
    }
    context.claim_task = {
        'credentials': {'a': 'b'},
        'status': {'taskId': 'taskId'},
        'task': {'dependencies': ['dependency1', 'dependency2'], 'taskGroupId': 'dependency0'},
        'runId': 'runId',
    }
    return context
Esempio n. 3
0
def context(tmpdir):
    GPG_HOME = os.path.join(os.path.dirname(__file__), "data", "gpg")
    context_ = Context()
    context_.config = {
        "artifact_dir": ARTIFACT_DIR,
        "work_dir": os.path.join(tmpdir, "work"),
        "log_dir": os.path.join(tmpdir, "log"),
        "chain_of_trust_hash_algorithm": "sha256",
        "cot_schema_path": DEFAULT_CONFIG['cot_schema_path'],
        "gpg_home": GPG_HOME,
        "gpg_encoding": 'utf-8',
        "gpg_options": None,
        "gpg_path": os.environ.get("GPG_PATH", None),
        "gpg_public_keyring": "%(gpg_home)s/pubring.gpg",
        "gpg_secret_keyring": "%(gpg_home)s/secring.gpg",
        "gpg_use_agent": None,
        "sign_chain_of_trust": True,
        "worker_id": "worker_id",
        "worker_type": "worker_type",
    }
    context_.claim_task = {
        "runId": 2,
        "status": {
            "taskId": "taskId",
        },
        "task": {
            'dependencies': [],
            "payload": {},
            "scopes": ["foo"],
            "taskGroupId": "taskGroupId",
            "workerType": "workerType",
        },
        "workerGroup": "worker_group",
        "credentials": {
            'c': 'd'
        },
    }
    yield context_