Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Fix create resubmit test #662

Merged
merged 1 commit into from
Jun 11, 2024
Merged

✅ Fix create resubmit test #662

merged 1 commit into from
Jun 11, 2024

Conversation

alecgibson
Copy link
Collaborator

One of our tests currently checks resubmitting a create op after reconnecting during submission.

However, since reconnection happens so quickly, this test case can cause two commit attempts in parallel.

We currently only wait for the first request to resolve, which means that the second request can continue into the next test, causing unexpected test failures.

This change waits for both acks to be sent before finishing the test.

One of our tests currently checks resubmitting a create op after
reconnecting during submission.

However, since reconnection happens so quickly, this test case can cause
two commit attempts in parallel.

We currently only wait for the first request to resolve, which means
that the second request can continue into the next test, causing
unexpected test failures.

This change waits for both acks to be sent before finishing the test.
@coveralls
Copy link

Coverage Status

coverage: 97.445%. remained the same
when pulling 75b2a14 on create-test-fix
into 7abe650 on master.

@alecgibson
Copy link
Collaborator Author

This is an example error of the failing test:

  1) db
       client submit
         create
           metadata enabled
             does not fail when resubmitting a create op on a doc that was deleted:
     Error: Op submit failed. DB missing ops needed to transform it up to the current snapshot version
      at wrapErrorData (/home/runner/work/sharedb/sharedb/lib/client/connection.js:268:13)
      at Connection.handleMessage (/home/runner/work/sharedb/sharedb/lib/client/connection.js:194:11)
      at socket.onmessage (/home/runner/work/sharedb/sharedb/lib/client/connection.js:145:18)
      at /home/runner/work/sharedb/sharedb/lib/stream-socket.js:59:12
      at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

Copy link
Contributor

@ericyhwang ericyhwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion, we should separately consider doing a db.close() in sharedb-mongo afterEach for these test cases imported from core, as that may help with these kinds of issues in general.

https://github.com/share/sharedb-mongo/blob/d48f2c7858a8a3353b1ac0628d17109b41bfcd1d/test/test_mongo.js#L9-L21

@alecgibson alecgibson merged commit 3cdecf4 into master Jun 11, 2024
8 checks passed
@alecgibson alecgibson deleted the create-test-fix branch June 11, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants