question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make test helpers for simulating common scenarios

See original GitHub issue

We already have harness.begin_with_initial_hooks() which simulates a “normal” sequence of bootup events for a charm in testing. But there are other important sequences of hooks/state-change that are important for charms to support - e.g. is container.can_connect true or false (#691), relation join events coming in different orders, when does pebble-ready fire w.r.t. install, etc. This could also be potentially related to a medium+ term solution for resolving other issues such as #678 and https://github.com/canonical/operator/issues/456.

It should be possible to come up with a nice, extensible way to allow charmdevs to select one or more options from a grab-bag of event/state sequence scenarios, tweak them to their own liking and fire them off just like begin_with_initial_hooks.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
PietroPasotticommented, Feb 18, 2022

I based that suggestion on the fact that begin_with_initial_hooks at the moment has a bunch of random.shuffle()s in place to discourage the harness user from relying on the event ordering; although if you ask me this might lead to unpredictable and hard-to-debug failures if there is in fact some bug in the charm. So I’m in favour of removing that.

0reactions
PietroPasotticommented, Mar 9, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create Test Scenarios with Examples - BrowserStack
Learn about Test Scenarios with help of examples. Read test scenario definition, necessity, best practices, & also difference between test ...
Read more >
near-examples/simulation-testing: Demonstration of ... - GitHub
This mean that, unlike unit tests, projects must be built before they can be tested. (Built meaning the typical cargo build… command with...
Read more >
9 Using Modeling and Simulation in Test Design and Evaluation
This sort of exercise is typical of a developmental test. A constructive simulation is ... Second, simulation models can help select scenarios for...
Read more >
Testing Helpers — Falcon 3.1.1 documentation
In order to simulate multiple interleaved requests, or to test a streaming endpoint (such as one that emits server-sent events), ASGIConductor can be...
Read more >
Random-generated tests using a simulated environment
Automated testing relies on executing multiple predefined scenarios each time a part of the base code has been changed, and always getting the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found