Adds jitsu test subcommand

Bug #1077476 reported by Jim Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-jitsu
Fix Released
Undecided
Jim Baker

Bug Description

Adds new subcommand, jitsu test, that runs unit tests in a charm's tests/ directory.

$ jitsu test --logdir=/tmp/test-results-42 mediawiki # --logdir LOGDIR must be specified

Executing this command then results in extensive logging (we may want to consider trimming this down); the key piece for each unit test is something like the following:

PASS: Verify top page is available for mediawiki/0
PASS: Verify top page is available for mediawiki/1
INFO: Completed test ./100_deploy.test
INFO: Passed test results for ./100_deploy.test in /tmp/test-results-42/100_deploy, skips=0

jitsu test ensures that the specified charm (mediawiki in this example) is deployed from the local repository, specifically the directory from which this test is being run. Otherwise any referenced but not qualified charms are deployed from the charm store.

Unit test ouput is captured in the specified LOGDIR. Note that unit tests can capture additional files by using JITSU_LOGDIR, which is passed as an environment variable to each unit test; it's LOGDIR/UNIT_TEST_NAME:

/tmp/test-results-42/100_deploy$ tree
.
├── 0
│   └── var
│   └── log
│   └── juju
│   ├── machine-agent.log
│   └── provision-agent.log
├── 1
│   └── var
│   ├── lib
│   │   └── juju
│   │   └── units
│   │   └── mediawiki-0
│   │   └── charm.log
│   └── log
│   └── juju
│   └── machine-agent.log
...
├── passed
└── wget.log

Other useful options include:

--no-bootstrap - so as to reuse an existing set of machines; note that jitsu test will not destroy services, so this would need to be automated outside jitsu test.

--isolate=ENVIRONMENT - creates an isolated environment using a unique name (jitsu-test-$(uuid)), including corresponding LOGDIR/.juju/environments.yaml. Note that no cleanup of security groups; this could be automated in testing through euca2ools.

Related branches

Jim Baker (jimbaker)
Changed in juju-jitsu:
assignee: nobody → Jim Baker (jimbaker)
status: New → In Progress
Changed in juju-jitsu:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.