Wait after resetting config in example charm integration tests?

Open
#2,947 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
testing

Research direction

Read the integration tests in examples/machine-tinyproxy/tests/integration/test_charm.py and examples/httpbin-demo/tests/integration/test_charm.py, especially the config reset and juju.wait() calls. Decide whether to add a wait in both examples; done means the tutorial’s claim about the charm returning to an unblocked state is accurate, and the tests reflect the decision.

Written by the indexing model from the issue text.

Description

docs rainy day

The final machine-tinyproxy integration test resets config:

https://github.com/canonical/operator/blob/cbe523b916ab9a68931f154eb2b247e84f821d15/examples/machine-tinyproxy/tests/integration/test_charm.py#L43-L47

In the tutorial we say:

[This is to] ensure that any subsequent test could assume an unblocked charm.

But that's not entirely accurate. We don't wait for the charm to go active again, so a (hypothetical) next test ought not to assume an unblocked charm.

I think we copied the approach from httpbin-demo:

https://github.com/canonical/operator/blob/cbe523b916ab9a68931f154eb2b247e84f821d15/examples/httpbin-demo/tests/integration/test_charm.py#L47-L52

When I wrote the machine charm tutorial, I incorrectly positioned the reset as a guarantee.

This needs a decision before a PR: Is it worth adding one more juju.wait() (in both charms) for the benefit of a test that doesn't exist? I lean towards yes, for the teaching value of the tutorial.

Dominant language
Python
Stars
267
Forks
156
Avg merge
5d 3h
Merged PRs (30d)
43

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from canonical/operator

All issues in canonical/operator

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.