Matthew Treinish | a9aef87 | 2014-07-25 16:03:08 -0400 | [diff] [blame] | 1 | .. _cli_field_guide: |
| 2 | |
Masayuki Igawa | c268dd6 | 2013-09-18 00:51:05 +0900 | [diff] [blame] | 3 | Tempest Field Guide to CLI tests |
| 4 | ================================ |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 5 | |
| 6 | |
| 7 | What are these tests? |
Attila Fazekas | 23fdf1d | 2013-06-09 16:35:23 +0200 | [diff] [blame] | 8 | --------------------- |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 9 | The cli tests test the various OpenStack command line interface tools |
| 10 | to ensure that they minimally function. The current scope is read only |
| 11 | operations on a cloud that are hard to test via unit tests. |
| 12 | |
| 13 | |
| 14 | Why are these tests in tempest? |
Attila Fazekas | 23fdf1d | 2013-06-09 16:35:23 +0200 | [diff] [blame] | 15 | ------------------------------- |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 16 | These tests exist here because it is extremely difficult to build a |
Attila Fazekas | 58d2330 | 2013-07-24 10:25:02 +0200 | [diff] [blame] | 17 | functional enough environment in the python-\*client unit tests to |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 18 | provide this kind of testing. Because we already put up a cloud in the |
| 19 | gate with devstack + tempest it was decided it was better to have |
| 20 | these as a side tree in tempest instead of another QA effort which |
| 21 | would split review time. |
| 22 | |
| 23 | |
| 24 | Scope of these tests |
Attila Fazekas | 23fdf1d | 2013-06-09 16:35:23 +0200 | [diff] [blame] | 25 | -------------------- |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 26 | This should stay limited to the scope of testing the cli. Functional |
| 27 | testing of the cloud should be elsewhere, this is about exercising the |
| 28 | cli code. |
| 29 | |
| 30 | |
| 31 | Example of a good test |
Attila Fazekas | 23fdf1d | 2013-06-09 16:35:23 +0200 | [diff] [blame] | 32 | ---------------------- |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 33 | Tests should be isolated to a single command in one of the python |
| 34 | clients. |
| 35 | |
| 36 | Tests should not modify the cloud. |
| 37 | |
| 38 | If a test is validating the cli for bad data, it should do it with |
| 39 | assertRaises. |
| 40 | |
Michael Chapman | f826380 | 2013-06-25 15:17:24 +1000 | [diff] [blame] | 41 | A reasonable example of an existing test is as follows:: |
Sean Dague | f682579 | 2013-05-08 13:51:26 -0400 | [diff] [blame] | 42 | |
| 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') |