2 Copyright 2019 Canonical Ltd.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
21 ## Environment variables
23 The test currently requires some environment variables set in order to run, but these will be deprecated as soon as possible.
27 LXD should be installed via snap.
29 The connection to the LXD API server expects to use a self-signed SSL certificate, generated by lxc (`lxc list`, et al) is first one.
33 Juju is expected to be installed via snap and bootstrapped.
35 Run `juju status -m controller` and capture the IP address of machine 0. This is the Juju controller, specified in VCA_HOST
37 export VCA_HOST=1.2.3.4
39 export VCA_SECRET=admin
40 export VCA_CACERT=$(juju controllers --format json | jq -r '.controllers["osm"]["ca-cert"]'| base64 | tr -d \\n)
41 export VCA_PUBLIC_KEY=$(cat ~/.local/share/juju/ssh/juju_id_rsa.pub)
45 Tests are written with pytest, driven by tox. All tests are run from the root directory of the repository.
49 To run a single integration test, we tell tox which environment we need, and then the path to the test.
52 tox -e integration -- tests/integration/test_non-string_parameter.py
57 `make test` will invoke tox to run all unit tests. Alternatively, you can limit this to a specific type of test by invoking tox manually:
59 tox -e integration -- tests/integration/
63 - Update CI environment to have Juju and LXD available via snap
64 - Investigate running via Docker
65 - Remove the requirement for setting environment variables
66 - Integrate into Jenkins so that tests run against every commit
67 - Add global timeout to abort tests that are hung
68 - Only build a charm once per test run, i.e., if two or more tests use the same charm, we should only call `charm build` once.