1 <!-- Copyright 2021 Canonical Ltd.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may
4 not use this file except in compliance with the License. You may obtain
5 a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 License for the specific language governing permissions and limitations
15 For those usages not covered by the Apache License, Version 2.0 please
16 contact: legal@canonical.com
18 To get in touch with the maintainers, please contact:
19 osm-charmers@lists.launchpad.net -->
28 The tests of this charm are done using tox and Zaza.
32 ### Prepare environment
34 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:
37 sudo apt install tox -y
38 sudo snap install microk8s --classic
39 sudo snap install juju
41 microk8s.status --wait-ready
42 microk8s.enable storage dashboard dns
44 juju bootstrap microk8s k8s-cloud
47 If /usr/bin/python does not exist, you should probably need to do this:
50 sudo ln -s /usr/bin/python3 /usr/bin/python
55 **Download dependencies:**
58 mkdir -p ~/charm/layers ~/charm/build
60 git clone https://git.launchpad.net/charm-k8s-kafka kafka-k8s
61 git clone https://git.launchpad.net/charm-k8s-zookeeper zookeeper-k8s
62 git clone https://git.launchpad.net/charm-osm-common osm-common
73 │ ├── spec_template.yaml
76 ├── test-requirements.txt
78 │ ├── basic_deployment.py
86 **Setup environment variables:**
89 export CHARM_LAYERS_DIR=~/charm/layers
90 export CHARM_BUILD_DIR=~/charm/build
96 mkdir ~/charm/layers/kafka-k8s/tests/build
97 charm build ~/charm/layers/kafka-k8s
98 charm build ~/charm/layers/zookeeper-k8s
99 mv ~/charm/build/* ~/charm/layers/kafka-k8s/tests/build/
102 ### Test charm with Tox
105 cd ~/charm/layers/kafka-k8s