You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: testing/README.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ Comparing scenario tests with `Harness` tests:
66
66
A scenario test consists of three broad steps:
67
67
68
68
-**Arrange**:
69
-
- declare the context
69
+
- declare the context
70
70
- declare the input state
71
71
- select an event to fire
72
72
-**Act**:
@@ -173,7 +173,7 @@ def test_statuses():
173
173
scenario.WaitingStatus('checking this is right...'),
174
174
]
175
175
assert out.unit_status == scenario.ActiveStatus("I am ruled")
176
-
176
+
177
177
# similarly you can check the app status history:
178
178
assert ctx.app_status_history == [
179
179
scenario.UnknownStatus(),
@@ -241,7 +241,7 @@ def test_foo():
241
241
242
242
You can configure what events will be captured by passing the following arguments to `Context`:
243
243
-`capture_deferred_events`: If you want to include re-emitted deferred events.
244
-
-`capture_framework_events`: If you want to include framework events (`pre-commit`, `commit`, and `collect-status`).
244
+
-`capture_framework_events`: If you want to include framework events (`pre-commit`, `commit`, and `collect-status`).
245
245
246
246
For example:
247
247
```python
@@ -360,10 +360,10 @@ ctx.run(ctx.on.start(), state_in) # invalid: this unit's id cannot be the ID of
360
360
361
361
To declare a subordinate relation, you should use `scenario.SubordinateRelation`. The core difference with regular
362
362
relations is that subordinate relations always have exactly one remote unit (there is always exactly one remote unit
363
-
that this unit can see).
363
+
that this unit can see).
364
364
Because of that, `SubordinateRelation`, compared to `Relation`, always talks in terms of `remote`:
365
365
366
-
-`Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` taking a single `Dict[str:str]`. The remote unit ID can be provided as a separate argument.
366
+
-`Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` taking a single `Dict[str:str]`. The remote unit ID can be provided as a separate argument.
367
367
-`Relation.remote_unit_ids` becomes `SubordinateRelation.remote_unit_id` (a single ID instead of a list of IDs)
368
368
-`Relation.remote_units_data` becomes `SubordinateRelation.remote_unit_data` (a single databag instead of a mapping from unit IDs to databags)
Simplifying a bit the Juju "spaces" model, each integration endpoint a charm defines in its metadata is associated with a network. Regardless of whether there is a living relation over that endpoint, that is.
417
+
Simplifying a bit the Juju "spaces" model, each integration endpoint a charm defines in its metadata is associated with a network. Regardless of whether there is a living relation over that endpoint, that is.
418
418
419
419
If your charm has a relation `"foo"` (defined in its metadata), then the charm will be able at runtime to do `self.model.get_binding("foo").network`.
420
-
The network you'll get by doing so is heavily defaulted (see `state.Network`) and good for most use-cases because the charm should typically not be concerned about what IP it gets.
420
+
The network you'll get by doing so is heavily defaulted (see `state.Network`) and good for most use-cases because the charm should typically not be concerned about what IP it gets.
421
421
422
422
On top of the relation-provided network bindings, a charm can also define some `extra-bindings` in its metadata and access them at runtime. Note that this is a deprecated feature that should not be relied upon. For completeness, we support it in Scenario.
423
423
@@ -540,7 +540,7 @@ def test_pebble_push():
540
540
MyCharm,
541
541
meta={"name": "foo", "containers": {"foo": {}}}
542
542
)
543
-
543
+
544
544
ctx.run(ctx.on.start(), state_in)
545
545
546
546
# This is the root of the simulated container filesystem. Any mounts will be symlinks in it.
Since `ops 2.6.0`, charms can invoke the `open-port`, `close-port`, and `opened-ports` hook tools to manage the ports opened on the host VM/container. Using the `State.opened_ports` API, you can:
727
+
Since `ops 2.6.0`, charms can invoke the `open-port`, `close-port`, and `opened-ports` hook tools to manage the ports opened on the host VM/container. Using the `State.opened_ports` API, you can:
728
728
729
729
- simulate a charm run with a port opened by some previous execution
0 commit comments