Chef Cookbook Testing Like a Pro

Video in TIB AV-Portal: Chef Cookbook Testing Like a Pro

Formal Metadata

Chef Cookbook Testing Like a Pro
Title of Series
CC Attribution - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date

Content Metadata

Subject Area
Automated infrastructure allows us to move fast, but moving fast is scary without proper testing. Where to start though? The state of the art in Chef cookbook testing has changed rapidly in the last few years with the introduction of new and improved tools and much of what you'll find in Web searches is often outdated. In this presentation I'll give an overview of the available tools for testing and techniques to avoid busy work in your testing. We'll cover cookbook linting, unit testing, and integration testing using Cookstyle, ChefSpec, and Test Kitchen / InSpec. We'll also cover wiring up your testing in Travis CI to perform full integration tests on every PR.
State of matter Unit testing Statistical hypothesis testing Smith chart
Point (geometry) Area Word Arithmetic mean NP-hard Electronic mailing list Right angle Statistical hypothesis testing Power (physics) Statistical hypothesis testing
Category of being Word Multiplication sign Software Data structure
Point (geometry) Standard deviation Mathematics Server (computing) Process (computing) Code Multiplication sign Normed vector space Configuration space Data structure Instance (computer science)
Point (geometry) Axiom of choice Email Graph (mathematics) Drop (liquid) Configuration management Statistical hypothesis testing Statistical hypothesis testing Data management Arithmetic mean Data management Mathematics Curvature Velocity Website Right angle Utility software Table (information) Physical system
Statistical hypothesis testing Execution unit Term (mathematics) Server (computing) Blog Software developer Disintegration Software testing Hydraulic jump Statistical hypothesis testing Number Statistical hypothesis testing
Code Logic Logic Code
Point (geometry) Web page Validity (statistics) Code Block (periodic table) Execution unit Neighbourhood (graph theory) 1 (number) Boom (sailing) Line (geometry) Proper map Rule of inference Formal language Product (business) Mathematics Process (computing) Term (mathematics) Operator (mathematics) Single-precision floating-point format Videoconferencing Right angle Quicksort Spacetime God
Point (geometry) Code Logic Formal language
Web page Execution unit Stapeldatei Code Robot Interpreter (computing) Fiber bundle Cartesian coordinate system Mereology Rule of inference Variable (mathematics) Spacetime
Group action Code Shared memory Internet service provider Function (mathematics) Infinity Rule of inference Host Identity Protocol Field (computer science) Metadata Revision control Logic Daylight saving time Default (computer science)
Statistical hypothesis testing Group action Code Connectivity (graph theory) Disintegration Sheaf (mathematics) Set (mathematics) Function (mathematics) Rule of inference Statistical hypothesis testing output Maß <Mathematik> Descriptive statistics Social class Default (computer science) Rule of inference Execution unit Correlation and dependence Unit testing Group action Cartesian coordinate system Statistical hypothesis testing Statistical hypothesis testing Component-based software engineering Personal digital assistant output
Statistical hypothesis testing Source code Complex (psychology) Execution unit Conic section Shift operator Installation art Sheaf (mathematics) Code Bit Unit testing Group action Mereology Template (C++) Statistical hypothesis testing Variable (mathematics) Vector space Configuration space Energy level Right angle Endliche Modelltheorie Quicksort Extension (kinesiology) Writing
Read-only memory Semiconductor memory Personal digital assistant Different (Kate Ryan album) Natural number Operating system Cuboid Quicksort Template (C++) Statistical hypothesis testing Physical system Statistical hypothesis testing
Mapping Logic Stress (mechanics) Codebuch Template (C++) Statistical hypothesis testing
Point (geometry) Word Logic Different (Kate Ryan album) Personal digital assistant Logic Statement (computer science) ACID Bit Computing platform Statistical hypothesis testing Statistical hypothesis testing
Filter <Stochastik> Scripting language Source code Service (economics) Service (economics) Validity (statistics) Group action Variable (mathematics) Revision control Repository (publishing) Configuration space Right angle Perfect group
Statistical hypothesis testing INTEGRAL Real number Disintegration Mereology Statistical hypothesis testing Statistical hypothesis testing Statistical hypothesis testing Product (business) Component-based software engineering Software Repository (publishing) Software Right angle
Point (geometry) Installation art Suite (music) Server (computing) Installation art Suite (music) Cross-platform Projective plane Water vapor Client (computing) Mereology Statistical hypothesis testing Statistical hypothesis testing Product (business) Medical imaging Personal digital assistant Computing platform Cuboid Freeware Form (programming) Computing platform Physical system
Installation art Commodore VIC-20 Real number Video game Gastropod shell Function (mathematics) Statistical hypothesis testing Product (business) Statistical hypothesis testing Physical system
Statistical hypothesis testing Group action Service (economics) Real number Multiplication sign Directory service Statistical hypothesis testing Product (business) Power (physics) Local Group Expected value Different (Kate Ryan album) Gastropod shell Process (computing) Descriptive statistics Physical system Bit Directory service Cartesian coordinate system Statistical hypothesis testing Category of being Arithmetic mean Vector space Software Configuration space Right angle Resultant Window Asynchronous Transfer Mode
Statistical hypothesis testing Confidence interval Data conversion Avatar (2009 film) Statistical hypothesis testing Computing platform Statistical hypothesis testing
Point (geometry) Server (computing) Functional (mathematics) Group action Dependent and independent variables Service (economics) Computer file Chemical equation Function (mathematics) Cartesian coordinate system Statistical hypothesis testing Category of being Response time (technology) output Right angle Physical system Physical system Asynchronous Transfer Mode
Statistical hypothesis testing Type theory Execution unit Asynchronous Transfer Mode Different (Kate Ryan album) Multiplication sign Logic Mereology Data structure Mereology Local ring Statistical hypothesis testing
Computer file Structural load Phase transition Total S.A. Local ring
Web page Point (geometry) Computer file Multiplication sign Software developer Content (media) Function (mathematics) Statistical hypothesis testing Phase transition Remote procedure call Local ring Local ring Physical system Flag
Point (geometry) Mathematics Server (computing) Scaling (geometry) Open source Multiplication sign Software developer Automation Product (business) Physical system
Game controller Right angle Endliche Modelltheorie Control flow Information security Physical system Statistical hypothesis testing
Statistical hypothesis testing Medical imaging Game controller Coefficient of determination Mobile app Word Different (Kate Ryan album) Configuration space Cuboid Mass Data compression Physical system
Random number Installation art Service (economics) Computer network Revision control Medical imaging Process (computing) Software Software repository System programming Right angle Process (computing) Computing platform Physical system
Intel Installation art Service (economics) Weight Computer-generated imagery Bit Principal ideal domain Inclusion map Medical imaging Order (biology) Computing platform Physical system Physical system
Statistical hypothesis testing Installation art Sweep line algorithm Confidence interval View (database) Workstation <Musikinstrument> MIDI Instance (computer science) Function (mathematics) Mereology Statistical hypothesis testing Product (business) Mathematics Bit rate Different (Kate Ryan album) Local ring Computing platform Physical system Execution unit Binary code Interior (topology) Stress (mechanics) Instance (computer science) Statistical hypothesis testing Process (computing) Repository (publishing) Personal digital assistant Normed vector space Right angle Hacker (term) Table (information) Physical system Spacetime
Statistical hypothesis testing Mathematics Confidence interval Confidence interval Configuration space Data structure Series (mathematics)
Statistical hypothesis testing Server (computing) Computer file Java applet Mereology Theory Traverse (surveying) Statistical hypothesis testing Goodness of fit Lattice (group) Natural number Cuboid Data structure Computing platform Task (computing) Electric generator Block (periodic table) Computer file Commutator Shared memory Parallel port Virtualization Variable (mathematics) Category of being Word Vector space Repository (publishing) Right angle Figurate number Pressure Writing
Statistical hypothesis testing Point (geometry) Complex (psychology) Presentation of a group Code INTEGRAL Multiplication sign Gene cluster Mass Replication (computing) Attribute grammar Power (physics) Statistical hypothesis testing Revision control Different (Kate Ryan album) Cuboid Right angle Complex system Figurate number Physical system
a lot of yeah so on the however the thing on the on the work of these states of the hidden unit testing and here in the 1st World War I veterans start at the beginning the year and the use of the all in the we would you but the 1st thing that is
really like all of the and this thing is just a just the search of the whole thing and so on so currently has had in the the the power of the the the was you and I had a lot and I I was very much traditional so that the point was that is that the last thing you want it to stop the I was still doing the where you really a real word really high was of the on the still has the little the thing that we're not yet not that I'm so I want to use
the has I I enjoyed it and I have also wound up to you in the lower half of what it in the words of test you on the right and left and right in the middle of the nite of the we would be on the list of items the area where the ship and the thing about the meaning of the you know that I was thinking about this we might
not have been the In the hands-on time because I was that I have used the
word around a 1 lot of the
things you know about the world in the world know
the the on the somewhere between the properties user of the structures and always has to help if we have failures were not popular so
standards are your business and at that point really just not doing a job and unfortunately as we move to structures
code and we moved to chef you know a fantastic tools that's really just made our failures faster and ugly before when I was clicking through servers I might see a change on the 3rd server that cause the problem but now I push it change out and going a copy and by the time I come back that changes are a point of 500 servers so that the ability to roll back your change to see issues in that instance the goes along with that doesn't come into play in the end I think a good example that is is 3 configuration
management by mail on changes 90 % of them were clearly fantastic wonderful changes I got some promotions that people were happy with it to preserve more bad and by that I mean like Johnny drop tables outage horrible horrible website down bad and seems pretty high like looking back at how might spread but resent but it might be bad at 1st glance but I was only doing fine changes at that right point clicky you can't do much and so are means and failure as a company was very well are customers were happy the website was up the business was happy we're making money but we had to increase the velocity are competition was increasing velocity we had to stay relevant the business world so we took on configuration management we brought in Chap we increase our velocity an instantly you see the my bad 1 to 1 % this is exactly what this is 1 they wanted us to have automation reducing so we we automated where it's right hand in fact these turned a lot of what I did was just clicking on the wrong thing for a checkbox running the wrong command and that happens right were replicating the same thing across 50 servers by and we make mistakes but unfortunately I'm thinking that the changes of which means the business is not happy the customers are not happy use Rashid failing more we have more outages we've ever had before and we have unhappy customers simply because that increasing velocity came along with an increase outages
so we have to utilize test there's really no choice we cannot have any increasing velocity that also increases that are out is that the same proportion we wanna see a nice beautiful up into the right graph but we want a nice flat horrible graph for outages it so
we decide center jump right where minutes of our testing things and the 1st thing we do is we go
Google Research for Shep testing in this huge number of blog posts come back things the Joshua wrote you know 5 years ago that are about also use many tasks and they're like 2012 and like I don't understand this is too many tools and the 1st thing we wanna do is not do do not search for the tools as they were used instead we want to put
our developer had on 1 thing about what we actually want in terms of test so we have 3 kinds of testing realize within that chap within our infrastructure this certainly more kinds of software testing if you ever want pain search for software testing and find some nice like you know i tripoli doctor talked about it I'm but the the 3 needs a 3 they're idiot were analyzed today the 1st was
in but inland is when we stand we
analyze the code in the chef world over do is look for syntax and logic and when I say a statically analyze what I mean is that were not actually executing our code what were effectively doing is just a giants Belgian we're going to rejects for things that we think should be there and it sounds like what I possibly accomplish with that but when is really 1 of the best 1st things to grasp wanted we can grab a huge amount of value from just 2 simple tools as the 1st 4 letters style
the n I put styling your 1st because when I say that I think style and is important a lot of people ask often chuckled at it they like some OCD thing where any you know the proper spaces and tabs in 1 it sort is loaded in all honesty but I think this style is incredibly important I really do believe that style with your code can prevent of I put this picture here as a background but to illustrate the point of this is the phone from coming into a pedestal if you live in the suburbs you have 1 somewhere in your neighborhood somebody got the what stick and that's on the ones I inside is something like this right this is all to people's home phone lines and it works it is functional this awful at the same time and if a Pontiac that comes out to make a change in this the 1st thing they have to do is they have to grapple with everything that is wrong with this pile of cables and they have to dig through that have to understand what it is in our code is exactly the same and when a person makes a change here there a risk in dealing with this mess but they're making a change that's not what they intended they might bump on cables they might knock your phone line of God for video fax machine gun anymore and we don't want that in some is going on here your code no matter what unit you're a single ops person shop or you just alone devolver doing stuff someone 1 here that code at some point and they will have to read it they'll have to interpret it and we can do things within Ruby in within Schepers well that really are sometimes hard winter so we wanna make sure that were all on the same page in terms of stuff that said
1 is syntax and this is an incredibly important 1 but really dead simple room is a language Chavez language is both have rules to the language we have to follow those rules and if we have a missing and were missing due a block that's obviously not valid syntax and more in the last thing we wanna do is code up a wonderful nice cookbook uploaded to production and boom all burned nodes that so we can avoid that too breezily we can syntax check with their landing process we can make sure that what we have in fact valid Ruby code and then will fail in a different way but at least are Call run the the bio-ontological
so this is the 1 I think is really fun but we have chef the language we have the Ruby the language we can actually go through and see what you're doing within this code we engineer recommendations on things that might cause you problems you might be just incorrectly using something you might be using chapter unsafe way we might use using something that's going to be deprecated at some point we try not to do that so we need a little nudges to push you toward better code and we do that all up again ever running the code so I we
went with check we had to tools for landing
in the step world of 1st was called could style Our could style is a tool that we wrote that but it's really a wraparound RoboCup about is a really popular relented had a problem with that is it a review winter the Ruby has a different interpretation of the way something should be even we think about cookbook should work a chef cook book is not a Ruby application so we've bundle Robo Cop with a customized rule and we think this is a a rule set that's really good for writing cookbooks you can run this and you can get everybody on the same page you can interpret are a community cookbook or somebody's all using could silent everyone will have someone working and the cool thing within could style is that
it becomes a part practice so you know I just can't a bunch warnings go using bad spaces are like you know you need that extra comma somewhere it's just gonna fix it for you and and 95 per cent of these things will just be fixed automatically so you can take your existing code base just run could batch a against it and boom you're all on the same style and you can just keep that going forward was testing now that we have to at
worst could styles focus mostly on the styling and on unnatural Ruby food critic is actually written to look at what's going on with in your cookbook within primary the logic of a cookbook but also the syntax of the shaft and we haven't rules here we got but he said and think no are shipped like about 15 in the last month the you'll get which FTK 2 and a lotta rules particularly about doing things it is going to be broken by incorrectly using custom resources and all of Europe's and then lots and lots of rules about new deprecation surrenders so as you wanna migrate to shove 12 to shove 13 ships 14 you receive warnings within your code again before you ever run it before you ever installed that version of chapter you build a run food critic and see exactly what you have to update and here is an example out at
the output of its Kussmaul obviously others had 2 things you'll see here adds picked randomly cookbook on the supermarket this 1 was pretty good is that over there P it this is missing much of metadata fields of chemical tricky if you wanna share on the supermarket is a feels that working to fill in data there of also missing a license so some people want inviable consumers because you not properly telling them what the licenses and then it has the elder abuse is simply not doing the right things so warning you that you're not using online resources in using up thereby by last action so this is something that you can write it is valid chef coding it would run but it might not actually do what you think it through so reward you're at the back that your code might not give the desired outcome the while ago when using a like what is C 74 and
luckily we have nice documentation of who create I O has a documentation section for each rule can look at get a description what it is and you can see a little example of the before and after code in this case our just telling you that you were saying that the fall action wrong and there's a simpler way do so that's 1 thing
of an excellent talk about these you testing
I unit testing is when you're
looking at the individual components of the cookbook in a religious testing that given a certain set of inputs he'll get certain some outputs now this is really really important when you're writing Ruby applications are you can very easily test classes and methods full differ in the chef world we talk about that a
little bit I suspect that brings spec testing to Ruby it's just extensions on top of our spec was you write unit tests like they're just standard are spectators are inspect what's going on with a new chapter so this is just a simple example
cookbook uh I thought I was actually 7 model cookbook turned actually Jamie cookbook goes way
back and this is my face so it's really simplified here but this looks a lot like a lot of cookbooks books that we have out real world this is the packaging it's installed a some sort of configuration it happens in a servicing its managed in restoring 1 and we're right shift vector it looks something like this right the person receives this is actually larger than the codebook but in also harder to read than the book has already done the individual sections in what is what is happening here a high level of so and I and I'm just bad because it's crazy complex and heart of the 1st part
is that we're setting up a shop soul run and we're doing that using data right so we might be testing us on my Mac were not on abilities 1604 box but we needed to look like and to 1604 box so we have data for each major operating system we can mark out this ability 1604 box and then we can do in in memory converge of shaft so that again we're out running chaff nothing's happening on your local system were just seemed sort of what would happen when sharper yeah and then once
ships run we can actually do a bunch of different tests on it so we're gonna describe what we're testing the top case there's installing the package and then we can say what we expect so we expect the package was right that's all right except
stolen I and I I really
can't stress enough here that that is most worthless just back up that unfortunately it's what most people use I chance back is a really great tool for a lot of people but unfortunately a lot of cookbooks simply don't need you to and the example there's less art so we
have 3 resources and a codebook and we have 3 very simple I suspect tests and that 1 to 1 mapping tells me around the bad that we don't actually have any logic there's nothing to test because there's no logic if you write out the package should be installed and then you rather suspect that says the package was installed United Tessier cookbook about what you're actually testing chapter and we are test so you should probably does not do that and they see a lot of people who say you know I need a hunter beside code-coverage have test but ships that is for the lot so test the logic
and you should test the logic the you have very well but if you could lacks logic of it looks like that previous could put them don't test just skip shafts back now what if or my face cookbook
was a little bit more complex if not just supporting a boon to know we need to support sent us and said that might have a different package 1 now we have a lot right now we have a different package acid installed on different platforms so we can actually test at this point it we can converge to different platforms now this is a real cepstra that this will actually deliver some value to our company is someone did refactoring later on in a you know messed with that case statement we had an if statement that we had to changed what that package name was this whole word us that it doesn't work but there's a 2nd warning
and that is that even perfect suspect
even that's back before really don't catch most the filters we have and the reason is that when you're writing a cookbook what
we're doing is we're codifying assumptions and or making a lot of assumptions were 1st right back book so in this simple example here the 1st thing is does my face the package exist do we have a repository installed because of I simply Tesla trying to install the package in my spec says that the package was installed all never catch the fact that the package doesn't even exist in repository is this a valid configuration do new version my face come out that no longer accept some syntax and that is that service in there is there no longer maybe assist the init script need can this even start so assessment won't catch those real failures and that we need
integration testing and this is really the important part within chapter we want to do that integrate great all of our
software together not just a cookbook but are dependencies we want test them all together we wanna do that in a way that looks as much like production possible so that's going to be a real Scheffer right this run here
totally not something you can comprehend read but like were actually testing the cookbook also currencies a coming together it's been compiled it's converging if we're trying to install package a package has to exist within the repository it's a real run right and for
that we have trusted you test kitchen is a super great
tool I lets us create a simple little yellow like this and converge multiple scenarios 1 multiple platforms so in this case what we're going to do is we're going to set the system up where convergent vagrant this can be different things if we want if a driver so we could converse on OpenStack a AWS are as you're boring convergent variant which is the run locally map with virtual box where you shed 0 the provision that's going make it look as much like a ship server as we possibly can and then it will toggle the later but we're verify using inspect so this is far platforms go converge on water from platforms there we have sent us a boon to recent releases these there from a bento projects so as new releases of free distrust come our costly be delivering more than 2 images c always say always you know 1 cent 7 4 comes out I want us on that that's where using production there will be a 7 for the image here you can pull down automatically and then this is the actual red but here we actually have to test something right sorry converge to different suites here 1 is going to be a client installed my face whatever that would be and then the other 1 is going to be a server install and the part the point here is that we using test recipes and I really wanna do
yourself a favor right a real test recipe this gives you the real life scenario of how the cookbook actually come together if you have elderly appeaser Custer resources you can utilize them with test recipe then execute them in different scenarios if you have dependencies need be installed 1st you can put those all your test recipe and really test the way that this cookbook would get used in production but we put them
all again yet that's right simple outputs we have 8 different converges will be doing here and we can run kitchen converge probability systems out we can log into them if we need a trouble shoot them or we say kitchen test it would build a long-term down but did it actually
work right because you want as your
business not mine my business is converging chef knows your business is whatever you do and for that node is simply converge doesn't mean it actually works so that we need and back
end result arteritis Bacolod
City I got a brief description of what we can do that from a compliance world but it's really a hugely powerful tool we're talking about kitchen testing allows us to write really really simple or respect us pay actually look a lot like the chefs vectors but these are running against the real node right we've converge this node and test kitchen and now we can check it and verify so we know that the system is actually the way assessment production or it's great because the 2 built-in resources I nosy to build resources allow us to do all kinds of cool testing so we can test the outcomes are chef resources we can look at all the basic things like packages and directories in groups or we can dig a little bit deeper into system invades we can look at Robbins network bonding in Windows features and services are and we're also building a lot more application configuration things and again this is what powers the compliance of product so you see more more people that want to actually check the compliance of their applications you're gonna see those resources come and inspect were doing about release so we back in every releases come new resources this time goes on you have more more things more helpers to lie is simply test and say can I connect the poster I want have to do a shell out to that I wanted to simply say like to pose work is system is there the so this is what our test look like pull this out of our our Tomcat cookbook so it seems like it's a weird thing the test which has a file of and were checking to see that the directory if it has a owner right group differ mode are this was being used with a custom resource we haven't Tomcat cookbook and were actually executing that that resource in different ways and this test is formulated to make sure that all the different properties were set on resource are actually working so very simple way to make sure that what we wrote all of our assumptions and expectations are actually coming out and I get the sunday I guess
this is this is confidence really like this is me conversion of full cookbook on platform and think it needs maybe 30 or 40 different things that I expect to be there we want to make sure they
were writing or test actually check for a desired outcome In what follows is our outcomes this this is 1 of the most important things I see people often do this in the test where they don't they don't test the right thing if there in a really elegant has married in using you know full automation about test kitchen writing inspect running but what the testing is not delivering the value that they need 1 make sure that we
balance both system outcomes and business so in the 1st example I used there I was testing a bunch of things like file mode and users in groups that making sure my system or making sure that when a person put an input on a property for a custom resource but not the desired output for my business doesn't care about who owns the Tomcat but business cares Tomcat works so 1 make sure that not only riding your kind of CIS add meaning to us but also the test just make sure that this is going to do the function has the business the Tomcat server can I get response back is that response at 200 is validated it's made the I like what city API elicits assessment points with mention the performance was checked the response times is things actually matter to your business because they'll care that the application is there don't care the services started me quite frankly check that the service start To set the a so we have all this we have a perfect test where do we stand at
this point right we've done a whole bunch of
different tools to give us a slew of different kinds of testing but how do we actually
run these tools I don't expect you sit down and type could style over time from Greek every time we need a nice way to bring this altogether we need a
nice way to automatically do it for all over to so the 1st thing to talk about is the
local so this is part of Chap decay this is something there are delivery team actually wrote for a cookbook engineering team because we had exactly this problem how do I run at all my tests over and over again and had a legume across all my structure
while delivery local uh gives the ability to write this really simple pommel file here it defines a bunch of phases very similar if you use automated tool we have an automated but actually runs entirely local you're not using cookbooks for this year this using a simple Tom of file in these phases you justifying the command you are so we 17 phase is going to be cooked style or syntax Faisal be food will around the phase we just gap the but you probably have more than 1 cookbook I really hope that
your business is not 1 cookbook and so managing these files becomes really burdensome what if there's a food Krycek you don't think is important to you we can turn that often but you want turned off in say 100 cookbooks because that's what I used have do when it was really a pain the shuffling around things like rape files food Kirk things well the really neat thing you get with the delivery local load is you can delete
that entire file his point to Europe and then you can put the contents of what you want to follow like in that page so in the cookbook world in committee composed we have a single guessed that is just what we want to look like in any time around this small clearing time around in a CI system anytime time anyone runs at all my other developers the community there always getting the latest updates so if I want change the way people test cookbook I just do it in the remote file and everyone gets it every time you and
thereby run locally like this is that it's delivery local all the all is that I'm running all those phases by Wanderone just the syntax over a local syntax but I'm just alert local all a get a nice little output of all the time but I will obviously
lorandite automatically right I'm not expecting my developers to run this locally on the system every time because they quite frankly there what someone will skip but at some point you'll forget and that'll be the time you introduce a breaking change so we need a CI system right then we have 1 you can buy
it Brady should get i'd have mortgages news repaired I'm would
you don't have a lot of because maybe open source only maybe you're not at that scale for on server not everybody in you know necessarily needs that infrastructure while we can definitely make this work becomes a lot harder but we can do it and we can bring in Travis CI
of unfortunately as soon as we get into a sassy I system were insulin was a lot of control right were not running this nightmare already and Jenkins we don't have control over what's happening on the builders and there's a lot of security concerns for that CI system so they're model let us run everything we want or we can just kitchen vagrant so instead what we're gonna have to
do the kitchen doctor that in darkened is something that shown Amero when he was on our our new could team and he wrote this so that we can actually run test kitchen not just quickly for him locally but also somewhere we can run in and it's just
another driver progestogen so it looks a lot like we had with bigger but instead of being bigger and it's basically docking dog knocking the control the whole thing it actually takes over for shaft but it doesn't even use the full shaft quite install uses its own container of shaft which makes it even faster but that lets us do some
great things with wonderful wonderful warnings and that is that now we're testing and uh and Dr. containers kind
libel but when words are still not pulled into mass of 400 AD made image and that is a compressed data box right this that's not just an uncompressed horrible thing as for 1818 packages and configs and everything it takes to be of interest but now we go to that same thing in a container and its 47 so what's the difference it's not magical darker compression that's missing a lot of things right that docker containers not meant to be a VM it's not a stand in for a system it was meant for us to run a node app or Ruby after something on so we need to do their work
to kind of hack those containers to look like they're actually and this is 30 dirty stuff but it does work so we're
gonna do is reinstall want to stop right we need systems MiniPak images we need network tools process tools a whole bunch of things and they will different every platform in every version of that platform and thankfully we've already done so we have a nice example repo here also again at the end of that exemplary below has an example of how we set up kitchen docking and all the things we need for it to actually you know bill stars system the service
so within that kitten docking and Fig again as it looks a lot like the kitchen Megan conveyed but obviously now a configuring a container so what we're doing just a simple example here were set in the center last 6 image our grab that from Dhaka have our setting the PID 1 command that's basically allowing us actually start a service and our run using it and then the intermediate instruction here is to install into practice not 1st talking about we have to make this and look a little bit more like a real sent system in order to do that we need simple things like net tools because otherwise we can check portal but once we have that always we put that all together we have these systems the look like it we have a really nice fast
pitcher baskets runs a can be any desktop but also faster to run the can be interesting so how does that look in Travis well again it's a
nice huge conveying the should always copy from us are in this view different things are going on in there and I'll quickly go over them but basically we install step decay within Travis the chef decay is an approved repository would Travis so you can install it writing a chaperone are writing attraversa and that means that you're not test gems anymore you're actually testing the same way you test on a workstation and the set up is gonna be the same as when you go a production which our internal on doctor obviously we need Dr. are we're going to define each of the different systems were around so in this case I'm just going to converge for different instances only 1 sweep on for different platforms reducing boring stuff to make sure that i the tables is set up and all the Sheptycki binaries available for us they were going to run it all and then the last part there is you see we inject 1 more job and that's because we want to split out all of our non test kitchen stuff into its own job dry and I mean that if somebody accidentally put an extra space in output style fails it doesn't fail every single 1 of things makes it much more pair out failed and we put that altogether i we get something like this then I cannot
stress how often it is to have these come this is a PR that someone opened up again soberness age they wanna make a simple conveying change but I don't know 2nd the change introduces braking problems across other platforms it might who knows I so worried converge on the spot right where converging on a boon to in deviance and toss and even open seas and they were also gonna run all markets down through critic Chaps back the union went into and that entirety of that testing rate 5 minutes some 5 minutes I have confidence that this is gonna work and that's really
just confidence that I'm not gonna burn my at the structure of the graph and as the person riding ranking a some other burn your infrastructure as I really hope that doesn't happen but that also very importantly just brings value to our
business and at the end of the that's what this is actually about right we want to be able to know that if we take a simple configuration change that we think of we can make that we can take it through a series of testing we can deploy it would confidence and we can actually achieve our business 1 so I
go and tested the structure I disaster you don't write bad checks vector that's my only ask here and as the example repository there's a ton of great stuff in there and you can kind of look also at all the various commute cookbooks they do the same thing were test everything interests um and yet the block FIL there are many questions this real quick to test
cookbook you mention that before yes you have you know that the the Fisher generate cookbook you'll get your base cookbook is incorrect these polar useful the false create another cookbook within their that's just for testing so particularly you start to move to writing resources instead of actual recipes new nature that that resource such it works right so in indicates the Tomcat cookbook that we ship is no recipe for target readership 3 resources to work with Tomcat so we need to build a test that's we have to create a recipe they can actually go through and so Tomcat server of that recibido snapped up they install Java you know pulled out a war file after Tomcat up starts at we can make sure that that's that's a real sight of the way so we use it because not all of our recipes are things that er cookbooks are things we directly applied when node they might be a cookbook that we're consuming from another so we still amateur we test that we have figure out the full test and also as you like in the presented through 1 of the things really because you are in a that they really worth all of the data so that there is an stood the place I can find good examples of chefs spect tests and are there some cookbooks where I just 1 1 have any task as an unheated but this is not the reason that the promise and understand the need to use it the little right there in 1 lattice they're like you some of we have got worse supporters of the lack of word on it so you get a simple and what happened in the PC and this is something like the theory in a way that the task of often work so directly on the history of some of the test variable is the work of the what it not copies 1 1 of the the same things that you yourself are doing all they don't care about the work what you is so it was hoped that the only thing over this common in this part of the user at all about the realities of just not the the but the problem is that in the past so you mentioned bento boxes and then with dock and you have to put a few packages on there but I do be Bendel containers in the feature yeah there something about the the the what we used to have a bad thing so that should knew that was going to say about around here we would have a actual share a lot of users who in the article that you actually what you would have to use all of the problem that has lost me 2 of course in the article work that would work the use of the virtual lots of parallel here and doing all the work you use this year the technology is also a lot of platforms and this is really about a lot of pressure that in the work of world in poetry traversal of the categories I I really like this and I had this which I
so based on your presentation what is that all linked to that that of writing a chef spec test as opposed to like inspector slaking mention like this chef spec basically test to see if you shift code works but you better e st convergence hurdy does that so I I guess into strain is see the difference to me it makes much more sense to do integration testing but I'm just trying to see what the point of ships but would be a good time to do that so you write that over the past 5 but that wouldn't take 5 minutes on my laptop and if I was doing that with data and not with kitchen docking fire actually get for convergence of a real system there I could be spending a long time and it does a simple examples of packages like that's that's 5 minutes to run open as the stage where SSH D elegant figures dropped but what if I'm doing something that is very complex system set up I Can be testing of right through 4 hours so where entering just back in a minute get back a whole bunch of convergence I can set attributes differently I can go through a bunch of different scenarios of different versions of you know say 3 Abuja versions and 3 versions with different attributes that here and there in different recipes use up and you can have hundreds of different pretations of what that test so it's like that storms and you through this further in the the long that go up test kitchen allows you to do like tests 1 by 1 is there some way to you have deployed so I true release this is at the same time you of the clusterization will replication with the power so we don't have enough clusters and test about some there comes up a lot it adds a huge amount of complexity because you can't get into test kitchen needing to be an orchestrator witches really beyond the scope of test kitchen I we thought about how we can do it in a simple way and the problem is as soon as we introduce something that's the simple way of people are gonna walk all the different versions of become the complex way and we built this massive orchestration of things within 5 but it can you know it if you wanna run more than 1 test that's the same test but more than 1 at a time like in this scenario that where we had 8 different total test you could concurred that and that's pretty handy if you're testing and so using 2 or something it's the the boxes at the same time the cool prevails has any questions about immutable marooned deftly always on CMU's lectures so few