Repository navigation
fix(conformance): count an array with only null elements as unchecked - #336
Conversation
arrayOf.check marked a path as filled when the array was not empty, and then skipped each null element. The scrub turns an all-null array into [null], so a route whose recordings held only null elements passed with no unchecked line and no element shape checked. Mark a path as filled only when a non-null element there was checked. Otherwise report it as empty. Fixes #335
|
Independent verification: PASS+NOTES Head: Gate on head. 1. 2. Repro from #335. I used the committed set, set the courses favorites body to 3. Injected defects (each reverted,
4. README (conformance/README.md:101). The text says that an array that is empty or holds only 5. CHANGELOG. The diff changes only Notes (no change necessary for this PR):
|
Fixes #335.
Problem
The replay check logs a route as unchecked when no recording has an element at a path (#334).
arrayOf.checkmarked a path as filled as soon as the array was not empty, and then skipped each null element. The scrub turns an all-null array into[null]. So a route whose recordings held only null elements passed with no unchecked line, and no element shape was checked.Change
conformance/replay_test.go:arrayOf.checkadds a path tofilledonly when it checked a non-null element there. Otherwise it adds the path toempty. An empty array and an all-null array now take the same path.TestCheckShapehas two new cases:[null, null]and a nested array of only nulls.TestCaseProblemsEmptyArrayshas two new cases: a[null]recording alone (unchecked line logged) and next to a recording with an element (no line).conformance/README.md: the empty-array rule now names arrays that hold onlynull.No command and no CLI output change, so the CHANGELOG does not change.
Verification
make fmt-check,make lint,go vet -tags e2e ./...,make test,make conformance.arrayOf.checkofmainand the new tests,TestCheckShapefails on both new cases andTestCaseProblemsEmptyArraysfails on the[null]case.[null], scrubbed withconformance/cmd/scruband replayed with the command of the e2e replay step. Onmainthe run prints onlyPASSandok. On this branch it also prints the unchecked line forGET connectapi.garmin.com/course-service/course/favoritesat(body)from both tests.-vand logs no unchecked line, the same as onmain.