SlideShare a Scribd company logo
1 of 21
Download to read offline
Test-driven
Infrastructure
    Jon Topper
What is Infrastructure?
★   Physical Servers
★   Virtual / Cloud Servers
★   Switches
★   Firewalls
★   Routers
★   Load Balancers
3 Year Infrastructure Lifecycle

 Change
                        Build
Risk!                   14%




              Operate
               86%
The Rise of DevOps




★   Increased collaboration between developers and
    operations staff
★   Improved tooling for automation
★   “Dev” solutions to “Ops” problems
Infrastructure as Code
Puppet
node 'webserver' {

    package { 'httpd':
        ensure => latest
    }

    file { '/etc/httpd/httpd.conf':
        require => Package['httpd'],
        owner   => root,
        mode    => 644,
        content => template('httpd.conf')
    }

    service { 'httpd':
        ensure => running,
        enable => true,
        require => File['/etc/httpd/httpd.conf']
    }

}
“Dev” Tooling
★   IDEs, text editors, refactoring tools
★   Version Control Systems
★   Automated documentation generation
★   ... Testing?
Automated Infrastructure Testing
★   cucumber-puppet / rspec-puppet
★   cucumber-nagios
★   puppet-lint
★   cucumber-chef
★   vagrant-guard-demo
Cucumber Example
Scenario: Basic install of Apache
  Given there is a running VM called "server"
  When I apply a puppet manifest containing:
    """
    include cucumber_defaults
    class { sf_apache:
      'Port'     => '80',
      'Children' => '10'
    }
    """
  Then a second manifest application should do nothing

  And there should be 11 processes called “httpd” running
  And the Apache module "core_module" should be loaded
  And a process called “httpd” should be listening on TCP
      port 80
  And a GET request to http://localhost/server-status/
      should return an http status of 200
Given there is a running VM called "server"
Vagrant
★   Template (“Box”) based virtual environment
★   Shared filesystem between host and guest
★   Snapshot support via “Sahara” plugin
★   API for scripted interaction


    http://vagrantup.com/
Given there is a running VM called "server"




           Given /^there is a running VM called
             "([^"]*)"$/ do |vm_name|

                 vm_platform.vm( vm_name ).start
                 vm_platform.vm( vm_name ).snapshot

           end
attr_reader :last_vm

def initialize
    @name_map      = {}
end

def vm(name)

      if @name_map.has_key?(name)
          @last_vm = @name_map[name]
          return @name_map[name]
      end

      vm = create_vm_object_by_name( name )

      @name_map[name] = vm
      @last_vm        = vm

      return vm

end

def clean_tainted
    @name_map.each { |name,vm|
        vm.rollback
        @name_map.delete(name)
    }
end
When I apply a puppet manifest containing:
       """
       include cucumber_defaults
       class { sf_apache:
         'Port'     => '80',
         'Children' => '10'
       }
       """
     Then a second manifest application should do nothing




★   Fragment uploaded with SCP
★   Puppet tasks run over Vagrant SSH link
★   Included manifests read from Vagrant shared folder
When /^I apply a puppet manifest(#{VMRE}) containing:$/ do |vmre, manifest_content|

      vm = identified_vm( vmre )

      file = Tempfile.new('cucumber-puppet')
      begin
          file.write(manifest_content)
          file.fsync
          vm.upload(file.path,'/tmp/cucumber-puppet.pp')

          @puppet_command ="puppet apply --verbose --modulepath=#{$puppet_modulepath} " +
             "--manifestdir=#{$puppet_manifestdir} --detailed-exitcodes --color=false " +
             "/tmp/cucumber-puppet.pp"

          exit_status = vm.sudo( @puppet_command ) do |type,data|
              data.chomp!
              puts data if data != “”
          end

          Test::Unit::assert( exit_status == 0 || exit_status == 2,
              'Exit code of puppet run not 0 or 2 - errors' )

      ensure
          file.close
          file.unlink
      end
end
VMRE


VMRE ||= /(?: on the last VM| on the VM(?: called|) "(?:[^"]+)"|)/

def identified_vm( str )
    case str
        when /^( on the last VM|)$/
             return vm_platform.last_vm
        when /^ on the VM(?: called|) "([^"]+)"$/
             return @vm_platform.vm( $1 )
    end
end
And a GET request to http://localhost/server-status/
          should return an http status of 200



Then /^a GET request to (.+)(#{VMRE}) should return an http status of (d+)$/
do |url,vmre,status|

      vm = identified_vm( vmre )

      response = vm.freeman.call('http.GET',url)

      assert( response['code'].to_i == status.to_i,
          "Response code 200 expected from #{url}, " +
            "received #{response['code']}" )

end




★   ‘freeman’ is an XML-RPC service
★   First call starts a new XML-RPC server in the guest
★   Code shared over Vagrant’s folder system
Full Stack
                     Host Filesystem


                   Features


               Step Definitions


        Cumberbatch              Freeman Client


       Vagrant Library


                           Freeman                Shared
sshd                        Server                Folder
                         Vagrant VM
Benefits
★   Cleaner interfaces
★   Improved separation of concerns
★   Increased reusability
★   Rapid troubleshooting
★   Empowering for junior engineers
Challenges
★   Scenarios slow to run
★   Difficult to debug when snapshot rolled back
★   Multi-VM VirtualBox unstable on OS X
★   Good use of Cucumber not always obvious to the
    sysadmin-minded
Jon Topper


   jon@scalefactory.com
http://www.scalefactory.com/


     Twitter: @jtopper

More Related Content

What's hot

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)Soshi Nemoto
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and ContainersRodolfo Carvalho
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)Soshi Nemoto
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102APNIC
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beersjorgecarabias
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
Consul - service discovery and others
Consul - service discovery and othersConsul - service discovery and others
Consul - service discovery and othersWalter Liu
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansibleKhizer Naeem
 
IMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a PortalIMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a PortalIMPACT Centre of Competence
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Idan Tohami
 

What's hot (20)

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
DevOps(2) : Vagrant - (MOSG)
DevOps(2) : Vagrant  -  (MOSG)DevOps(2) : Vagrant  -  (MOSG)
DevOps(2) : Vagrant - (MOSG)
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Puppet
PuppetPuppet
Puppet
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beers
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Consul - service discovery and others
Consul - service discovery and othersConsul - service discovery and others
Consul - service discovery and others
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
IMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a PortalIMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a Portal
 
Ubic
UbicUbic
Ubic
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
 

Viewers also liked

Viewers also liked (11)

Man made marvels
Man made marvelsMan made marvels
Man made marvels
 
Nps
NpsNps
Nps
 
Arvindsujeeth scaladays12
Arvindsujeeth scaladays12Arvindsujeeth scaladays12
Arvindsujeeth scaladays12
 
Prediction suretogowrong
Prediction suretogowrongPrediction suretogowrong
Prediction suretogowrong
 
Project kepler compile time metaprogramming for scala
Project kepler compile time metaprogramming for scalaProject kepler compile time metaprogramming for scala
Project kepler compile time metaprogramming for scala
 
Scala days mizushima
Scala days mizushimaScala days mizushima
Scala days mizushima
 
Cnc scala-presentation
Cnc scala-presentationCnc scala-presentation
Cnc scala-presentation
 
Proposal parade seni
Proposal parade seniProposal parade seni
Proposal parade seni
 
Frase dan klausa
Frase dan klausaFrase dan klausa
Frase dan klausa
 
Zaharia spark-scala-days-2012
Zaharia spark-scala-days-2012Zaharia spark-scala-days-2012
Zaharia spark-scala-days-2012
 
EDS selection & implementation @ CCC
EDS selection & implementation @ CCCEDS selection & implementation @ CCC
EDS selection & implementation @ CCC
 

Similar to Test driven infrastructure

Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...Willian Molinari
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Carlos Sanchez
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Puppet
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionSimon Su
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionSysdig
 

Similar to Test driven infrastructure (20)

Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
Tech Talk - Vagrant
Tech Talk - VagrantTech Talk - Vagrant
Tech Talk - Vagrant
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Rack
RackRack
Rack
 

More from Skills Matter Talks

Jordan west real workscalazfinal2
Jordan west   real workscalazfinal2Jordan west   real workscalazfinal2
Jordan west real workscalazfinal2Skills Matter Talks
 
(Oleg zhurakousky)spring integration-scala-intro
(Oleg zhurakousky)spring integration-scala-intro(Oleg zhurakousky)spring integration-scala-intro
(Oleg zhurakousky)spring integration-scala-introSkills Matter Talks
 
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in AngerSCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in AngerSkills Matter Talks
 
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...Skills Matter Talks
 
Martin sustrik future_of_messaging
Martin sustrik future_of_messagingMartin sustrik future_of_messaging
Martin sustrik future_of_messagingSkills Matter Talks
 

More from Skills Matter Talks (9)

Couch db skillsmatter-prognosql
Couch db skillsmatter-prognosqlCouch db skillsmatter-prognosql
Couch db skillsmatter-prognosql
 
Jordan west real workscalazfinal2
Jordan west   real workscalazfinal2Jordan west   real workscalazfinal2
Jordan west real workscalazfinal2
 
(Oleg zhurakousky)spring integration-scala-intro
(Oleg zhurakousky)spring integration-scala-intro(Oleg zhurakousky)spring integration-scala-intro
(Oleg zhurakousky)spring integration-scala-intro
 
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in AngerSCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
 
Real World Scalaz
Real World ScalazReal World Scalaz
Real World Scalaz
 
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
 
Tmt predictions 2011
Tmt predictions 2011Tmt predictions 2011
Tmt predictions 2011
 
Martin sustrik future_of_messaging
Martin sustrik future_of_messagingMartin sustrik future_of_messaging
Martin sustrik future_of_messaging
 
Marek pubsubhuddle realtime_web
Marek pubsubhuddle realtime_webMarek pubsubhuddle realtime_web
Marek pubsubhuddle realtime_web
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Test driven infrastructure

  • 2. What is Infrastructure? ★ Physical Servers ★ Virtual / Cloud Servers ★ Switches ★ Firewalls ★ Routers ★ Load Balancers
  • 3. 3 Year Infrastructure Lifecycle Change Build Risk! 14% Operate 86%
  • 4. The Rise of DevOps ★ Increased collaboration between developers and operations staff ★ Improved tooling for automation ★ “Dev” solutions to “Ops” problems
  • 6. Puppet node 'webserver' { package { 'httpd': ensure => latest } file { '/etc/httpd/httpd.conf': require => Package['httpd'], owner => root, mode => 644, content => template('httpd.conf') } service { 'httpd': ensure => running, enable => true, require => File['/etc/httpd/httpd.conf'] } }
  • 7. “Dev” Tooling ★ IDEs, text editors, refactoring tools ★ Version Control Systems ★ Automated documentation generation ★ ... Testing?
  • 8. Automated Infrastructure Testing ★ cucumber-puppet / rspec-puppet ★ cucumber-nagios ★ puppet-lint ★ cucumber-chef ★ vagrant-guard-demo
  • 9. Cucumber Example Scenario: Basic install of Apache Given there is a running VM called "server" When I apply a puppet manifest containing: """ include cucumber_defaults class { sf_apache: 'Port' => '80', 'Children' => '10' } """ Then a second manifest application should do nothing And there should be 11 processes called “httpd” running And the Apache module "core_module" should be loaded And a process called “httpd” should be listening on TCP port 80 And a GET request to http://localhost/server-status/ should return an http status of 200
  • 10. Given there is a running VM called "server"
  • 11. Vagrant ★ Template (“Box”) based virtual environment ★ Shared filesystem between host and guest ★ Snapshot support via “Sahara” plugin ★ API for scripted interaction http://vagrantup.com/
  • 12. Given there is a running VM called "server" Given /^there is a running VM called "([^"]*)"$/ do |vm_name| vm_platform.vm( vm_name ).start vm_platform.vm( vm_name ).snapshot end
  • 13. attr_reader :last_vm def initialize @name_map = {} end def vm(name) if @name_map.has_key?(name) @last_vm = @name_map[name] return @name_map[name] end vm = create_vm_object_by_name( name ) @name_map[name] = vm @last_vm = vm return vm end def clean_tainted @name_map.each { |name,vm| vm.rollback @name_map.delete(name) } end
  • 14. When I apply a puppet manifest containing: """ include cucumber_defaults class { sf_apache: 'Port' => '80', 'Children' => '10' } """ Then a second manifest application should do nothing ★ Fragment uploaded with SCP ★ Puppet tasks run over Vagrant SSH link ★ Included manifests read from Vagrant shared folder
  • 15. When /^I apply a puppet manifest(#{VMRE}) containing:$/ do |vmre, manifest_content| vm = identified_vm( vmre ) file = Tempfile.new('cucumber-puppet') begin file.write(manifest_content) file.fsync vm.upload(file.path,'/tmp/cucumber-puppet.pp') @puppet_command ="puppet apply --verbose --modulepath=#{$puppet_modulepath} " + "--manifestdir=#{$puppet_manifestdir} --detailed-exitcodes --color=false " + "/tmp/cucumber-puppet.pp" exit_status = vm.sudo( @puppet_command ) do |type,data| data.chomp! puts data if data != “” end Test::Unit::assert( exit_status == 0 || exit_status == 2, 'Exit code of puppet run not 0 or 2 - errors' ) ensure file.close file.unlink end end
  • 16. VMRE VMRE ||= /(?: on the last VM| on the VM(?: called|) "(?:[^"]+)"|)/ def identified_vm( str ) case str when /^( on the last VM|)$/ return vm_platform.last_vm when /^ on the VM(?: called|) "([^"]+)"$/ return @vm_platform.vm( $1 ) end end
  • 17. And a GET request to http://localhost/server-status/ should return an http status of 200 Then /^a GET request to (.+)(#{VMRE}) should return an http status of (d+)$/ do |url,vmre,status| vm = identified_vm( vmre ) response = vm.freeman.call('http.GET',url) assert( response['code'].to_i == status.to_i, "Response code 200 expected from #{url}, " + "received #{response['code']}" ) end ★ ‘freeman’ is an XML-RPC service ★ First call starts a new XML-RPC server in the guest ★ Code shared over Vagrant’s folder system
  • 18. Full Stack Host Filesystem Features Step Definitions Cumberbatch Freeman Client Vagrant Library Freeman Shared sshd Server Folder Vagrant VM
  • 19. Benefits ★ Cleaner interfaces ★ Improved separation of concerns ★ Increased reusability ★ Rapid troubleshooting ★ Empowering for junior engineers
  • 20. Challenges ★ Scenarios slow to run ★ Difficult to debug when snapshot rolled back ★ Multi-VM VirtualBox unstable on OS X ★ Good use of Cucumber not always obvious to the sysadmin-minded
  • 21. Jon Topper jon@scalefactory.com http://www.scalefactory.com/ Twitter: @jtopper