6.1.4
by Andy Doan
simple readme start |
1 |
Local Development
|
2 |
-----------------
|
|
3 |
||
4 |
Development environments can be set of using the setup.py files in the |
|
5 |
projects you wish to work on. The easiest approach is to use python-virtualenv. |
|
6 |
Since most projects require the ci-utils project, that should almost always |
|
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
7 |
get setup first. |
8 |
||
78.1.1
by Andy Doan
add a lightweight script for MP testing |
9 |
Another quick way to get started is to look at the tarmac.sh script which |
10 |
sets up a quick environment to run component testing under. |
|
11 |
||
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
12 |
There are two types of services written in this project, Django and Restish. |
13 |
Development varies slightly between the two. |
|
14 |
||
243.1.1
by Chris Johnston
Update README docs for TS and cli |
15 |
Ticket System
|
16 |
~~~~~~~~~~~~~
|
|
17 |
:: |
|
18 |
# setup the ticket system project |
|
828.2.2
by Max Brustkern
Added python-dev |
19 |
sudo apt-get install python-virtualenv libssl-dev libapt-pkg-dev libffi-dev python-dev |
789.1.2
by Martin Pitt
README: We need testing/venv.py, not virtualenv |
20 |
./testing/venv.py /tmp/venv |
243.1.1
by Chris Johnston
Update README docs for TS and cli |
21 |
. /tmp/venv/bin/activate |
22 |
./ci-utils/setup.py develop |
|
23 |
./ticket_system/setup.py develop |
|
24 |
||
25 |
Unit-testing can be done with::
|
|
26 |
||
27 |
# via setuptools
|
|
28 |
./ticket_system/setup.py test
|
|
29 |
||
30 |
# directly via django
|
|
31 |
./manage.py test # this tests everything (including django)
|
|
32 |
./manage.py test ticket # just test the project
|
|
33 |
./manage.py test ticket.APIUpdateSubTicketStatuses #test one class
|
|
34 |
./manage.py test ticket.APIUpdateSubTicketStatuses.test_delete_subticket_not_allowed # test one method
|
|
35 |
||
36 |
CLI
|
|
37 |
~~~
|
|
38 |
:: |
|
39 |
# setup the CLI project |
|
789.1.2
by Martin Pitt
README: We need testing/venv.py, not virtualenv |
40 |
./testing/venv.py /tmp/venv |
243.1.1
by Chris Johnston
Update README docs for TS and cli |
41 |
. /tmp/venv/bin/activate |
42 |
./ci-utils/setup.py develop |
|
43 |
||
44 |
Unit-testing can be done with::
|
|
45 |
||
46 |
./cli/setup.py test
|
|
47 |
||
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
48 |
Restish
|
49 |
~~~~~~~
|
|
50 |
:: |
|
789.1.2
by Martin Pitt
README: We need testing/venv.py, not virtualenv |
51 |
./testing/venv.py /tmp/venv |
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
52 |
. /tmp/venv/bin/activate |
82.1.1
by Vincent Ladeuil
Minimal restish implementation for the test runner component. |
53 |
./ci-utils/setup.py develop |
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
54 |
./branch-source-builder/setup.py develop |
55 |
||
29.2.1
by Andy Doan
fix setup.py files so you can run ./setup.py test |
56 |
Unit-testing can be done a couple of ways: |
57 |
||
58 |
# using setuptools: |
|
59 |
./image-builder/setup.py test |
|
60 |
||
61 |
# python unittest directly |
|
62 |
python -m unittest discover -s branch-source-builder |
|
18.3.1
by Andy Doan
first pass at stubbing out a branch-source-builder |
63 |
|
64 |
Running under the python wsgi server can be done with::
|
|
65 |
||
66 |
./branch-source-builder/bsbuilder/wsgi.py
|
|
67 |
||
68 |
Running under gunicorn can be done with::
|
|
69 |
||
70 |
# need gunicorn:
|
|
71 |
pip install gunicorn
|
|
72 |
||
73 |
# TIP: by setting max-requests=1 you can make changes to the source code
|
|
74 |
# and they'll be picked up in the next http request you make!!
|
|
75 |
gunicorn --max-requests 1 bsbuilder.wsgi:app
|
|
6.1.14
by Andy Doan
add a juju-deployer config and update README |
76 |
|
77 |
Juju Testing
|
|
78 |
------------
|
|
79 |
||
80 |
Each service should include a juju-deployer config under the juju-deployer |
|
81 |
directory. |
|
45.2.1
by Vincent Ladeuil
Add more instructions about running integration tests for the ppa assigner. |
82 |
|
53.3.3
by Evan Dandrea
Move the deploy script under juju-deployer and note it in the README. |
83 |
To deploy them all, run `./juju-deployer/deploy`
|
84 |
||
45.2.1
by Vincent Ladeuil
Add more instructions about running integration tests for the ppa assigner. |
85 |
Install pre-requisites: |
86 |
||
87 |
$ sudo apt-get install juju juju-deployer python-httplib2 |
|
88 |
||
89 |
Configure juju for canonistack (or whatever you feel is appropriate), make |
|
90 |
sure you select the region there (see OS_REGION_NAME/NOVA_REGION): |
|
91 |
||
92 |
$ . ~/.canonistack/novarc |
|
93 |
||
94 |
Create a proper ~/.juju/environments.yaml, example: |
|
95 |
||
96 |
environments: |
|
97 |
## https://juju.ubuntu.com/docs/config-openstack.html |
|
98 |
lcy02: |
|
99 |
type: openstack |
|
100 |
admin-secret: <your admin secret, juju can auto-create it> |
|
101 |
# Globally unique swift bucket name |
|
102 |
control-bucket: <you control-bucket secret, juju can auto-create it> |
|
103 |
# Usually set via the env variable OS_REGION_NAME, but can be specified here |
|
104 |
region: lcy02 |
|
105 |
||
123.1.16
by Vincent Ladeuil
Document the --constraints syntax and when it should be used (even if juju core guys say that should be the default now). |
106 |
$ juju bootstrap --constraints="mem=1G" |
45.2.1
by Vincent Ladeuil
Add more instructions about running integration tests for the ppa assigner. |
107 |
|
108 |
Get the IP address of the juju state server from 'nova list --name machine-0': |
|
109 |
||
110 |
$ nova list --name machine-0 --fields networks |
|
111 |
+--------------------------------------+-------------------------+ |
|
112 |
| ID | Networks |
|
|
113 |
+--------------------------------------+-------------------------+ |
|
114 |
| 0463d358-750c-4fc4-b38b-a618e2e7d034 | canonistack=10.55.32.64 |
|
|
115 |
+--------------------------------------+-------------------------+ |
|
116 |
||
117 |
Start sshuttle in the foreground from a different terminal where you've sourced your credentials (we need a way to get that in a more script friendly way): |
|
118 |
||
119 |
$ sshuttle -r ubuntu@10.55.32.64 10.55.0.0/16 |
|
120 |
||
121 |
You'll need to interrupt this command once you're run 'juju destroy-environment' to ensure you didn't leave pending connections to juju instances that should not exist anymore. |
|
122 |
||
575.2.6
by Vincent Ladeuil
Add run-tests regexps examples |
123 |
Running all tests
|
124 |
-----------------
|
|
125 |
||
541.1.8
by Celso Providelo
README update for running integration tests. |
126 |
Run all tests (unit and integration) with the following command: |
127 |
||
128 |
$ JUJU_ENV=<env_name> ./run-tests [regexp] |
|
129 |
||
130 |
It will build and deploy charms if necessary for the selected tests. |
|
131 |
||
575.2.8
by Vincent Ladeuil
This not true anymore as noted during review. |
132 |
You can specify test name regexps like '^tests.'. |
541.1.8
by Celso Providelo
README update for running integration tests. |
133 |
|
134 |
Also note that it will leave deployed instances behind (which are useful for subsequent test runs). |
|
575.2.6
by Vincent Ladeuil
Add run-tests regexps examples |
135 |
|
136 |
Running some tests
|
|
137 |
------------------
|
|
138 |
||
139 |
'run-tests' uses regexps to select tests. |
|
140 |
||
141 |
A single test (note the '^' and '$' anchors to ensure a single test is |
|
142 |
selected: |
|
143 |
||
144 |
$ ./run-tests ^testing.test_style.TestPep8.test_pep8_conformance$ |
|
145 |
||
146 |
All the tests defined under a given directory: |
|
147 |
||
148 |
$ ./run-tests ^cli |
|
149 |
||
150 |
All style tests: |
|
151 |
||
152 |
$ ./run-tests test_style |
|
153 |
||
154 |
'^.*\.test_style\..*$' is pedantically more precise but in practice the
|
|
155 |
simplest form above is enough. |
|
156 |
||
157 |
Several subsets to cover all tests related to the test runner component: |
|
158 |
||
159 |
$ ./run-tests ^test_runner ^tests.test_test_runner |
|
160 |
||
161 |
Excluding tests: |
|
162 |
||
163 |
$ ./run-tests -X ^tests |
|
164 |
||
165 |
will run all tests except the ones under the ./tests directory (which are |
|
166 |
known to require a deployment and to be far slower than the others). |