Test Driven Development
and
Puppet
Jan & Johan
And We Are ? -> Johan
Open Source Consultant @ open-future
● Puppet addict ( and still learning ...)
● Member Belgian Puppet User Group
● A Sys-Admin
● A very poor developer (but working on it)
●

●

Convinced that (automated) testing is important

●

Email: johan@open-future.be
Why this talk ?

●

We want to do it the 'good' way -> TDD

●

rspec-puppet.com – rspec for modules

●

...

●

No docs found, any pointers ?

●

Looking at the puppet code to learn
What is Test Driven Development

Source http://centricconsulting.com/agile-test-driven-development/
Benefits of TDD
●

Test case from the beginning

●

Tests are maintained during life cycle

●

Small moves – coding just to pass test

●

Encourage simple design

●

First step in test automation
TDD does not
●

Replace integration testing

●

Replace compliance testing

●

.......
TDD for a sysadmin
●

We have to learn developing

●

Huge mindshift

●

Culture schift

●

Rspec for modules is ok
–

●

Writing modules is already adopted by sysadmin
see Rspec-puppet.com => tutorial

Rspec for type/providers
–

Still looking for docs

–

Use the (puppet) source
Filling the gap ...
●
●

●

Initial attempt write Type using TDD
https://github.com/Open-Future-Belgium/pupp
et_rspec_demo
In need of help (i'm kind of stuck)

●

Looking for input how to do it right

●

Hopefully it results in a good tutorial

●

....
A Simple TDD Type session
A Simple TDD Type Session - spec
A Simple TDD Session - test
A Simple TDD Session - code
A Simple TDD Session - test
A Simple TDD Session - rspec
A Simple TDD Session - test
A Simple TDD Session - rspec
A Simple TDD Session - Test
A Simple TDD Session - Code
A Simple TDD Session - test
A Simple TDD Session - rspec
A simple TDD Session - test
A Simple TDD session - code
A simple TDD Session
●

And we could go on ... forever
A simple TDD Session - rspec
A Simple TDD Session - test
A Simple TDD Session - code
A Simple TDD Session - test
Rspec books
More TDD
Test driven development_and_puppet-cfgmgmtcamp_eu-20140402
Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

  • 1.
  • 2.
    And We Are? -> Johan Open Source Consultant @ open-future ● Puppet addict ( and still learning ...) ● Member Belgian Puppet User Group ● A Sys-Admin ● A very poor developer (but working on it) ● ● Convinced that (automated) testing is important ● Email: johan@open-future.be
  • 3.
    Why this talk? ● We want to do it the 'good' way -> TDD ● rspec-puppet.com – rspec for modules ● ... ● No docs found, any pointers ? ● Looking at the puppet code to learn
  • 4.
    What is TestDriven Development Source http://centricconsulting.com/agile-test-driven-development/
  • 5.
    Benefits of TDD ● Testcase from the beginning ● Tests are maintained during life cycle ● Small moves – coding just to pass test ● Encourage simple design ● First step in test automation
  • 6.
    TDD does not ● Replaceintegration testing ● Replace compliance testing ● .......
  • 7.
    TDD for asysadmin ● We have to learn developing ● Huge mindshift ● Culture schift ● Rspec for modules is ok – ● Writing modules is already adopted by sysadmin see Rspec-puppet.com => tutorial Rspec for type/providers – Still looking for docs – Use the (puppet) source
  • 9.
    Filling the gap... ● ● ● Initial attempt write Type using TDD https://github.com/Open-Future-Belgium/pupp et_rspec_demo In need of help (i'm kind of stuck) ● Looking for input how to do it right ● Hopefully it results in a good tutorial ● ....
  • 10.
    A Simple TDDType session
  • 11.
    A Simple TDDType Session - spec
  • 12.
    A Simple TDDSession - test
  • 13.
    A Simple TDDSession - code
  • 14.
    A Simple TDDSession - test
  • 15.
    A Simple TDDSession - rspec
  • 16.
    A Simple TDDSession - test
  • 17.
    A Simple TDDSession - rspec
  • 18.
    A Simple TDDSession - Test
  • 19.
    A Simple TDDSession - Code
  • 20.
    A Simple TDDSession - test
  • 21.
    A Simple TDDSession - rspec
  • 22.
    A simple TDDSession - test
  • 23.
    A Simple TDDsession - code
  • 24.
    A simple TDDSession ● And we could go on ... forever
  • 25.
    A simple TDDSession - rspec
  • 26.
    A Simple TDDSession - test
  • 27.
    A Simple TDDSession - code
  • 28.
    A Simple TDDSession - test
  • 29.
  • 30.