SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar a 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
 

Similar a 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 !
 

Último

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
"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 Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
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
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Último (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
"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 Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
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
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

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