Implement script unit testing
Description
Adds an endpoint where scripts and unit test values can be submitted to to verify that a criteria script is valid. This helps prevent crashing assignments at a very early stage. The values are stored inside the assignment, so later edits that would invalidate these tests can be detected too.
Also links metric instance types to metric names so they can be type-checked and the system can generate suitable template scripts and unit tests for assignments.
Requires UI updates to be functional.
Resolves #100 (closed)
Additions
- Metric names now have an expected (super-)type for instances with that name
- Creating a new metric type-checks the value, generating a warning (not an error) if there is a mismatch
- An endpoint where scripts can be tested
- Testing fixtures to pre-fill tests in the UI with as a quick start and suggestions
Changes
- IntegerMetric and DoubleMetric are subclasses of the new NumberMetric for metric names that do not care about the floatiness of their values
- Moved metrics endpoints to a separate controller
- Deprecated metrics.js
Test and Review
To be filled in by the reviewers
-
All of the methods are commented to expectation -
The methods are tested to satisfaction -
There are no unnecessary files present in the MR -
The continuous integration has no problems with the MR -
The MR is filled in as requested (including labels, milestones, and reviewers) -
The documentation is up-to-date -
All nullable parameters are marked as such
Merge request reports
Activity
changed milestone to %Queue 1.0
added 1 commit
- 4f205e11 - Include the type in the worker's metric list
58 final var res = new Response(); 59 res.put("metrics", this.messageReceiver.getMetrics()); 60 return ResponseEntity.ok(res); 61 } 62 63 /** 64 * Returns the metrics as a {@code metrics} property of the global {@code MetricEditor} object. 65 * 66 * @return the metrics as an object property 67 * 68 * @deprecated originally a hack for the old UI to allow this resource to load in a blocking 69 * fashion, no longer necessary 70 */ 71 @GetMapping("/api/v1/worker/metrics.js") 72 @Deprecated 73 public ResponseEntity<String> getMetricsJsAction() { This endpoint was previously in WorkerController
I don't like outright removing stuff (things tend to break in novel ways), hence the deprecation.
added 15 commits
-
e47f63c0...012e2146 - 14 commits from branch
development
- 31ad9b5b - Merge branch 'development' into metric-type-checking
-
e47f63c0...012e2146 - 14 commits from branch
mentioned in commit 7fdc1a02
mentioned in issue #72 (closed)
unassigned @leverse