getodk / getodk/central

Order client audit log entries consistently in export

Open
#1,243 8 comments 0 reactions 1 assignee Claimed by @matthew-white View on GitHub
backend
Dominant language
JavaScript
Stars
226
Forks
235
Avg merge
2d 22h
Merged PRs (30d)
19

Description

The following test fails infrequently. I've seen this failure locally, and it's also been seen on CircleCI:

```
1) api: /forms/:id/submissions
.csv.zip GET
should return worker-processed consolidated client audit log attachments:

AssertionError: expected 'instance ID,event,node,start,end,latitude,longitude,accuracy,old-value,new-value\none,e,/data/e,2000-01-01T00:11,,,,,hh,ii\none,d,/data/d,2000-01-01T00:10,,10,11,12,gg,\none,c,/data/c,2000-01-01T00:03,2000-01-01T00:04,7,8,9,ee,ff\none,b,/data/b,2000-01-01T00:02,2000-01-01T00:03,4,5,6,cc,dd\none,a,/data/a,2000-01-01T00:01,2000-01-01T00:02,1,2,3,aa,bb\ntwo,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff\ntwo,g,/data/g,2000-01-01T00:05,2000-01-01T00:06,-3,-4,,cc,dd\ntwo,f,/data/f,2000-01-01T00:04,2000-01-01T00:05,-1,-2,,aa,bb\n' to be 'instance ID,event,node,start,end,latitude,longitude,accuracy,old-value,new-value\none,a,/data/a,2000-01-01T00:01,2000-01-01T00:02,1,2,3,aa,bb\none,b,/data/b,2000-01-01T00:02,2000-01-01T00:03,4,5,6,cc,dd\none,c,/data/c,2000-01-01T00:03,2000-01-01T00:04,7,8,9,ee,ff\none,d,/data/d,2000-01-01T00:10,,10,11,12,gg,\none,e,/data/e,2000-01-01T00:11,,,,,hh,ii\ntwo,f,/data/f,2000-01-01T00:04,2000-01-01T00:05,-1,-2,,aa,bb\ntwo,g,/data/g,2000-01-01T00:05,2000-01-01T00:06,-3,-4,,cc,dd\ntwo,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff\n'
+ expected - actual

instance ID,event,node,start,end,latitude,longitude,accuracy,old-value,new-value
+one,a,/data/a,2000-01-01T00:01,2000-01-01T00:02,1,2,3,aa,bb
+one,b,/data/b,2000-01-01T00:02,2000-01-01T00:03,4,5,6,cc,dd
+one,c,/data/c,2000-01-01T00:03,2000-01-01T00:04,7,8,9,ee,ff
+one,d,/data/d,2000-01-01T00:10,,10,11,12,gg,
one,e,/data/e,2000-01-01T00:11,,,,,hh,ii
-one,d,/data/d,2000-01-01T00:10,,10,11,12,gg,
-one,c,/data/c,2000-01-01T00:03,2000-01-01T00:04,7,8,9,ee,ff
-one,b,/data/b,2000-01-01T00:02,2000-01-01T00:03,4,5,6,cc,dd
-one,a,/data/a,2000-01-01T00:01,2000-01-01T00:02,1,2,3,aa,bb
+two,f,/data/f,2000-01-01T00:04,2000-01-01T00:05,-1,-2,,aa,bb
+two,g,/data/g,2000-01-01T00:05,2000-01-01T00:06,-3,-4,,cc,dd
two,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff
-two,g,/data/g,2000-01-01T00:05,2000-01-01T00:06,-3,-4,,cc,dd
-two,f,/data/f,2000-01-01T00:04,2000-01-01T00:05,-1,-2,,aa,bb

at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at test/integration/api/submissions.js:1799:51
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.transaction (node_modules/slonik/dist/src/connectionMethods/transaction.js:22:24)
at async Object.createConnection (node_modules/slonik/dist/src/factories/createConnection.js:96:18)
```

I ran `make test` on CircleCI [200 times](https://github.com/getodk/central-backend/issues/588#issuecomment-1235669602), and this error came up just once (in [this](https://app.circleci.com/pipelines/github/getodk/central-backend/943/workflows/223477a5-ee43-4c3a-8964-1e37893a206a/jobs/1696/artifacts) build). The test failure is infrequent, but since it's been seen on a variety of machines, I thought I'd go ahead and file an issue. I think it's interesting that it only seems to be this test that has this ordering issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.