Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 1 | Turbo-hipster |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 2 | ============= |
| 3 | |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 4 | Turbo-hipster works with the existing OpenStack code review system to |
| 5 | implement testing-related plugins. Historically, whenever code has been |
| 6 | written for Nova it has been tested against trivial datasets rather than |
| 7 | real data. This can mean that when users run the updated code on their |
| 8 | databases they can run into issues that were not found during testing. A |
| 9 | variety of real-world databases have been collected, anonymized, and added |
| 10 | to the database migration plugin used by turbo-hipster. Turbo-hipster is |
| 11 | integrated into the existing code review system, and automatically runs |
| 12 | tests against these larger test datasets. Turbo-hipster is specifically |
| 13 | designed to flag issues where changes to the database schema may not work |
| 14 | due to outliers in real datasets, and to identify situations where a |
| 15 | migration may take an unreasonable amount of time against a large database. |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 16 | |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 17 | .. note:: |
| 18 | Database anonymity is important, and can be very time consuming. |
| 19 | The databases used by turbo-hipster to test against are real-world databases |
| 20 | that have been anonymized with a database anonymization tool called Fuzzy |
| 21 | Happiness. Fuzzy Happiness takes markup in the sqlalchemy models file and |
| 22 | uses that to decide what values to anonymize, and how to do so. This feature |
| 23 | is still in development, and until it is complete turbo-hipster will not |
Lana Brindley | f0c5519 | 2014-01-20 17:24:37 +1000 | [diff] [blame] | 24 | report back to Zuul automatically. |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 25 | |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 26 | Additionally, turbo-hipster has been designed to be extensible, so it is |
| 27 | possible to write other plugins to expand its capabilities. |
| 28 | |
| 29 | Turbo-hipster and Zuul |
| 30 | ---------------------- |
| 31 | |
| 32 | Turbo-hipster is a Gearman worker. Zuul provides arguments that turbo- |
| 33 | hipster uses to check out the patch, perform the database testing, and then |
| 34 | report back with success or failure. Zuul allows you to specify which jobs |
| 35 | should be run against which projects. You can create a rule in Zuul for it |
| 36 | to select jobs that require testing against a database. Turbo-hipster will |
| 37 | then register as being able to complete that type of job. Gearman handles |
Lana Brindley | f0c5519 | 2014-01-20 17:24:37 +1000 | [diff] [blame] | 38 | the connection between Zuul and turbo-hipster, recognizing when a job |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 39 | matches the rule, and passing it to turbo-hipster for testing. When turbo- |
| 40 | hipster receives the patchset for the job, it creates a virtual environment |
| 41 | to test it. The result of the test is sent back to Gearman as a json string, |
| 42 | which contains links to compiled logfiles. |
| 43 | |
Lana Brindley | f0c5519 | 2014-01-20 17:24:37 +1000 | [diff] [blame] | 44 | The simplified workflow for turbo-hipster: |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 45 | |
| 46 | 1. Registers as a worker against Zuul's Gearman server |
| 47 | 2. Receives jobs from Zuul as they arrive |
| 48 | 3. Checks out the patchset |
| 49 | 4. Sets up a new virtual environment for testing |
Lana Brindley | f0c5519 | 2014-01-20 17:24:37 +1000 | [diff] [blame] | 50 | 5. Loads a representative subset of the available datasets |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 51 | 6. Runs the migration against each dataset, and checks the result |
| 52 | 7. Reports the results to Zuul, using the Gearman protocol |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 53 | |
| 54 | Typical workflow diagram |
| 55 | ------------------------ |
| 56 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 57 | .. seqdiag:: |
Joshua Hesketh | 05d0158 | 2013-09-09 15:16:08 +1000 | [diff] [blame] | 58 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 59 | seqdiag admin { |
| 60 | # define order of elements |
| 61 | # seqdiag sorts elements by order they appear |
| 62 | humanoid; gerrit; zuul; gearman; turbo-hipster1; turbo-hipster2; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 63 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 64 | humanoid -> gerrit [leftnote = "Patchset uploaded"]; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 65 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 66 | zuul -> gearman [label = "register-server"]; |
| 67 | zuul <-- gearman; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 68 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 69 | turbo-hipster1 -> gearman [label = "add server"]; |
| 70 | turbo-hipster1 <-- gearman; |
| 71 | turbo-hipster1 -> gearman [label = "register functions"]; |
| 72 | turbo-hipster1 <-- gearman; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 73 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 74 | turbo-hipster2 -> gearman [label = "add server"]; |
| 75 | turbo-hipster2 <-- gearman; |
| 76 | turbo-hipster2 -> gearman [label = "register functions"]; |
| 77 | turbo-hipster2 <-- gearman; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 78 | |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 79 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 80 | gerrit -> zuul [label = "patchset-uploaded"]; |
| 81 | zuul -> gearman [label = "request worker"]; |
| 82 | zuul -> gearman [label = "request worker"]; |
| 83 | gearman -> turbo-hipster1 [label = "run function"]; |
| 84 | gearman -> turbo-hipster2 [label = "run function"]; |
| 85 | gearman <- turbo-hipster1 [label = "return result"]; |
| 86 | gearman <- turbo-hipster2 [label = "return result"]; |
| 87 | zuul <- gearman [label = "return result"]; |
| 88 | zuul <- gearman [label = "return result"]; |
| 89 | gerrit <- zuul [label = "voting results"]; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 90 | |
Joshua Hesketh | e7ee50e | 2014-01-11 14:13:40 +0800 | [diff] [blame] | 91 | humanoid <-- gerrit; |
Joshua Hesketh | 8b0eb6e | 2013-09-05 13:52:04 +1000 | [diff] [blame] | 92 | |
| 93 | } |
Joshua Hesketh | 05d0158 | 2013-09-09 15:16:08 +1000 | [diff] [blame] | 94 | |
Lana Brindley | 5a11bb3 | 2014-01-15 14:05:49 +1000 | [diff] [blame] | 95 | |