your configured code on one or more platforms in isolation." a development utility that provides quick, iterative feedback on code by converging on and running tests against a running machine. a tool that helps speed up your infrastructure QA cycle. an open source project maintained primarily by Fletchor Nichol. distributed as a RubyGem 2 / 25
Manually test against a live development environment. Test manually against a one Vagrant box at a time. Distribute test code to your node as part of your cookbook and use a Chef Handler like Chef MiniTest Handler to execute tests. The New Way Test multiple platforms in parallel. Keep test code separate from your cookbook. Integration with Continuous Integration / Continuous Delivery. 10 / 25
machine used to test your code. Provisioner Built-in code responsible for executing your infrastructure code on the machine. Platform List of operation systems on which we want to run our code using the specified Driver. Suite Defines the scope of the test including what policy to apply (Chef run_list, Puppet Manifest, Ansible Playbook, etc) and which tests to run. Busser RubyGem plugin configured as part of the Suite that executes tests on your instance. 16 / 25
gems. $ g e m i n s t a l l t e s t - k i t c h e n Once the gem is installed, initialize a working directly. This can either be a chef-repo, a cookbook, or any other directory. $ k i t c h e n i n i t c r e a t e . k i t c h e n . y m l c r e a t e t e s t / i n t e g r a t i o n / d e f a u l t r u n g e m i n s t a l l k i t c h e n - v a g r a n t f r o m " . " S u c c e s s f u l l y i n s t a l l e d k i t c h e n - v a g r a n t - 0 . 1 4 . 0 1 g e m i n s t a l l e d The output of this initialization command is: a configuration template (. k i t c h e n . y m l ) a skeletal framework for tests (t e s t / i n t e g r a t i o n / d e f a u l t ) the installation of the default Driver (k i t c h e n - v a g r a n t ) 17 / 25
a g r a n t p r o v i s i o n e r : c h e f _ z e r o p l a t f o r m s : - n a m e : u b u n t u - 1 2 . 0 4 d r i v e r _ c o n f i g : b o x : v a g r a n t - u b u n t u - 1 2 . 0 4 b o x _ u r l : h t t p : / / f i l e s . v a g r a n t u p . c o m / p r e c i s e 6 4 . b o x r e q u i r e _ c h e f _ o m n i b u s : t r u e r u n _ l i s t : - r e c i p e [ a p t ] s u i t e s : - n a m e : d e f a u l t r u n _ l i s t : - r e c i p e [ p o s t f i x ] - r e c i p e [ m y s q l : : s e r v e r ] - r e c i p e [ g h o s t : : d a t a b a s e ] - r e c i p e [ g h o s t : : d e f a u l t ] - r e c i p e [ g h o s t : : n g i n x ] a t t r i b u t e s : m y s q l : b i n d _ a d d r e s s : " 1 2 7 . 0 . 0 . 1 " s e r v e r _ r o o t _ p a s s w o r d : " f o o b a r " s e r v e r _ r e p l _ p a s s w o r d : " f o o b a r " s e r v e r _ d e b i a n _ p a s s w o r d : " f o o b a r " 18 / 25
t I n i t i a l i z e d e m p t y G i t r e p o s i t o r y i n / s o m e / l o c a l / d i r e c t o r y $ k i t c h e n i n i t i d e n t i c a l . k i t c h e n . y m l c r e a t e . g i t i g n o r e a p p e n d . g i t i g n o r e a p p e n d . g i t i g n o r e r u n g e m i n s t a l l k i t c h e n - v a g r a n t f r o m " . " S u c c e s s f u l l y i n s t a l l e d k i t c h e n - v a g r a n t - 0 . 1 4 . 0 1 g e m i n s t a l l e d If k i t c h e n i n i t is run inside of a git repository, it will configure your . g i t i g n o r e file to ignore the . k i t c h e n directory and . k i t c h e n . l o c a l . y m l . k i t c h e n directory is where all the run-time data is stored (including running . v m d k s ) . k i t c h e n . l o c a l . y m l is helpful when there are private values (passwords, secret keys) and overrides to the default . k i t c h e n . y m l . 20 / 25
great care to ensure that exit codes are always appropriate. Test Kitchen will always exit with code 0 if all operations were successful. Test Kitchen will always exit with non-zero if any part of the operation was unsuccessful. This exit code behavior is fundamental for its use in CI/CD pipelines. 22 / 25
is how'll you'll refer to the VM { s u i t e } - { p l a t f o r m } with punctuation taken out D r i v e r is the Driver that will be used to control the I n s t a n c e P r o v i s i o n e r is the Provisioner that will be used to converge the I n s t a n c e L a s t A c t i o n shows the status of the I n s t a n c e N o t C r e a t e d C r e a t e d - I n s t a n c e is running but has not been converged. C o n v e r g e d - P r o v i s i o n e r has successfully run on the I n s t a n c e . V e r i f i e d - k i t c h e n v e r i f y has returned with no errors. 23 / 25
l e a n i n g u p a n y p r i o r i n s t a n c e s o f < d e f a u l t - u b u n t u - 1 2 0 4 > 2. Creates the instance C r e a t i n g < d e f a u l t - u b u n t u - 1 2 0 4 > 3. Converges the instance C o n v e r g i n g < d e f a u l t - u b u n t u - 1 2 0 4 > 4. Sets up Busser and runner plugins on the instance S e t t i n g u p < d e f a u l t - u b u n t u - 1 2 0 4 > 5. Verifies the instance by running Busser tests V e r i f y i n g < d e f a u l t - u b u n t u - 1 2 0 4 > 6. Destroys the instance D e s t r o y i n g < d e f a u l t - u b u n t u - 1 2 0 4 > 24 / 25