Closed
Bug 1063691
Opened 10 years ago
Closed 7 years ago
Switch test_log_view_artifact_builder.py tests to be schema validation assertions instead
Categories
(Tree Management :: Treeherder: Data Ingestion, defect, P5)
Tree Management
Treeherder: Data Ingestion
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1397394
People
(Reporter: emorley, Unassigned)
References
Details
(In reply to Jonathan Eads ( :jeads ) from bug 1043741comment #9) > > (In reply to Ed Morley [:edmorley] from bug 1043741 comment #7) > > * The tests were updated by uncommenting that block in > > test_log_view_artifact_builder.py, but since the dicts are unordered, we're > > at the mercy of whatever order Python decides to use, which is why the test > > diffs are larger (and less readable) than I would have liked. > > The testing strategy here, > https://github.com/mozilla/treeherder-service/blob/master/tests/log_parser/ > test_log_view_artifact_builder.py#L48, is brittle and will likely keep > biting us as we continue to modify the log view artifact in the future. A > better strategy would be to maintain explicit json schemas for json > artifacts when treeherder has hard structure requirements. The jsonschema > module is already in our vendor lib > https://github.com/mozilla/treeherder-service/tree/master/vendor/jsonschema > so this is just a matter of defining the schema. > > If we do this, we can modify the test assertion to be schema validation > results, which would be much easier to maintain going forward. Would also > allow us to validate structures at run time in production so we can log > errors when we hit them. This is out of the scope of this PR but should be > added as a refactor task for treeherder.
Reporter | ||
Updated•10 years ago
|
Component: Treeherder → Treeherder: Data Ingestion
Reporter | ||
Updated•9 years ago
|
Priority: P3 → P5
Comment 1•7 years ago
|
||
Can we validate the tests or if this is working as it is should be?
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(cdawson)
Resolution: --- → INVALID
Comment 2•7 years ago
|
||
We actually don't store this artifact in the form that the artifact builder creates any longer. We take that artifact and create entries in the TextLogStep and TextLogError models/tables. And the entries in that model are used in the current Log Viewer to show steps. So a better solution to this would be to remove all the "golden" files to compare against. We could then validate that the right entries in TextLogStep and TextLogErrors were created. https://github.com/mozilla/treeherder/blob/78dc024094a8d6b5c08fbb3e41b968d40aa0c16c/treeherder/etl/artifact.py#L50-L87 In conclusion. These tests are still valid, but (as stated earlier) brittle. We should refactor them to make them better.
Status: RESOLVED → REOPENED
Flags: needinfo?(cdawson)
Resolution: INVALID → ---
Updated•7 years ago
|
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•