Fix 1015. Remove non used paramiko dependencies at k8s_helm_conn
[osm/N2VC.git] / tests / README.md
1 <!--
2  Copyright 2019 Canonical Ltd.
3
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
7
8      http://www.apache.org/licenses/LICENSE-2.0
9
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.
15 -->
16
17 # N2VC Testing
18
19
20 # Preparation
21 ## Environment variables
22
23 The test currently requires some environment variables set in order to run, but these will be deprecated as soon as possible.
24
25 ## LXD
26
27 LXD should be installed via snap.
28
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.
30
31 ## Juju
32
33 Juju is expected to be installed via snap and bootstrapped.
34
35 Run `juju status -m controller` and capture the IP address of machine 0. This is the Juju controller, specified in VCA_HOST
36
37 export VCA_HOST=1.2.3.4
38 export VCA_USER=admin
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)
42
43 # Running tests
44
45 Tests are written with pytest, driven by tox. All tests are run from the root directory of the repository.
46
47 ## Run one test
48
49 To run a single integration test, we tell tox which environment we need, and then the path to the test.
50
51 ```bash
52 tox -e integration -- tests/integration/test_non-string_parameter.py
53 ```
54
55 ## Running all tests
56
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:
58 ```bash
59 tox -e integration -- tests/integration/
60 ```
61
62 # TODO
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.