preventing craziness · unit tests integration tests ... nodepool git clone git review gerrit...

48
Preventing craziness A deep dive into OpenStack testing automation Thierry Carrez (@tcarrez) Release manager, OpenStack

Upload: others

Post on 03-Jul-2020

40 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Preventing craziness A deep dive into OpenStack testing automation

Thierry Carrez (@tcarrez)Release manager, OpenStack

Page 2: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results
Page 3: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

OpenStack is large & growing

95+ code repositories 1.9+ MLOC

Stats by

Page 4: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

OpenStack is complex

9 integrated projects Each project is a framework

Page 5: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

OpenStack is painful

Difficult to deploy Difficult to test Difficult to keep up with changes

Page 6: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

OpenStack is open innovation

Anyone can propose a change Lots of different companies No traditional management structure Technical meritocracy (no DFL) Global community

Page 7: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

And yet...

We release every 6 months Master branches are always usable We keep on growing We retained (most of) our sanity

Page 8: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

1. Code reviews

Everyone's code should be reviewed At worse it's a learning opportunity Elite committers vs. Peer reviewers Everyone can review

Page 9: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

2. Automated testing

Not tested Not working→ Not automatically tested Not tested→

Page 10: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

2. Automated testing

Unit tests Integration tests Upgrade tests Syntax tests (PEP8) Hacking style tests (flake8/hacking)

Page 11: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

3. Trunk gating

Do not merge unless it passes tests « Automation for code review » Always-good trunk

Page 12: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

All together now...

Your git branch

master git branch

github

git.o.o

tarballs.o.o

review.o.o

developer

reviewers

infrastructurePEP8

HackingUnit tests

Integration tests

Page 13: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

git

git is used everywhere git is fast & powerful git-review lets us submit to Gerrit Github only used as a repo mirror

Page 14: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gerrit

Code review Inline comments, vote tracking

Page 15: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gerrit

Page 16: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gerrit

Page 17: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gerrit

Code review Inline comments, vote tracking Issues :

Automating configuration (Jeepyb) no private reviews

Page 18: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Zuul

Triggered by gerrit event firehose Handles test pipelines (see later) Launches tests Uses Gearman to distribute tests Reports results back to Gerrit

Page 19: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Jenkins

Runs tests on slaves Nodepool ensures slaves availability Devstack-gate scripts prepare slaves Issues :

Jjb Avoid plugins Not really useful at this point

Page 20: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

All together now...

Repository

Gerrit Zuul

Nodepool

git clone

git review

Gerrit stream-event

Jenkins

Gearmanjenkins plugin

Branch

Zuul Gerrit reporter Job results

Page 21: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Everyone loves numbers

900 patchsets proposed per day 4000 Gerrit comments/votes per day 7 Jenkins masters, 250-500 slaves 15K test jobs per day 200 patchsets merged per day

Page 22: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Scaling Jenkins & Gerrit

Multiple master setup Log storage : logstash, Gearman Log search : ElasticSearch / Kibana Mirroring master git repo to cgit pool

Page 23: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gating at scale

Serial gating is easy but limited

1 2 3 4

Page 24: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Serial gating

1

Page 25: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Serial gating

1 1 2

Page 26: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Serial gating

1 1 2 1 2 3

Page 27: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Serial gating

1 1 2 1 2 3 1 2 4

Page 28: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gating at scale

Serial gating is easy but limited Parallel gating ? Yay clouds But parallel gating may introduce fails

1 2 3 4

Page 29: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Parallel gating

1

2

3

4

Page 30: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Parallel gating

1

2

3

4

Page 31: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Gating at scale

Serial gating is easy but limited Parallel gating ? Yay clouds But parallel gating may introduce fails Zuul : Speculative execution of tests

1 2 3 4

Page 32: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1

1

3

4

2

2 3

Page 33: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1 32

1 42 3

Page 34: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1

1

3

4

2

2 3

Page 35: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1

1

3

4

2

2 3 1 2 4

Page 36: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1

1

3

4

2

2 3 1 2 4

Page 37: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative gating

1

1 2

1

1

3

4

2

2 3 1 2 4

Page 38: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Speculative vs. serial gating

1

1 2

1

1

3

4

2

2 3 1 2 4

1 1 2 1 2 3 1 2 4

Page 39: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Visualizing Zuul

Page 40: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

False negatives

Page 41: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Tracking rechecks

Page 42: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Tracking rechecks

Page 43: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Failure tracking by signature

Page 44: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Elastic rechecks

Page 45: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Automation for the win

http://xkcd.com/1205

Page 46: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Infrastructure as code

Puppet-driven infrastructure All project infrastructure is open Yes, everything is in a code repo Apply our key principles to infra too

Page 47: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Join us !

State-of-the-art dev infrastructure Openly developed Reused at Wikimedia and elsewhere

#openstack-infra on

Page 48: Preventing craziness · Unit tests Integration tests ... Nodepool git clone git review Gerrit stream-event Jenkins Gearman jenkins plugin Branch Zuul Gerrit reporter Job results

Questions ?

[email protected]://fnords.wordpress.com@tcarrez onttx on