Esempio n. 1
0
 def _is_valid_job(self, pulse_job):
     try:
         jsonschema.validate(pulse_job, get_json_schema("pulse-job.yml"))
     except (jsonschema.ValidationError, jsonschema.SchemaError) as e:
         logger.error(
             "JSON Schema validation error during job ingestion: %s", e)
         return False
     return True
Esempio n. 2
0
def test_job_symbols(sample_data, job_symbol):
    """
    Validate jobs against the schema with different job_symbol values
    """
    job = sample_data.pulse_jobs[0]
    job["origin"]["project"] = "proj"
    job["origin"]["revision"] = "1234567890123456789012345678901234567890"
    job["display"]["jobSymbol"] = job_symbol
    jsonschema.validate(job, get_json_schema("pulse-job.yml"))
Esempio n. 3
0
def validateTask(task):
    treeherderMetadata = task.get("extra", {}).get("treeherder")
    if not treeherderMetadata:
        logger.debug("Task metadata is missing Treeherder job configuration.")
        return False
    try:
        jsonschema.validate(treeherderMetadata, get_json_schema("task-treeherder-config.yml"))
    except (jsonschema.ValidationError, jsonschema.SchemaError) as e:
        logger.error("JSON Schema validation error during Taskcluser message ingestion: %s", e)
        return False
    return True
Esempio n. 4
0
 def _is_valid_job(self, pulse_job):
     try:
         # e.g. [email protected]
         # Changing the pulse schema will also require a schema change
         if len(pulse_job["owner"]) > 50:
             pulse_job["owner"] = pulse_job["owner"][0:49]
         jsonschema.validate(pulse_job, get_json_schema("pulse-job.yml"))
     except (jsonschema.ValidationError, jsonschema.SchemaError) as e:
         logger.error(
             "JSON Schema validation error during job ingestion: %s", e)
         return False
     return True