blob: bc180843d459e32134baa9014ebae163ed3e8c15 [file] [log] [blame]
Matthew Treinisha9aef872014-07-25 16:03:08 -04001.. _cli_field_guide:
2
Masayuki Igawac268dd62013-09-18 00:51:05 +09003Tempest Field Guide to CLI tests
4================================
Sean Daguef6825792013-05-08 13:51:26 -04005
6
7What are these tests?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +02008---------------------
Sean Daguef6825792013-05-08 13:51:26 -04009The cli tests test the various OpenStack command line interface tools
10to ensure that they minimally function. The current scope is read only
11operations on a cloud that are hard to test via unit tests.
12
13
14Why are these tests in tempest?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020015-------------------------------
Sean Daguef6825792013-05-08 13:51:26 -040016These tests exist here because it is extremely difficult to build a
Attila Fazekas58d23302013-07-24 10:25:02 +020017functional enough environment in the python-\*client unit tests to
Sean Daguef6825792013-05-08 13:51:26 -040018provide this kind of testing. Because we already put up a cloud in the
19gate with devstack + tempest it was decided it was better to have
20these as a side tree in tempest instead of another QA effort which
21would split review time.
22
23
24Scope of these tests
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020025--------------------
Sean Daguef6825792013-05-08 13:51:26 -040026This should stay limited to the scope of testing the cli. Functional
27testing of the cloud should be elsewhere, this is about exercising the
28cli code.
29
30
31Example of a good test
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020032----------------------
Sean Daguef6825792013-05-08 13:51:26 -040033Tests should be isolated to a single command in one of the python
34clients.
35
36Tests should not modify the cloud.
37
38If a test is validating the cli for bad data, it should do it with
39assertRaises.
40
Michael Chapmanf8263802013-06-25 15:17:24 +100041A reasonable example of an existing test is as follows::
Sean Daguef6825792013-05-08 13:51:26 -040042
43 def test_admin_list(self):
44 self.nova('list')
45 self.nova('list', params='--all-tenants 1')
46 self.nova('list', params='--all-tenants 0')
47 self.assertRaises(subprocess.CalledProcessError,
48 self.nova,
49 'list',
50 params='--all-tenants bad')