~teknico/charms/precise/juju-gui/encrypt-api-env-connection

« back to all changes in this revision

Viewing changes to HACKING.txt

  • Committer: Nicola Larosa
  • Date: 2012-12-13 13:01:35 UTC
  • mfrom: (9.2.3 1089028-add-hacking-file)
  • Revision ID: nicola.larosa@canonical.com-20121213130135-7ck3cmbhbf0wc81d
Add a HACKING.txt file.

Move testing docs from the README.txt file to a new HACKING.txt, put deploying docs in README.txt .

R=
CC=
https://codereview.appspot.com/6921049

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
==========================
 
2
Juju GUI Charm Development
 
3
==========================
 
4
 
 
5
 
 
6
Testing
 
7
=======
 
8
 
 
9
There are two types of tests for the charm: unit tests and functional tests.
 
10
 
 
11
 
 
12
Unit tests
 
13
----------
 
14
 
 
15
The unit tests do not require a functional Juju environment, and can be run
 
16
with this command::
 
17
 
 
18
    python tests/unit.test
 
19
 
 
20
Unit tests should be created in the "tests" subdirectory and be named in the
 
21
customary way (i.e., "test_*.py").
 
22
 
 
23
 
 
24
Functional tests
 
25
----------------
 
26
 
 
27
Running the functional tests requires a Juju testing environment as provided
 
28
by the Jitsu test command.  All files in the tests directory which end with
 
29
".test" will be run in a Juju Jitsu test environment.
 
30
 
 
31
 
 
32
Functional test setup
 
33
~~~~~~~~~~~~~~~~~~~~~
 
34
 
 
35
At the time of this writing the Jitsu test command is not yet released.  To run
 
36
it you must first install it locally.  The files may be installed globally, or
 
37
into your home directory (as here)::
 
38
 
 
39
    sudo apt-get install autoconf libtool python-charmhelpers
 
40
    bzr branch lp:~jimbaker/juju-jitsu/unit-test jitsu-unit-test
 
41
    cd jitsu-unit-test
 
42
    autoreconf
 
43
    ./configure --prefix=$HOME
 
44
    make
 
45
    make install
 
46
 
 
47
The current incarnation of the Jitsu test command requires that the current
 
48
directory name match the charm name, so you must check out the charm into a
 
49
directory named "juju-gui"::
 
50
 
 
51
    bzr branch lp:~juju-gui/charms/precise/juju-gui/trunk juju-gui
 
52
 
 
53
The branch directory must be placed (or linked from) within a local charm
 
54
repository. It consists of a directory, itself containing a number of
 
55
directories, one for each distribution codename, e.g. ``precise``. In turn, the
 
56
codename directories will contain the charm repositories.
 
57
 
 
58
Now you are ready to run the functional tests (see the next section).
 
59
 
 
60
 
 
61
Running the functional tests
 
62
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
63
 
 
64
Jitsu requires the charm directory be named the same as the charm and it be the
 
65
current working directory when the tests are run::
 
66
 
 
67
    JUJU_REPOSITORY=/path/to/charm/repo ~/bin/jitsu test juju-gui \
 
68
        --logdir /tmp --timeout 40m
 
69
 
 
70
This command will bootstrap the default Juju environment specified in your
 
71
``~/.juju/environments.yaml``.
 
72
 
 
73
If you are going to run the tests often, you probably want to set up LXC and
 
74
run the tests locally by setting your default environment to a "local" one.
 
75
Among other things you will need to install apt-cacher-ng and LXC to do so.
 
76
 
 
77
Unfortunately, currently running tests on a local environment is quite slow
 
78
(with quantal host and precise container at least), so you may want to further
 
79
increase the ``jitsu test`` command timeout.
 
80
 
 
81
If Jitsu generates errors about not being able bootstrap::
 
82
 
 
83
    CalledProcessError: Command '['juju', 'bootstrap']'...
 
84
 
 
85
...or it hangs, then you may need to bootstrap the environment yourself and
 
86
pass the --no-bootstrap switch to Jitsu.
 
87
 
 
88
If you do not yet have an environment defined, the Jitsu command
 
89
"setup-environment" is an easy way to get started.