2 Copyright 2020 Canonical Ltd.
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software
8 distributed under the License is distributed on an "AS IS" BASIS,
9 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 See the License for the specific language governing permissions and
11 limitations under the License. -->
19 The tests of this charm are done using tox and Zaza.
23 ### Prepare environment
25 The machine in which the tests are run needs access to a juju k8s controller. The easiest way to approach this is by executing the following commands:
28 sudo apt install tox -y
29 sudo snap install microk8s --classic
30 sudo snap install juju
32 microk8s.status --wait-ready
33 microk8s.enable storage dashboard dns
35 juju bootstrap microk8s k8s-cloud
38 If /usr/bin/python does not exist, you should probably need to do this:
41 sudo ln -s /usr/bin/python3 /usr/bin/python
46 **Download dependencies:**
49 mkdir -p ~/charm/layers ~/charm/build ~/charm/interfaces
50 git clone --single-branch --branch master https://git.launchpad.net/canonical-osm ~/canonical-osm
53 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-ui ui-k8s
54 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-grafana grafana-k8s
55 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-prometheus prometheus-k8s
56 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-mariadb mariadb-k8s
57 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-lcm lcm-k8s
58 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-mon mon-k8s
59 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-nbi nbi-k8s
60 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-pol pol-k8s
61 git clone --single-branch --branch=master https://git.launchpad.net/charm-osm-ro ro-k8s
62 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-keystone keystone-k8s
63 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-kafka kafka-k8s ~/charm/interfaces
64 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-zookeeper zookeeper-k8s
65 git clone --single-branch --branch=master https://git.launchpad.net/charm-k8s-mongodb mongodb-k8s
68 mv ~/canonical-osm/charms/interfaces/* .
69 git clone https://git.launchpad.net/interface-mongodb mongodb
70 git clone https://git.launchpad.net/interface-osm-mon mon
71 git clone https://git.launchpad.net/interface-osm-nbi osm-nbi
72 git clone https://git.launchpad.net/interface-osm-ro osm-ro
84 │ ├── spec_template.yaml
90 **Setup environment variables:**
93 export CHARM_LAYERS_DIR=~/charm/layers
94 export CHARM_BUILD_DIR=~/charm/build
95 export CHARM_INTERFACES_DIR=~/charm/interfaces
101 mkdir ~/charm/layers/ui-k8s/tests/build
102 export https_proxy=\$PROXY
103 charm build ~/charm/layers/ui-k8s
104 charm build ~/charm/layers/grafana-k8s
105 charm build ~/charm/layers/prometheus-k8s
106 charm build ~/charm/layers/mariadb-k8s
107 charm build ~/charm/layers/lcm-k8s
108 charm build ~/charm/layers/mon-k8s
109 charm build ~/charm/layers/nbi-k8s
110 charm build ~/charm/layers/pol-k8s
111 charm build ~/charm/layers/ro-k8s
112 charm build ~/charm/layers/keystone-k8s
113 charm build ~/charm/layers/kafka-k8s
114 charm build ~/charm/layers/zookeeper-k8s
115 charm build ~/charm/layers/mongodb-k8s
116 mv ~/charm/build/* ~/charm/layers/ui-k8s/tests/build/