56380a4be30575ba45169528a6689cbc0c4406a0
[osm/N2VC.git] / tests / README.md
1 # N2VC Testing
2
3
4 # Preparation
5 ## Environment variables
6
7 The test currently requires some environment variables set in order to run, but these will be deprecated as soon as possible.
8
9 ## LXD
10
11 LXD should be installed via snap.
12
13 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.
14
15 ## Juju
16
17 Juju is expected to be installed via snap and bootstrapped.
18
19 Run `juju status -m controller` and capture the IP address of machine 0. This is the Juju controller, specified in VCA_HOST
20
21 export VCA_HOST=1.2.3.4
22 export VCA_USER=admin
23 export VCA_SECRET=admin
24
25
26 # Running tests
27
28 Tests are written with pytest, driven by tox. All tests are run from the root directory of the repository.
29
30 ## Run one test
31
32 To run a single integration test, we tell tox which environment we need, and then the path to the test.
33
34 ```bash
35 tox -e integration -- tests/integration/test_non-string_parameter.py
36 ```
37
38 ## Running all tests
39
40 `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:
41 ```bash
42 tox -e integration -- tests/integration/
43 ```
44
45 # TODO
46 - Update CI environment to have Juju and LXD available via snap
47 - Investigate running via Docker
48 - Remove the requirement for setting environment variables
49 - Integrate into Jenkins so that tests run against every commit
50 - Add global timeout to abort tests that are hung
51 - 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.