docs: in integration tests, use consistent approach to logging and packing#2150
docs: in integration tests, use consistent approach to logging and packing#2150dwilding merged 6 commits intocanonical:mainfrom
Conversation
james-garner-canonical
left a comment
There was a problem hiding this comment.
Some small suggestions, but looks good to me overall -- and we'll need to update this next cycle when we work on pytest-jubilant anyway.
| CHARM_PATH=/path/to/foo.charm tox -e integration | ||
| ``` | ||
|
|
||
| Your tests will use the context of the current controller in Juju, and by default will create a new model per module, that will be destroyed when the test is finished. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. |
There was a problem hiding this comment.
| Your tests will use the context of the current controller in Juju, and by default will create a new model per module, that will be destroyed when the test is finished. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. | |
| Your tests will use the context of the current controller in Juju. By default a new model is created for each test module, that will be destroyed when the test is finished -- this is determined by the scope of the `juju` fixture. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model`. |
There was a problem hiding this comment.
Building on James's:
| Your tests will use the context of the current controller in Juju, and by default will create a new model per module, that will be destroyed when the test is finished. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. | |
| Your tests will use the current Juju controller. By default a new model will be created for each test module, which will be destroyed when the test is finished -- this is determined by the scope of the `juju` fixture. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. |
There was a problem hiding this comment.
Good suggestions, thanks. I adjusted slightly for readability, as I feel the sentence about parameters fits better with the following paragraph. Here's what I've gone with:
Your tests will use the current Juju controller. By default, a new model will be created for each test module. The model will be destroyed when the test is finished. This is determined by the scope of the
jujufixture.Use the
--cloud,--controller, and--modelparameters to specify the cloud, controller, and model name. If you specify the model name and include the--keep-modelsparameter, you can reuse a model from a previous test run. For example:
There was a problem hiding this comment.
Just noticed that 'the model will be destroyed when the test is finished' is a bit inaccurate, since it's not till the module of tests has finished
tonyandrewmeyer
left a comment
There was a problem hiding this comment.
Thanks for doing this. Looks good to me, just a small suggestion building on one from James.
| CHARM_PATH=/path/to/foo.charm tox -e integration | ||
| ``` | ||
|
|
||
| Your tests will use the context of the current controller in Juju, and by default will create a new model per module, that will be destroyed when the test is finished. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. |
There was a problem hiding this comment.
Building on James's:
| Your tests will use the context of the current controller in Juju, and by default will create a new model per module, that will be destroyed when the test is finished. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. | |
| Your tests will use the current Juju controller. By default a new model will be created for each test module, which will be destroyed when the test is finished -- this is determined by the scope of the `juju` fixture. The cloud, controller and model name can be specified with the parameters `--cloud`, `--controller` and `--model` parameters. |
…oyed after module (#2154) This PR fixes a misleading statement after I merged #2150. **[Preview doc](https://canonical-ubuntu-documentation-library--2154.com.readthedocs.build/ops/2154/howto/write-integration-tests-for-a-charm/#run-your-tests)**
This PR updates How to write integration tests for a charm and the httpbin-demo charm to be consistent with the Charmcraft 4 profiles and our new machine tutorial:
How to write integration tests for a charm
sleepto wait for Juju to process logs, then output the logs tostderr.conftest.pyto check theCHARM_PATHenvironment variable instead of packing the charm..charmfile to deploy in the tests.charmfixture, for a better failure experience if there's no.charmfile available.Preview of updated doc
httpbin-demo charm - Use
sleepto wait for Juju to process logs, then output the logs tostderr.I haven't updated the integration tests in the Kubernetes charm tutorial. We plan to switch the tutorial to use the Charmcraft 4 profile at a later date.