test driven development_and_puppet-cfgmgmtcamp_eu-20140402

32
Test Driven Development and Puppet Jan & Johan

Upload: johandw

Post on 13-Jan-2015

731 views

Category:

Technology


0 download

DESCRIPTION

The slides of the talk i did on cfgmgmtcamp.eu, frebruary 4th 2014, looking at test driven development. This part is focused on the development of a custom puppet type

TRANSCRIPT

Page 1: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

Test Driven Developmentand

Puppet

Jan & Johan

Page 2: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

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: [email protected]

Page 3: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

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

Page 4: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

What is Test Driven Development

Source http://centricconsulting.com/agile-test-driven-development/

Page 5: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

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

Page 6: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

TDD does not

● Replace integration testing● Replace compliance testing● .......

Page 7: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

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

Page 8: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402
Page 9: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

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● ....

Page 10: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Type session

Page 11: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Type Session - spec

Page 12: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 13: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - code

Page 14: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 15: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - rspec

Page 16: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 17: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - rspec

Page 18: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - Test

Page 19: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - Code

Page 20: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 21: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - rspec

Page 22: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A simple TDD Session - test

Page 23: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD session - code

Page 24: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A simple TDD Session

● And we could go on ... forever

Page 25: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A simple TDD Session - rspec

Page 26: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 27: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - code

Page 28: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

A Simple TDD Session - test

Page 29: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

Rspec books

Page 30: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402

More TDD

Page 31: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402
Page 32: Test driven development_and_puppet-cfgmgmtcamp_eu-20140402