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

Write integration tests against lineage #4306

Closed
SCdF opened this issue Mar 19, 2018 · 7 comments
Closed

Write integration tests against lineage #4306

SCdF opened this issue Mar 19, 2018 · 7 comments
Assignees
Labels
Priority: 1 - High Blocks the next release. Testing Affects how the code is tested Type: Technical issue Improve something that users won't notice
Projects

Comments

@SCdF
Copy link
Contributor

SCdF commented Mar 19, 2018

Looking at a lot of the current unit tests for lineage, I'm not convinced they test what they say they are testing. In general these tests are very complicated as they require correctly mocking multiple ordered DB calls. For complete correctness they should also validate that the calls are actually the right ones (ie the query provides the right params), which no / few tests do. For this reason it's also really hard to write new tests, because you have to walk the whole codebase and work out what to mock and when.

We need to be able to write integration tests for lineage. This is only complex because lineage relies on the ddocs existing:

  • Work out how to get the current ddocs in testing. This could be as simple as the tests actually understanding where they are in the file hierarchy and calling the code that generates the ddocs (once kanso is removed), and taking the resulting files off the fs and uploading them to a local PouchDB. This sounds gross, but is OK because testing!
  • The just write mocha tests that don't mock anything, and use a local PouchDB (in-memory is fine, or write to disk)

This would actually prove the code is working, as well as making sure if we ever change these views the code continues to work against them.

@SCdF SCdF added Type: Bug Fix something that isn't working as intended Status: 1 - Triaged Type: Technical issue Improve something that users won't notice Priority: 1 - High Blocks the next release. Testing Affects how the code is tested labels Mar 19, 2018
@SCdF SCdF added this to To do in 3.0.0 via automation Mar 19, 2018
@SCdF SCdF added the Status: Blocked Unable to progress this. label Mar 19, 2018
@SCdF
Copy link
Contributor Author

SCdF commented Mar 19, 2018

Blocked on #3019. Once we have gotten rid of kanso I'm happy to take a crack at this.

@rmhowe
Copy link
Contributor

rmhowe commented Apr 5, 2018

This should include a test for #4366 (ticket was completed while the tests were still in a broken state)

@rmhowe rmhowe self-assigned this Apr 9, 2018
@alxndrsn alxndrsn removed the Status: Blocked Unable to progress this. label Apr 16, 2018
@alxndrsn
Copy link
Contributor

Kanso has been removed, so this ticket is ready to be worked on.

@rmhowe rmhowe moved this from To do to In progress in 3.0.0 Apr 23, 2018
@garethbowen garethbowen removed the Type: Bug Fix something that isn't working as intended label May 6, 2018
@garethbowen
Copy link
Member

We also need to add a test to ensure #4523 doesn't affect master but the unit testing is currently broken. @rmhowe Could you please convert the test in this commit into an integration test as part of this work?

@rmhowe
Copy link
Contributor

rmhowe commented May 17, 2018

@garethbowen I added the test (which required some code changes) here e1833b3, this should hopefully be made redundant by this PR #4557

rmhowe added a commit that referenced this issue May 23, 2018
Refactors lineage tests to include integration tests using
an in-memory pouchdb instance (added here as memdown-medic)
and unit tests

#4306
@rmhowe rmhowe removed their assignment May 23, 2018
@rmhowe rmhowe moved this from In progress to Acceptance testing in 3.0.0 May 23, 2018
@ngaruko
Copy link
Contributor

ngaruko commented Jun 6, 2018

I assume these are unit and integration tests and the issue does not need AT-ing @SCdF ?

@rmhowe
Copy link
Contributor

rmhowe commented Jun 6, 2018

@ngaruko yep sorry I just put it in AT because I wasn't sure what the process was, as long as the tests are passing (ie the build is passing, which it is) then I think it's all good

@ngaruko ngaruko self-assigned this Jun 6, 2018
@ngaruko ngaruko closed this as completed Jun 6, 2018
3.0.0 automation moved this from Acceptance testing to Done Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 1 - High Blocks the next release. Testing Affects how the code is tested Type: Technical issue Improve something that users won't notice
Projects
No open projects
3.0.0
  
Done
Development

No branches or pull requests

5 participants