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

Add more tests for workflow_mgr #161

Merged
merged 8 commits into from
Oct 29, 2020

Conversation

kinow
Copy link
Member

@kinow kinow commented Oct 15, 2020

This is a small change with no associated Issue.

Similar to #160 , but adding more tests for workflow_mgr. Still trying to understand how its methods work, quite interesting. Found already one pydoc error. So if I cannot understand how to write tests, at least this PR will fix that pydoc 😅

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Appropriate tests are included (unit and/or functional).
  • No change log entry required (why? e.g. invisible to users).
  • No documentation update required.
  • No dependency changes.

@kinow kinow self-assigned this Oct 15, 2020
@kinow kinow added this to the 0.3 milestone Oct 15, 2020
@codecov-io
Copy link

codecov-io commented Oct 15, 2020

Codecov Report

Merging #161 into master will increase coverage by 15.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #161       +/-   ##
===========================================
+ Coverage   58.95%   73.95%   +15.00%     
===========================================
  Files           6        6               
  Lines         480      480               
  Branches       79       79               
===========================================
+ Hits          283      355       +72     
+ Misses        192      108       -84     
- Partials        5       17       +12     
Impacted Files Coverage Δ
cylc/uiserver/workflows_mgr.py 90.90% <ø> (+20.97%) ⬆️
cylc/uiserver/data_store_mgr.py 63.52% <0.00%> (+26.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01988bb...333b64a. Read the comment docs.

@kinow kinow marked this pull request as ready for review October 16, 2020 02:36
@kinow kinow requested review from oliver-sanders and dwsutherland and removed request for oliver-sanders October 16, 2020 02:36
@kinow
Copy link
Member Author

kinow commented Oct 16, 2020

I think this was more of an exercise to understand the state changes in the UI Server. When writing tests, I normally focus on the public API, which might have played against me here (still influenced by Java 😬 ).

To test the private functions, I tried to trigger the right state changes in .update, which will call _workflow_state_changes to compute the next states based on the active, inactive, and what came out of the "pipes".

I tried using fixtures, and avoiding duplication as much as possible, though there might be some better way of writing these tests and reduce even more the amount of code written for tests.

Happy to take any feedback and improve it. Should improve a bit our coverage prior to the next release 👍

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

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

Nice.

Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

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

Looks good, tests passing 👍

@dwsutherland dwsutherland merged commit 338b973 into cylc:master Oct 29, 2020
@kinow kinow deleted the more-tests-workflow-mgr branch October 29, 2020 04:25
@oliver-sanders oliver-sanders mentioned this pull request Feb 18, 2021
8 tasks
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.

4 participants