SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
Cucumber-puppet
Nikolay Sturm
16.10.2010 @ DevOpsDays
Europe, Hamburg
Image by flickr user tupwanders
The olden times
Our legacy configuration management system was inflexible but
hard to break.
Image by flickr user zoofythejinx
The new times
Puppet is like a programming
language.
Code breaks
# puppetd --test
info: Retrieving plugin
info: Caching catalog for some.host
err: Could not run Puppet configuration client: Could
not find dependency Package[foo] for File[/etc/foo.conf]
at /puppet/production/modules/foo/manifests/init.pp:12
A cucumber feature [1/3]
Feature: Install inetd
In order to run certain services
The inetd service
Must be installed
Scenario: Setup inetd
Given a node of class "inetd"
When I compile the catalog
Then package "inetd" should be "installed"
Then there should be a resource "Service[inetd]"
And the service should have "enable" set to "true"
And the state should be "running"
And the service should require "Package[inetd]"
A cucumber feature [2/3]
Feature: Install inetd
In order to run certain services
The inetd service
Must be installed
Scenario: Setup inetd
Given a node of class "inetd"
When I compile the catalog
Then package "inetd" should be "installed"
Then there should be a resource "Service[inetd]"
And the service should have "enable" set to "true"
And the state should be "running"
And the service should require "Package[inetd]"
A cucumber feature [3/3]
Feature: Install inetd
In order to run certain services
The inetd service
Must be installed
Scenario: Setup inetd
Given a node of class "inetd"
When I compile the catalog
Then package "inetd" should be "installed"
Then there should be a resource "Service[inetd]"
And the service should have "enable" set to "true"
And the state should be "running"
And the service should require "Package[inetd]"
Cucumber step definitions [1/2]
Given /^a node of class "([^"]*)"$/ do |klass|
@klass = klass
end
When /^I compile the catalog$/ do
compile_catalog
end
Then /^package "([^"]*)" should be "([^"]*)"$/ do |p, s|
steps %Q{
Then there should be a resource "Package[#{p}]"
And the state should be "#{s}"
}
end
Cucumber step definitions [2/2]
Given /^a node of class "([^"]*)"$/ do |klass|
@klass = klass
end
When /^I compile the catalog$/ do
compile_catalog
end
Then /^package "([^"]*)" should be "([^"]*)"$/ do |p, s|
steps %Q{
Then there should be a resource "Package[#{p}]"
And the state should be "#{s}"
}
end
Unit-testing a puppet class
Feature: Install inetd
In order to run certain services
The inetd service
Must be installed
Scenario: Setup inetd
Given a node of class "inetd"
When I compile the catalog
Then package "inetd" should be "installed"
Then there should be a resource "Service[inetd]"
And the service should have "enable" set to "true"
And the state should be "running"
And the service should require "Package[inetd]"
Unit-testing a puppet class . . . not so good
Then package "inetd" should be
"installed"
Then there should be a resource
"Service[inetd]"
And the service should have
"enable" set to "true"
And the state should be "running"
And the service should require
"Package[inetd]"
class inetd {
package { "inetd":
ensure => installed,
}
service { "inetd":
enable => true,
ensure => running,
require => Package["inetd"],
}
}
A catalog policy to document rules
Feature: General catalog policy for all nodes
In order to ensure applicability of a node’s catalog
As a manifest developer
I want all catalogs to obey some general rules
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/my.host.yaml"
When I compile its catalog
Then compilation should succeed
And all resource dependencies should resolve
And all files should have an owner, group, and mode
And the node should have accounts for admins
A catalog policy operates on a real node’s catalog
Feature: General catalog policy for all nodes
In order to ensure applicability of a node’s catalog
As a manifest developer
I want all catalogs to obey some general rules
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/my.host.yaml"
When I compile its catalog
Then compilation should succeed
And all resource dependencies should resolve
And all files should have an owner, group, and mode
And the node should have accounts for admins
A catalog policy deals with catalog wide properties
Feature: General catalog policy for all nodes
In order to ensure applicability of a node’s catalog
As a manifest developer
I want all catalogs to obey some general rules
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/my.host.yaml"
When I compile its catalog
Then compilation should succeed
And all resource dependencies should resolve
And all files should have an owner, group, and mode
And the node should have accounts for admins
A catalog policy avoids the duplication trap
Feature: General catalog policy for all nodes
In order to ensure applicability of a node’s catalog
As a manifest developer
I want all catalogs to obey some general rules
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/my.host.yaml"
When I compile its catalog
Then compilation should succeed
And all resource dependencies should resolve
And all files should have an owner, group, and mode
And the node should have accounts for admins
A catalog policy can be generated
Feature: General catalog policy for all nodes
@host_one
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/host.one.yaml"
When I compile its catalog
Then compilation should succeed
@host_two
Scenario: Compile and verify catalog for my.host
Given a node specified by "nodes/host.two.yaml"
When I compile its catalog
Then compilation should succeed
Tags are your friends
$ cucumber-puppet --format progress 
features/catalog/policy.feature
.............................................
25 scenarios (25 passed)
275 steps (275 passed)
0m50.679s
$ cucumber-puppet --format progress --tags @host_one 
features/catalog/policy.feature
...........
1 scenario (1 passed)
11 steps (11 passed)
0m4.731s
And it actually finds mistakes
$ cucumber-puppet --format progress --tags @host_one 
features/catalog/policy.feature
.........F-
(::) failed steps (::)
Service[inetd] cannot require Package[inetd], not in catalog. (RuntimeError)
features/catalog/policy.feature:75:in ‘And all resource dependencies should resolve’
Failing Scenarios:
cucumber features/catalog/policy.feature:65
# Scenario: Compile and verify catalog for host_one
1 scenario (1 failed)
11 steps (1 failed, 1 skipped, 9 passed)
0m4.877s
Contact:
Nikolay Sturm
sturm@erisiandiscord.de
@nistude
http://blog.nistu.de/
http://github.com/nistude/cucumber-puppet
http://projects.puppetlabs.com/projects/cucumber-puppet
Image by flickr user darwinbell

Contenu connexe

Tendances

Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0Elena Kolevska
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Michael Peacock
 
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache ZookeeperCentralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache ZookeeperRyan Gardner
 
CouchDB: A NoSQL database
CouchDB: A NoSQL databaseCouchDB: A NoSQL database
CouchDB: A NoSQL databaseRubyc Slides
 
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptx
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptxEX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptx
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptxvishal choudhary
 
Django REST Framework
Django REST FrameworkDjango REST Framework
Django REST FrameworkLoad Impact
 
CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolscharsbar
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using GitSusan Potter
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackOpenStack
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Puppet Camp Charlotte 2015: Exporting Resources: There and Back Again
Puppet Camp Charlotte 2015: Exporting Resources: There and Back AgainPuppet Camp Charlotte 2015: Exporting Resources: There and Back Again
Puppet Camp Charlotte 2015: Exporting Resources: There and Back AgainPuppet
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper Omid Vahdaty
 
Multinode kubernetes-cluster
Multinode kubernetes-clusterMultinode kubernetes-cluster
Multinode kubernetes-clusterRam Nath
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureAntons Kranga
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014Puppet
 

Tendances (20)

Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
Kitura Todolist tutorial
Kitura Todolist tutorialKitura Todolist tutorial
Kitura Todolist tutorial
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Powerful and flexible templates with Twig
Powerful and flexible templates with Twig Powerful and flexible templates with Twig
Powerful and flexible templates with Twig
 
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache ZookeeperCentralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
 
CouchDB: A NoSQL database
CouchDB: A NoSQL databaseCouchDB: A NoSQL database
CouchDB: A NoSQL database
 
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptx
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptxEX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptx
EX-6-Implement Matrix Multiplication with Hadoop Map Reduce.pptx
 
Django REST Framework
Django REST FrameworkDjango REST Framework
Django REST Framework
 
CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its tools
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Doctrine in FLOW3
Doctrine in FLOW3Doctrine in FLOW3
Doctrine in FLOW3
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStack
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Puppet Camp Charlotte 2015: Exporting Resources: There and Back Again
Puppet Camp Charlotte 2015: Exporting Resources: There and Back AgainPuppet Camp Charlotte 2015: Exporting Resources: There and Back Again
Puppet Camp Charlotte 2015: Exporting Resources: There and Back Again
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
 
Celery with python
Celery with pythonCelery with python
Celery with python
 
Multinode kubernetes-cluster
Multinode kubernetes-clusterMultinode kubernetes-cluster
Multinode kubernetes-cluster
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven Infrastructure
 
Apache Cassandra and Go
Apache Cassandra and GoApache Cassandra and Go
Apache Cassandra and Go
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014
 

Similaire à Cucumber-puppet

The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - TryoutMatthias Noback
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)HungWei Chiu
 
Greenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startGreenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startDavid Danzilio
 
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringAlessandro Franceschi
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Puppet
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppOlinData
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to KubernetesPaul Czarkowski
 
The state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinThe state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinNida Ismail Shah
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrapeSharad Aggarwal
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to dockerAlec Clews
 
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupKubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupStefan Schimanski
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 

Similaire à Cucumber-puppet (20)

The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 
Greenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startGreenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the start
 
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
 
Puppet
PuppetPuppet
Puppet
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
Pharos
PharosPharos
Pharos
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
Extending Kubernetes
Extending KubernetesExtending Kubernetes
Extending Kubernetes
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
 
The state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinThe state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon Dublin
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrape
 
Novices guide to docker
Novices guide to dockerNovices guide to docker
Novices guide to docker
 
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupKubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 

Dernier

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Dernier (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Cucumber-puppet

  • 1. Cucumber-puppet Nikolay Sturm 16.10.2010 @ DevOpsDays Europe, Hamburg Image by flickr user tupwanders
  • 2. The olden times Our legacy configuration management system was inflexible but hard to break. Image by flickr user zoofythejinx
  • 3. The new times Puppet is like a programming language.
  • 4. Code breaks # puppetd --test info: Retrieving plugin info: Caching catalog for some.host err: Could not run Puppet configuration client: Could not find dependency Package[foo] for File[/etc/foo.conf] at /puppet/production/modules/foo/manifests/init.pp:12
  • 5. A cucumber feature [1/3] Feature: Install inetd In order to run certain services The inetd service Must be installed Scenario: Setup inetd Given a node of class "inetd" When I compile the catalog Then package "inetd" should be "installed" Then there should be a resource "Service[inetd]" And the service should have "enable" set to "true" And the state should be "running" And the service should require "Package[inetd]"
  • 6. A cucumber feature [2/3] Feature: Install inetd In order to run certain services The inetd service Must be installed Scenario: Setup inetd Given a node of class "inetd" When I compile the catalog Then package "inetd" should be "installed" Then there should be a resource "Service[inetd]" And the service should have "enable" set to "true" And the state should be "running" And the service should require "Package[inetd]"
  • 7. A cucumber feature [3/3] Feature: Install inetd In order to run certain services The inetd service Must be installed Scenario: Setup inetd Given a node of class "inetd" When I compile the catalog Then package "inetd" should be "installed" Then there should be a resource "Service[inetd]" And the service should have "enable" set to "true" And the state should be "running" And the service should require "Package[inetd]"
  • 8. Cucumber step definitions [1/2] Given /^a node of class "([^"]*)"$/ do |klass| @klass = klass end When /^I compile the catalog$/ do compile_catalog end Then /^package "([^"]*)" should be "([^"]*)"$/ do |p, s| steps %Q{ Then there should be a resource "Package[#{p}]" And the state should be "#{s}" } end
  • 9. Cucumber step definitions [2/2] Given /^a node of class "([^"]*)"$/ do |klass| @klass = klass end When /^I compile the catalog$/ do compile_catalog end Then /^package "([^"]*)" should be "([^"]*)"$/ do |p, s| steps %Q{ Then there should be a resource "Package[#{p}]" And the state should be "#{s}" } end
  • 10. Unit-testing a puppet class Feature: Install inetd In order to run certain services The inetd service Must be installed Scenario: Setup inetd Given a node of class "inetd" When I compile the catalog Then package "inetd" should be "installed" Then there should be a resource "Service[inetd]" And the service should have "enable" set to "true" And the state should be "running" And the service should require "Package[inetd]"
  • 11. Unit-testing a puppet class . . . not so good Then package "inetd" should be "installed" Then there should be a resource "Service[inetd]" And the service should have "enable" set to "true" And the state should be "running" And the service should require "Package[inetd]" class inetd { package { "inetd": ensure => installed, } service { "inetd": enable => true, ensure => running, require => Package["inetd"], } }
  • 12. A catalog policy to document rules Feature: General catalog policy for all nodes In order to ensure applicability of a node’s catalog As a manifest developer I want all catalogs to obey some general rules Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/my.host.yaml" When I compile its catalog Then compilation should succeed And all resource dependencies should resolve And all files should have an owner, group, and mode And the node should have accounts for admins
  • 13. A catalog policy operates on a real node’s catalog Feature: General catalog policy for all nodes In order to ensure applicability of a node’s catalog As a manifest developer I want all catalogs to obey some general rules Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/my.host.yaml" When I compile its catalog Then compilation should succeed And all resource dependencies should resolve And all files should have an owner, group, and mode And the node should have accounts for admins
  • 14. A catalog policy deals with catalog wide properties Feature: General catalog policy for all nodes In order to ensure applicability of a node’s catalog As a manifest developer I want all catalogs to obey some general rules Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/my.host.yaml" When I compile its catalog Then compilation should succeed And all resource dependencies should resolve And all files should have an owner, group, and mode And the node should have accounts for admins
  • 15. A catalog policy avoids the duplication trap Feature: General catalog policy for all nodes In order to ensure applicability of a node’s catalog As a manifest developer I want all catalogs to obey some general rules Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/my.host.yaml" When I compile its catalog Then compilation should succeed And all resource dependencies should resolve And all files should have an owner, group, and mode And the node should have accounts for admins
  • 16. A catalog policy can be generated Feature: General catalog policy for all nodes @host_one Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/host.one.yaml" When I compile its catalog Then compilation should succeed @host_two Scenario: Compile and verify catalog for my.host Given a node specified by "nodes/host.two.yaml" When I compile its catalog Then compilation should succeed
  • 17. Tags are your friends $ cucumber-puppet --format progress features/catalog/policy.feature ............................................. 25 scenarios (25 passed) 275 steps (275 passed) 0m50.679s $ cucumber-puppet --format progress --tags @host_one features/catalog/policy.feature ........... 1 scenario (1 passed) 11 steps (11 passed) 0m4.731s
  • 18. And it actually finds mistakes $ cucumber-puppet --format progress --tags @host_one features/catalog/policy.feature .........F- (::) failed steps (::) Service[inetd] cannot require Package[inetd], not in catalog. (RuntimeError) features/catalog/policy.feature:75:in ‘And all resource dependencies should resolve’ Failing Scenarios: cucumber features/catalog/policy.feature:65 # Scenario: Compile and verify catalog for host_one 1 scenario (1 failed) 11 steps (1 failed, 1 skipped, 9 passed) 0m4.877s