blob: e8f1c312673ddbd9368a91e576655780df0cbd01 [file] [log] [blame]
Lana Brindley5a11bb32014-01-15 14:05:49 +10001Turbo-hipster
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +10002=============
3
Lana Brindley5a11bb32014-01-15 14:05:49 +10004Turbo-hipster works with the existing OpenStack code review system to
5implement testing-related plugins. Historically, whenever code has been
6written for Nova it has been tested against trivial datasets rather than
7real data. This can mean that when users run the updated code on their
8databases they can run into issues that were not found during testing. A
9variety of real-world databases have been collected, anonymized, and added
10to the database migration plugin used by turbo-hipster. Turbo-hipster is
11integrated into the existing code review system, and automatically runs
12tests against these larger test datasets. Turbo-hipster is specifically
13designed to flag issues where changes to the database schema may not work
14due to outliers in real datasets, and to identify situations where a
15migration may take an unreasonable amount of time against a large database.
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100016
Lana Brindley5a11bb32014-01-15 14:05:49 +100017.. 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 Brindleyf0c55192014-01-20 17:24:37 +100024 report back to Zuul automatically.
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100025
Lana Brindley5a11bb32014-01-15 14:05:49 +100026Additionally, turbo-hipster has been designed to be extensible, so it is
27possible to write other plugins to expand its capabilities.
28
29Turbo-hipster and Zuul
30----------------------
31
32Turbo-hipster is a Gearman worker. Zuul provides arguments that turbo-
33hipster uses to check out the patch, perform the database testing, and then
34report back with success or failure. Zuul allows you to specify which jobs
35should be run against which projects. You can create a rule in Zuul for it
36to select jobs that require testing against a database. Turbo-hipster will
37then register as being able to complete that type of job. Gearman handles
Lana Brindleyf0c55192014-01-20 17:24:37 +100038the connection between Zuul and turbo-hipster, recognizing when a job
Lana Brindley5a11bb32014-01-15 14:05:49 +100039matches the rule, and passing it to turbo-hipster for testing. When turbo-
40hipster receives the patchset for the job, it creates a virtual environment
41to test it. The result of the test is sent back to Gearman as a json string,
42which contains links to compiled logfiles.
43
Lana Brindleyf0c55192014-01-20 17:24:37 +100044The simplified workflow for turbo-hipster:
Lana Brindley5a11bb32014-01-15 14:05:49 +100045
461. Registers as a worker against Zuul's Gearman server
472. Receives jobs from Zuul as they arrive
483. Checks out the patchset
494. Sets up a new virtual environment for testing
Lana Brindleyf0c55192014-01-20 17:24:37 +1000505. Loads a representative subset of the available datasets
Lana Brindley5a11bb32014-01-15 14:05:49 +1000516. Runs the migration against each dataset, and checks the result
527. Reports the results to Zuul, using the Gearman protocol
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100053
54Typical workflow diagram
55------------------------
56
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080057.. seqdiag::
Joshua Hesketh05d01582013-09-09 15:16:08 +100058
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080059 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 Hesketh8b0eb6e2013-09-05 13:52:04 +100063
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080064 humanoid -> gerrit [leftnote = "Patchset uploaded"];
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100065
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080066 zuul -> gearman [label = "register-server"];
67 zuul <-- gearman;
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100068
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080069 turbo-hipster1 -> gearman [label = "add server"];
70 turbo-hipster1 <-- gearman;
71 turbo-hipster1 -> gearman [label = "register functions"];
72 turbo-hipster1 <-- gearman;
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100073
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080074 turbo-hipster2 -> gearman [label = "add server"];
75 turbo-hipster2 <-- gearman;
76 turbo-hipster2 -> gearman [label = "register functions"];
77 turbo-hipster2 <-- gearman;
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100078
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100079
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080080 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 Hesketh8b0eb6e2013-09-05 13:52:04 +100090
Joshua Heskethe7ee50e2014-01-11 14:13:40 +080091 humanoid <-- gerrit;
Joshua Hesketh8b0eb6e2013-09-05 13:52:04 +100092
93 }
Joshua Hesketh05d01582013-09-09 15:16:08 +100094
Lana Brindley5a11bb32014-01-15 14:05:49 +100095