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

chore: do not run Couch container for unit tests #639

Merged
merged 4 commits into from
Oct 10, 2024
Merged

Conversation

jkuester
Copy link
Contributor

@jkuester jkuester commented Oct 9, 2024

Description

Currently, the cht-conf unit tests spin up a Couch docker container before the tests run and then tear it down at the end. It turns out that Couch instance was only being used in 2 test files:

  • The move-contacts.spec.js needed it originally. It could not use a local Pouch instance because of limit and skip view query options are ignored when keys are used, if the adapter is not http pouchdb/pouchdb#8370. However, that issue was fixed and our current Pouch version includes the fix! So, I have updated these tests to just use a local Pouch instance.
  • The newer session-token.spec.js was actually originally slotted as an "e2e" test, but we moved it to be an "integration" test when we added proper e2e tests. After digging into this more, it seems to me that this can just be a full e2e test. It technically does not need an entire CHT suite running, but since we are spinning one up anyway for the other e2e tests it is actually less work (and less code to maintain) if we just make it an e2e test.

Code review items

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or integration tests where appropriate
  • Backwards compatible: Works with existing data and configuration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently GitHub is not smart enough to realize that this is a modified version of the test/integration/session-token.spec.js file. I am afraid you will have to manually diff this to see what actually changed in the file....

(TLDR is that I was able to remove a lot of code.)

@jkuester jkuester requested a review from m5r October 9, 2024 22:52
@jkuester jkuester marked this pull request as ready for review October 9, 2024 22:52
test/e2e/cht-conf-utils.js Outdated Show resolved Hide resolved
test/e2e/edit-app-settings.spec.js Show resolved Hide resolved
test/e2e/session-token.spec.js Outdated Show resolved Hide resolved
test/fn/watch-project.spec.js Outdated Show resolved Hide resolved
@jkuester jkuester requested a review from m5r October 10, 2024 13:24
Copy link
Member

@m5r m5r left a comment

Choose a reason for hiding this comment

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

Perfect! Thanks for cleaning up those tests

@jkuester jkuester merged commit 72489e8 into main Oct 10, 2024
7 checks passed
@jkuester jkuester deleted the flaky-tests branch October 10, 2024 21:37
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.

2 participants