Skip to content

Commit

Permalink
Merge pull request #77 from canonical/remove-scripts
Browse files Browse the repository at this point in the history
Remove scripts
  • Loading branch information
PietroPasotti authored Nov 20, 2023
2 parents 31ab9dd + b2fd95d commit 7a4e2cb
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 1,394 deletions.
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,25 +1283,10 @@ If you have a clear false negative, are explicitly testing 'edge', inconsistent
checker is in your way, you can set the `SCENARIO_SKIP_CONSISTENCY_CHECKS` envvar and skip it altogether. Hopefully you
don't need that.

# Snapshot
# Jhack integrations

Scenario comes with a cli tool called `snapshot`. Assuming you've pip-installed `ops-scenario`, you should be able to
reach the entry point by typing `scenario snapshot` in a shell so long as the install dir is in your `PATH`.
Up until `v5.6.0`, `scenario` shipped with a cli tool called `snapshot`, used to interact with a live charm's state.
The functionality [has been moved over to `jhack`](https://github.com/PietroPasotti/jhack/pull/111),
to allow us to keep working on it independently, and to streamline
the profile of `scenario` itself as it becomes more broadly adopted and ready for widespread usage.

Snapshot's purpose is to gather the `State` data structure from a real, live charm running in some cloud your local juju
client has access to. This is handy in case:

- you want to write a test about the state the charm you're developing is currently in
- your charm is bork or in some inconsistent state, and you want to write a test to check the charm will handle it
correctly the next time around (aka regression testing)
- you are new to Scenario and want to quickly get started with a real-life example.

Suppose you have a Juju model with a `prometheus-k8s` unit deployed as `prometheus-k8s/0`. If you type
`scenario snapshot prometheus-k8s/0`, you will get a printout of the State object. Pipe that out into some file, import
all you need from `scenario`, and you have a working `State` that you can `Context.run` events with.

You can also pass a `--format` flag to obtain instead:

- a jsonified `State` data structure, for portability
- a full-fledged pytest test case (with imports and all), where you only have to fill in the charm type and the event
that you wish to trigger.
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ops-scenario"

version = "5.6.2"
version = "5.7"

authors = [
{ name = "Pietro Pasotti", email = "[email protected]" }
Expand Down Expand Up @@ -39,8 +39,6 @@ classifiers = [
"Homepage" = "https://github.com/canonical/ops-scenario"
"Bug Tracker" = "https://github.com/canonical/ops-scenario/issues"

[project.scripts]
scenario = "scenario.scripts.main:main"

[tool.setuptools.package-dir]
scenario = "scenario"
Expand Down
17 changes: 0 additions & 17 deletions scenario/scripts/errors.py

This file was deleted.

17 changes: 0 additions & 17 deletions scenario/scripts/logger.py

This file was deleted.

57 changes: 0 additions & 57 deletions scenario/scripts/main.py

This file was deleted.

Loading

0 comments on commit 7a4e2cb

Please sign in to comment.