Skip to content

Commit

Permalink
Updated more tests for the new timestamp representation.
Browse files Browse the repository at this point in the history
  • Loading branch information
eriq-augustine committed Sep 14, 2024
1 parent 64e3fbf commit d4957e3
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 50 deletions.
2 changes: 1 addition & 1 deletion autograder/api/admin/fetchlogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
+ ' (using "h", "m", or "s" suffixes) (e.g., "24h", "10m", or "1h10m10s").'),
required = False),

autograder.api.config.APIParam('assignment-id',
autograder.api.config.APIParam('target-assignment',
'If supplied, only return log records for this assignment.',
required = False),

Expand Down
2 changes: 1 addition & 1 deletion autograder/cli/admin/fetch-logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _log_record_str(record):
if (record['level'] in LEVEL_TO_STRING):
level = LEVEL_TO_STRING[record['level']]

timestamp = autograder.util.timestamp.get(record['unix-time'] / 1000000, pretty = True)
timestamp = autograder.util.timestamp.get(record['timestamp'], pretty = True)

message = record['message']

Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def clean_token(output):

def clean_output_logs(output):
record_set_values = {
'unix-time': 0,
'timestamp': 0,
}

attribute_set_values = {
Expand Down
4 changes: 2 additions & 2 deletions tests/api/testdata/admin_fetch_logs_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand All @@ -22,7 +22,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/api/testdata/admin_fetch_logs_empty_assignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"arguments": {
"course": "course101",
"level": "INFO",
"assignment-id": "HW0"
"target-assignment": "HW0"
},
"output-modifier": "clean_output_logs",
"output": {
Expand Down
16 changes: 0 additions & 16 deletions tests/api/testdata/admin_fetch_logs_missing_assignment.json

This file was deleted.

4 changes: 2 additions & 2 deletions tests/api/testdata/admin_fetch_logs_time_early.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand All @@ -23,7 +23,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA="
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA="
},
"stdout": "",
"stderr": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA="
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA="
},
"stdout": "",
"stderr": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA="
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA="
},
"stdout": "",
"stderr": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqsgvv8QztyAnNTc1ryQ1hQsQAAD//6rUxttQAAAA"
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAKSTwUrDQBCG7z7FmqttmJk0MckT6EUQBQ8iYWmGsJDd1N0tKKXvLk1jpNHaJs1pmGG+/HzDbq6EECIwUnOQi+DuBYLZvvW+ZudVY1yQi9e2tfs2fXWw94jdWj/R8qNYNcr43T4Ohm7ZWP6jr9k5WbXEIa+yslSmKpyX1hde7f9LQNEccY74TJRjlC8wzLI4pvQGIAc4RmFTnmQk1DF6xHZ20gNN8gDHPTw0/l6vatZsPJfCsl9bw2V4iZ80vqVL/aQJJuP9PPnPmv9VNFRxhqIWKpQTy5qluZ5qhkIA/Ln6JDMUQgSE8MtMW711T2vMrSLKFgeJRiTBDKLvJNuvAAAA///yxSnK6gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAJySzWrDMBCE736Krc6hSE5/7DxBeymUHnooxYhoMQJrlUobaAl59xI1uFTEcRWfltmZMd+iXQUAIEg7FCsQD69SLH6kjy1Gtp6iWMFbkg7fbpz+5J7VMTZunP7sNt4SH/IqW8a1D3hCdxij7lNj3tcHbSz1XWQduGOb/qvu2vb+Rja1atvbiQCSOWkf3fvFLF19EZ2cpnvy/Og2AzokRgMBeRsIzXUxdVNG3RRQv/DXgGfBc8B/gKdSsBHWA2q6KuOtpcxvfY63lkv5y5um9+Pjnr3rMjNO9KtqX30HAAD//xSSgptDAwAA"
},
"stdout": "",
"stderr": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KU/DLL/HMLchJzU3NK0lN4eJCVmukUZaYg1c5IAAA//8hrjgTWgAAAA=="
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uANST0UrDMBSG732KmFu3cU6StV2eQG8EUfBCpIT1UAJtOpMMlLF3l3a1sIrO0it7dTiH/+vPBzlcMcYYd6Ymrhm/fQa+OK3e9hSibVzgmr10q/Y7DNNZ7gH72HCpzXu+a6yLbR5Hx7BtfJuDcYhCMGVHvG/iXb2rqCYXqWCe4t47Klbj/5TeFNaVeYjGxzzaUx8BQi4Rl4hPQmiUWuFKbkApdQOgAX6ikCsuMtKsZwyI4+KiH/Ef/EiJm7l+pFwn0/08xo+KflU0VvEHRR2U2cC2FRl3PcdMAgnOM6PEep3hNzPd9No/uQmNskwCnDWa0CQVKv1qcvwMAAD//9IHggUCBAAA"
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMySwWrDMAyG73kKzecy4rRrkz7BdhmMHXYYI5haBEMsd7YKG6XvPuIlGTFsWW7NSUj/J+UDnzMAAEHKotiDuH/Jxeq79X7CwMZREHt4ja3uO4/VhHuSPTZOrPqoj84Qd7xMhuHgfMflKYQhqCZufHT8YI8tWiRGDR755An1bXqn8UobaurAynPNJv6P3FbVbpOXhVxX6Y0BQNJDXEzyYsxfVrPexdV6r+e9J/EF1s/82eKf4qngP8TjUjABDi0qulnsu13iuynufnxj9dY/+7k7ZZkEf9m/yy7ZVwAAAP//do3jyV0DAAA="
},
"stdout": "",
"stderr": ""
Expand Down Expand Up @@ -101,7 +101,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqsgvv8QztyAnNTc1ryQ1hQsQAAD//6rUxttQAAAA"
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAKSTwUrDQBCG7z7FmqttmJk0MckT6EUQBQ8iYWmGsJDd1N0tKKXvLk1jpNHaJs1pmGG+/HzDbq6EECIwUnOQi+DuBYLZvvW+ZudVY1yQi9e2tfs2fXWw94jdWj/R8qNYNcr43T4Ohm7ZWP6jr9k5WbXEIa+yslSmKpyX1hde7f9LQNEccY74TJRjlC8wzLI4pvQGIAc4RmFTnmQk1DF6xHZ20gNN8gDHPTw0/l6vatZsPJfCsl9bw2V4iZ80vqVL/aQJJuP9PPnPmv9VNFRxhqIWKpQTy5qluZ5qhkIA/Ln6JDMUQgSE8MtMW711T2vMrSLKFgeJRiTBDKLvJNuvAAAA///yxSnK6gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAJySzWrDMBCE736Krc6hSE5/7DxBeymUHnooxYhoMQJrlUobaAl59xI1uFTEcRWfltmZMd+iXQUAIEg7FCsQD69SLH6kjy1Gtp6iWMFbkg7fbpz+5J7VMTZunP7sNt4SH/IqW8a1D3hCdxij7lNj3tcHbSz1XWQduGOb/qvu2vb+Rja1atvbiQCSOWkf3fvFLF19EZ2cpnvy/Og2AzokRgMBeRsIzXUxdVNG3RRQv/DXgGfBc8B/gKdSsBHWA2q6KuOtpcxvfY63lkv5y5um9+Pjnr3rMjNO9KtqX30HAAD//xSSgptDAwAA"
},
"stdout": "",
"stderr": ""
Expand Down Expand Up @@ -151,7 +151,7 @@
"submission.py": "H4sICAAAAAAA/3N1Ym1pc3Npb24ucHkASklNU0grzUsuyczPM9TQtOJSUFBQKEotKS3KUwgpKk3l4kJWYaRRlpiDqqgsMUdBW8GQCxAAAP//PpwmbkkAAAA="
},
"output-files-gzip": {
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMyTUUvDMBDH3/0UZ17d5O6ypC6fwFdR8EGkhC2UwJpqE0EZ++6yrBZXnaP0xT4d/+N+/fODbC8AAESwtRMGxO0jitkhen1zMfkmRGHgKUf7b9tPR3d31J31m9q+ly+ND2l/T4NlXDWt+yWvXYy2ysQhr2rt2oeqjMm2qUz+8F9GlnOiOdEDsyFpFnytliylukI0iKcoLqzPMgrqGD1iNzvrgf+TB8XTPSjWxXgP9+lj4/5UgSdUDPNvKjIUfITVxtlwOcXMDSuaZkZzoRX+MJOn5+4JjWmEtDhuNKLJkjV/Ndl9BgAA///7xmbx0gMAAA=="
"result.json": "H4sICAAAAAAA/3Jlc3VsdC5qc29uAMSSvQqDMBSFd5/iNrNDDPUnPkHX0qFDKRI0SEBja1JoEd+9mIptg1YyNdPl3HPO5YN0HgAAkqzmKAW0O2Lkv6TrjSstGqlQCicjDa+bpq/cPhhj06Zm9+zSCKmHfGAtVd60fEavuVKsNI12X9myQsgyU5q1OtPC3A0iSuMtTggJKVkIcFnM2id376/Skb/ThW50oQPdQT8q/hMQLwDa+gegKQWhIK84kxtn3sSFNyLxm9dM5/ETr97BlnGhn3q99wwAAP//PProBisDAAA="
},
"stdout": "",
"stderr": ""
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def json_logs_equal(test_case, expected, actual, **kwargs):

for records in [expected, actual]:
for record in records:
record['unix-time'] = -1
record['timestamp'] = 0

test_case.assertListEqual(expected, actual)

Expand Down
4 changes: 2 additions & 2 deletions tests/cli/testdata/admin/admin_fetch_logs_base_json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand All @@ -22,7 +22,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"output_check": "json_logs_equal",
"arguments": [
"--course", "course101",
"--assignment", "HW0",
"--target-assignment", "HW0",
"--level", "INFO",
"--json"
]
Expand Down
13 changes: 0 additions & 13 deletions tests/cli/testdata/admin/admin_fetch_logs_missing_assignment.txt

This file was deleted.

4 changes: 2 additions & 2 deletions tests/cli/testdata/admin/admin_fetch_logs_time_early.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand All @@ -23,7 +23,7 @@
{
"level": -10,
"message": "Loaded course.",
"unix-time": 0,
"timestamp": 0,
"course": "course-without-source",
"attributes": {
"num-assignments": 0,
Expand Down

0 comments on commit d4957e3

Please sign in to comment.