Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a concept of "time function" to mite. This is a function that is run in the controller alongside the main controller logic. It receives two
asyncio.Event
objects: one which it can use to gate the start of the test, and one it can use to listen for the end of the test. We are able to port the previously added "logging webhook" feature to be a generic time function. We have other use cases in our private testing code as well. One is at https://github.com/sky-uk/id-mite-nft/blob/8e8f8e10672d0903aceb253d81dd600fe8a65390/mite_id/ims/journeys.py#L200 (where we purge rabbit queues at the start of a test; currently we just use the beginning of the scenario function for this) and for our upcoming chaos testing deliverables (where we want to run not only at the beginning of the test, but during it as well).Main changes:
time_function
to the mite top-level module. When applied to a scenario function, it marks the scenario to be used with the time function.lib/logging_webhook.py
)asyncio.Event
sequencing)Consequent changes:
mite/__init__.py
: add underscore prefixes to private names__main__.py
to a new filecli/controller.py
ScenarioManager
to know the spec of the scenario it represents.Controller
objects no longer need to know this; they can read it from their ScenarioManager.mite controller
andmite (journey|scenario) test
CLI commands to use the same code path. This allows changes like this one introducing time functions to be made in only one place, rather than two.Outstanding tasks: