Harness provides no means to test ops.model.Application.planned_units()
See original GitHub issueThe test harness provides no means to test what happens when a charm is scaled up or down and its logic relies on ops.model.Application.planned_units()
. This could be addressed via a ops.testing.Harness.set_planned_unit(<int>)
handle and, to my understanding, should fire a config_change
event.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
ops.testing - The Operator Framework documentation
[docs]class Harness(Generic[CharmType]): """This class represents a way to build up the model that will drive a test suite.
Read more >app.planned_units does not filter dying units #807 - GitHub
The problem with the above > 0 check is that app.planned_units currently does not filter out dying units. operator/ops/model.py.
Read more >What is Test Harness and How is it Applicable to Us, Testers
In software testing, a test harness or automated test framework is a collection of software and test data configured to test a program...
Read more >What is Test Harness? (Examples) - Guru99
Test harness executes tests by using a test library and generates test reports. Test harness contains all the information needed to compile and ......
Read more >Harness Key Concepts - Harness.io Docs
Where Does Harness Fit In? · Visual Summary · Harness Architecture. The Harness Delegate is the First Step · Platform and Tool Integration....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the discussion here.
I think that I have a better idea of some of the historical intent in the harness code, and I’m more on board with letting folks directly set planned_units, rather than forcing them to add a peer.
I can work on putting together a PR addressing this. Though I think that, as noted above, @mmanciop’s use case probably does need to be addressed by adding a peer relation, as the most consistent (and correct, I think) way of a charm getting information about its peers.
I would probably just add
testing.Harness.set_planned_units(N)
and not try to abstract through goal-state. Yes it happens to be implemented that way, but if we can change the response fromget_planned_units()
rather than having a charm author go via a deprecated interaction. (We may have to have set_planned_units generate a fake goal-state response, but I would want that hidden underneath Harness and not exposed to the charmer)At present juju doesn’t generate an event when goal state changes (one of its many failings), so there isn’t an equivalent event for the framework to generate. But at the very least having Harness.set_planned_units() would let charmers test their logic around what the number of units they expect to see, and how many units show up from add_relation_unit.
On Wed, Oct 20, 2021 at 9:09 AM Pete Vander Giessen < @.***> wrote: