Skip to content
Snippets Groups Projects
Commit 1c9828c6 authored by Erik Reid's avatar Erik Reid
Browse files

added a more detailed happy-flow test

parent 620da341
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,18 @@ TASK_STATUS_SCHEMA = {
"items": {"$ref": "#/definitions/task"}
}
TASK_LOG_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"pending": {"type": "array", "items": {"type": "string"}},
"errors": {"type": "array", "items": {"type": "string"}},
"failed": {"type": "array", "items": {"type": "string"}},
"warnings": {"type": "array", "items": {"type": "string"}},
},
"required": ["pending", "errors", "failed", "warnings"],
"additionalProperties": False
}
def backend_db():
return _get_redis({
......@@ -260,21 +272,54 @@ def test_job_log(client):
test_events = {
'joblog:AAAA:task-aaa': {
'type': 'task-aaaa', 'uuid': 'AAAA', 'clock': 999},
'type': 'task-aaaa', 'uuid': 'AAAA'},
'joblog:AAAB:task-infox': {
'type': 'task-infox', 'uuid': 'AAAB', 'clock': 999},
'type': 'task-infox', 'uuid': 'AAAB'},
'joblog:CCCC:task-received': {
'type': 'task-received', 'uuid': 'CCCC', 'name': 'xyz', 'args': ['z', 1]},
'joblog:CCCC:task-started': {
'type': 'task-started', 'uuid': 'CCCC'},
'joblog:CCCC:task-succeeded': {
'type': 'task-succeeded', 'uuid': 'CCCC'},
'joblog:TTTT:task-received': {
'type': 'task-received', 'uuid': 'TTTT', 'name': 'xyz', 'args': ['q', 123]},
'joblog:TTTT:task-started': {
'type': 'task-started', 'uuid': 'TTTT'},
'joblog:TTTT:task-failed': {
'type': 'task-failed', 'uuid': 'TTTT'},
'joblog:SSSS1:task-received': {
'type': 'task-received', 'uuid': 'SSSS', 'name': 'xyz', 'args': ['q', 123]},
'joblog:SSSS1:task-started': {
'type': 'task-started', 'uuid': 'SSSS'},
'joblog:SSSS2:task-received': {
'type': 'task-received', 'uuid': 'SSSS2', 'name': 'xyz', 'args': ['q', 123]},
'joblog:SSSS2:task-started': {
'type': 'task-started', 'uuid': 'SSSS2'},
'joblog:SSSS3:task-received': {
'type': 'task-received', 'uuid': 'SSSS3', 'name': 'xyz', 'args': ['q', 123]},
'joblog:SSSS3:task-started': {
'type': 'task-started', 'uuid': 'SSSS3'},
'joblog:BBBB:task-info:99': {
'type': 'task-info', 'uuid': 'BBBB', 'clock': 99},
'type': 'task-info', 'uuid': 'BBBB', 'clock': 99, 'message': 'x'},
'joblog:BBBB:task-info:999': {
'type': 'task-info', 'uuid': 'BBBB', 'clock': 999},
'type': 'task-info', 'uuid': 'BBBB', 'clock': 999, 'message': 'x'},
'joblog:AAAA:task-warning:88': {
'type': 'task-warning', 'uuid': 'AAAA', 'clock': 88},
'type': 'task-warning', 'uuid': 'AAAA', 'clock': 88, 'message': 'x'},
'joblog:AAAA:task-warning:888': {
'type': 'task-warning', 'uuid': 'AAAA', 'clock': 888},
'type': 'task-warning', 'uuid': 'AAAA', 'clock': 888, 'message': 'x'},
'joblog:AAAA:task-error:77': {
'type': 'task-error', 'uuid': 'AAAA', 'clock': 77},
'type': 'task-error', 'uuid': 'AAAA', 'clock': 77, 'message': 'x'},
'joblog:AAAA:task-error:777': {
'type': 'task-error', 'uuid': 'AAAA', 'clock': 777}
'type': 'task-error', 'uuid': 'AAAA', 'clock': 777, 'message': 'x'},
'joblog:AAAA:task-error:7777': {
'type': 'task-error', 'uuid': 'AAAA', 'clock': 7777, 'message': 'x'}
}
db = backend_db()
......@@ -286,4 +331,9 @@ def test_job_log(client):
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
result = json.loads(rv.data.decode('utf-8'))
assert len(result.keys()) == 3 # TODO: make a proper test
jsonschema.validate(result, TASK_LOG_SCHEMA)
assert len(result['errors']) == 3
assert len(result['pending']) == 3
assert len(result['failed']) == 1
assert len(result['warnings']) == 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment