To run the unit tests:

1) Install calamari-server-test (which will pull in all the other bits
of calamari as dependencies).

2) Run `calamari-ctl initialize` to do a bit of necessary configuration,
start services, etc.  This can be automated with:

  # expect \
      -c 'spawn calamari-ctl initialize' \
      -c 'expect "Username"' \
      -c 'send "admin\n"' \
      -c 'expect "Email"' \
      -c 'send "root@example.com\n"' \
      -c 'expect "Password"' \
      -c 'send "admin\n"' \
      -c 'expect "Password"' \
      -c 'send "admin\n"' \
      -c 'expect eof'

3) Make one request to calamari, to ensure the log files get created
with the correct permissions (if we don't do this, some log files get
created under /var/log/calamari/ owned by root when the unit tests are
done, which breaks subsequent regular use via HTTP):

  # wget -O /dev/null http://localhost/

4) Run the tests:

  # cd /usr/lib/python2.7/site-packages/calamari-server-test
  # ./run-unit-tests

These should only take a few seconds to run.

To run the server tests, you need a live Ceph cluster with at least
three mons and a couple of extra config files.  DO NOT RUN THESES TESTS
AGAINST A CLUSTER THAT CONTAINS DATA OR POOLS YOU CARE ABOUT.  YOU HAVE
BEEN WARNED.

Make sure you've run `calamari-ctl initialize` as above, and be sure that
the admin user is named "admin" as some of the server tests expect this.
Then:

1) Create /usr/lib/python2.7/site-packages/calamari-server-test/tests/test.conf
It should contain:

[testing]
calamari_control = external
ceph_control = external
cluster_distro = suse
api_url = http://localhost:80/api/v2/
api_username = admin
api_password = admin
embedded_timeout_factor = 1
external_timeout_factor = 3
external_cluster_path = /root/info.yaml

2) Create /root/info.yaml (which you can put anywhere you like, actually,
provided the path to it in tests/test.conf matches).  It should look something
like:

master_fqdn:
    ceph-sles12-0.example.com

cluster:
    root@ceph-sles12-1.example.com:
        roles:
        - mon.1
        - osd.1
        - client.0
    root@ceph-sles12-2.example.com:
        roles:
        - mon.1
        - osd.1
        - client.0
    root@ceph-sles12-3.example.com:
        roles:
        - mon.1
        - osd.1
        - client.0

You'll need to set the hostnames appropriately (i.e. replace "ceph-sles12-*"
to match your actual hostnames).  Make sure you specify FQDNs if that's what
your systems have, i.e. info.yaml needs to specify the same hostnames that
salt thinks the systems have.

3) Ensure passwordless ssh as root works from the calamari server to each of
the ceph cluster nodes (`ssh-keygen`, `ssh-copy-id $node` etc.)

4) Run the tests:

  # cd /usr/lib/python2.7/site-packages/calamari-server-test/
  # ./run-server-tests

These will take a while to run (think: 10-20 minutes).

