The document discusses tools and best practices for testing Chef cookbooks, including:
- Using ChefSpec for unit testing recipes by making assertions about resources added during a simulated Chef run. Each recipe should have its own test file.
- Using the Chef MiniTest handler and Minitest framework for acceptance testing by writing tests that are executed on nodes after a Chef client run.
- Leveraging Vagrant and Berkshelf to define virtual machines for testing and manage cookbook dependencies, allowing for rapid iteration of tests against a virtualized environment.
How deployment is tackled at Etsy and how we keep it fast and scale it out with a growing engineering team.
Reprised version of the talk given at the Continuous Delivery NYC meetup October 2013.
People willing to add new features to their websites have too much of a choice. Choosing and testing addons is a task that requires either developer-superpowers and a unlimited budget or blind faith and dumb luck. In this talk we'll find out how to walk the middle ground and live to tell the tale.
See a video of the talk at http://www.youtube.com/watch?v=Sc6NkqaSjqw
Android devices come in all shapes and sizes, with varying performance levels and APIs. This is one of the reasons that writing tests for Android applications can be so daunting, let alone the seemingly endless number of tools available to write those tests. This presentation discusses three simple steps to get started with writing tests for your Android applications.
Jenkins and Chef: Infrastructure CI and Automated DeploymentDan Stine
This presentation discusses two key components of our deployment pipeline: Continuous integration of Chef code and automated deployment of Java applications. CI jobs for Chef code run static analysis and then provision, configure and test EC2 instances. Release jobs publish new cookbook versions to the Chef server. Deployment jobs identify target EC2 and VMware nodes and orchestrate Chef client runs. The flexibility of Jenkins is essential to our overall delivery architecture.
How deployment is tackled at Etsy and how we keep it fast and scale it out with a growing engineering team.
Reprised version of the talk given at the Continuous Delivery NYC meetup October 2013.
People willing to add new features to their websites have too much of a choice. Choosing and testing addons is a task that requires either developer-superpowers and a unlimited budget or blind faith and dumb luck. In this talk we'll find out how to walk the middle ground and live to tell the tale.
See a video of the talk at http://www.youtube.com/watch?v=Sc6NkqaSjqw
Android devices come in all shapes and sizes, with varying performance levels and APIs. This is one of the reasons that writing tests for Android applications can be so daunting, let alone the seemingly endless number of tools available to write those tests. This presentation discusses three simple steps to get started with writing tests for your Android applications.
Jenkins and Chef: Infrastructure CI and Automated DeploymentDan Stine
This presentation discusses two key components of our deployment pipeline: Continuous integration of Chef code and automated deployment of Java applications. CI jobs for Chef code run static analysis and then provision, configure and test EC2 instances. Release jobs publish new cookbook versions to the Chef server. Deployment jobs identify target EC2 and VMware nodes and orchestrate Chef client runs. The flexibility of Jenkins is essential to our overall delivery architecture.
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeJosh Padnick
Presentation by Josh Padnick given at Desert Code Camp on April 5, 2014. Introduces OpsCode Chef with a special emphasis on learning the key Chef concepts. Also includes tips & tricks and references to best practices.
This slide deck Introduces Chef and its role in DevOps. The agenda of the deck is as follows:
- A Review of DevOps
- BMs Continuous Delivery solution
- Introduction to Chef
- Chef and Continuous Delivery
Read more on DevOps: http://sdarchitect.wordpress.com/understanding-devops/
Overview of Chef - Fundamentals Webinar Series Part 1Chef
This is an Overview of Chef. After viewing this webinar you will be able to:
- Describe how Chef thinks about Infrastructure Automation
- Define the following terms:
- Resource
- Recipe
- Node
- Run List
- Search
- Login to Hosted Chef
- Run `knife` commands from your workstation
Video of this webinar can be found at the following URL
https://www.youtube.com/watch?v=S5lHUpzoCYo&list=PL11cZfNdwNyPnZA9D1MbVqldGuOWqbumZ
ICSE 2011 Research Paper on Modularity Violationsmiryung
Detecting Software Modularity Violations, Sunny Wong, Yuanfang Cai, Miryung Kim, Michael Dalton, ICSE' 11: Proceedings of the 2011 ACM and IEEE 33rd International Conference on Software Engineering
Introduction to Ansible - Jan 28 - Austin MeetUptylerturk
This presentation is a fairly brief introduction to ansible including some minor details around WP Engine's implementation, variable precedence, a sample playbook, and some of the core concepts around what makes ansible tick.
The ChefConf2014 presentation I've delivered on testing Chef. The presentation goes into the different types of tests, the differences between them, and how they tie into Chef based concepts. Furthermore I introduce the method of writing code test first and entering what's known as the Red Green Refactor cycle.
Youtube link: http://www.youtube.com/watch?v=sInDNmTZhEw
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeJosh Padnick
Presentation by Josh Padnick given at Desert Code Camp on April 5, 2014. Introduces OpsCode Chef with a special emphasis on learning the key Chef concepts. Also includes tips & tricks and references to best practices.
This slide deck Introduces Chef and its role in DevOps. The agenda of the deck is as follows:
- A Review of DevOps
- BMs Continuous Delivery solution
- Introduction to Chef
- Chef and Continuous Delivery
Read more on DevOps: http://sdarchitect.wordpress.com/understanding-devops/
Overview of Chef - Fundamentals Webinar Series Part 1Chef
This is an Overview of Chef. After viewing this webinar you will be able to:
- Describe how Chef thinks about Infrastructure Automation
- Define the following terms:
- Resource
- Recipe
- Node
- Run List
- Search
- Login to Hosted Chef
- Run `knife` commands from your workstation
Video of this webinar can be found at the following URL
https://www.youtube.com/watch?v=S5lHUpzoCYo&list=PL11cZfNdwNyPnZA9D1MbVqldGuOWqbumZ
ICSE 2011 Research Paper on Modularity Violationsmiryung
Detecting Software Modularity Violations, Sunny Wong, Yuanfang Cai, Miryung Kim, Michael Dalton, ICSE' 11: Proceedings of the 2011 ACM and IEEE 33rd International Conference on Software Engineering
Introduction to Ansible - Jan 28 - Austin MeetUptylerturk
This presentation is a fairly brief introduction to ansible including some minor details around WP Engine's implementation, variable precedence, a sample playbook, and some of the core concepts around what makes ansible tick.
The ChefConf2014 presentation I've delivered on testing Chef. The presentation goes into the different types of tests, the differences between them, and how they tie into Chef based concepts. Furthermore I introduce the method of writing code test first and entering what's known as the Red Green Refactor cycle.
Youtube link: http://www.youtube.com/watch?v=sInDNmTZhEw
DevOps: Getting Started with Puppet on WindowsRob Reynolds
You keep hearing about DevOps and how awesome it is, if you have Linux. Well Windows can be awesome with DevOps, too. And it’s just going to keep getting better. If you are on Windows and you are even remotely interested in making things better, then you should come out and see what Puppet is all about and what it can do for your organization.
Tilt does not currently employ any quality engineers. How can we deliver quality software? Over the last year the organization has gone from terrifying deploys (followed by
Show an Open Source Project Some Love and Start Using Travis-CIJoel Byler
Lots of us are looking for an open source project to help with, but sometimes it is hard to find a way to contribute. I'd like to recommend that folks start to consider using Travis-CI and adding Travis-CI scripts to projects that don't already have them. Lets look at what it takes to build a project using Travis and the benefits that a project can take advantage of if they use the service.
This was originally presented at CodeMash v2.0.1.4 in Sandusky, Ohio on January 10, 2014
In this talk, I riff on various jobs you can do with your DevOps knowledge that aren't more of the same (or moving into software engineering). These include sales engineering, consulting, product management, product marketing, and more.
Pull, Don't Push! Sensu Summit 2018 TalkJulian Dunn
Architectures for monitoring and configuration in a microservices era. A talk given by Julian Dunn and Fletcher Nichol at Sensu Summit 2018 in Portland, Oregon.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
4. Devops Is A Two-Way Street
• It’s great when
developers care
about
• uptime!
• scaling!
• deployment!
• Put them on call!
etc. etc. etc.
Friday, June 14, 13
5. Devops Is A Two-Way Street
• Systems Administrators
also have as much or more to
learn from developers as well!
Friday, June 14, 13
9. Source
Code
Compiler
Artifact
Test
Typical Development Workflow
• Artifact
• Artifacts are executable programs
created by compilers.
• Compiled artifacts cannot be edited
directly. Source code must be changed
and re-compiled to produce a new build
artifact.
Friday, June 14, 13
11. Source
Code
Compiler
Artifact
Test
Typical Development Workflow
• When developing software, most time
isn’t actually spent coding
• 10-second changes to source code can
take minutes to vet
• Compiling code
• Deploying code
• Writing & Running tests
Friday, June 14, 13
17. Source'Code'
Compiler'
Ar/fact'
Test'
Boooooooring
• Too much time doing
“paperwork”
• vi recipes/something.rb
• knife cookbook upload
• sudo pkill -USR1 chef-
client
• #%$#%$ something
broke, let me do that all
again
• Not enough time doing fun
stuff!
• Writing recipes
Less Fun!
More Boring!
X
Friday, June 14, 13
18. Source'Code'
Compiler'
Ar/fact'
Test'
Boooooooring
• Too much time doing
“paperwork”
• vi recipes/something.rb
• knife cookbook upload
• sudo pkill -USR1 chef-
client
• #%$#%$ something
broke, let me do that all
again
• Not enough time doing fun
stuff!
• Writing recipes
Less Fun!
More Boring!
XTH
IS
SUCKS!
Friday, June 14, 13
19. Chefs on a Plane
What if...
Friday, June 14, 13
20. Chefs on a Plane
What if...Worksta(on:+
Knife+cookbook+
create+
Worksta(on:+
Edit+cookbook+
Worksta(on:+
Knife+cookbook+
upload+
Provision+target+
Bootstrap+
target+
Worksta(on:+
Edit+target+run+
list+
ssh+target+
Target:+Run+
chef>client+
Target:(Run(
chef/client(
Worksta6on:(
edit(cookbook(
Worksta6on:(
knife(cookbook(
upload(
...we could
automate all
of this...
Friday, June 14, 13
21. Chefs on a Plane
What if...Worksta(on:+
Knife+cookbook+
create+
Worksta(on:+
Edit+cookbook+
Worksta(on:+
Knife+cookbook+
upload+
Provision+target+
Bootstrap+
target+
Worksta(on:+
Edit+target+run+
list+
ssh+target+
Target:+Run+
chef>client+
Target:(Run(
chef/client(
Worksta6on:(
edit(cookbook(
Worksta6on:(
knife(cookbook(
upload(
...we could
automate all
of this...
...to run entirely on this...
Friday, June 14, 13
22. Chefs on a Plane
What if...
...even while
aboard this?
Worksta(on:+
Knife+cookbook+
create+
Worksta(on:+
Edit+cookbook+
Worksta(on:+
Knife+cookbook+
upload+
Provision+target+
Bootstrap+
target+
Worksta(on:+
Edit+target+run+
list+
ssh+target+
Target:+Run+
chef>client+
Target:(Run(
chef/client(
Worksta6on:(
edit(cookbook(
Worksta6on:(
knife(cookbook(
upload(
...we could
automate all
of this...
...to run entirely on this...
Friday, June 14, 13
23. Source'Code'
Compiler'
Ar/fact'
Test'
Developing for Chef: Rapid Iteration
• Less time waiting around
for cookbook deploys and
Chef runs
• More frequent testing
• Better code
• Business needs met
more quickly
More Fun!
Less Boring!
X
Friday, June 14, 13
26. The Toolchain
• You’re becoming a developer!
• Reasonably powerful computer
• Good editor
Friday, June 14, 13
27. Have a Good Computer
• Virtualization is used to run
acceptance tests
• Running on a real virtualized
“node”
• Lots of memory (4GB+, 8GB
recommended)
• Fast disk (SSD)
• Good processor (Intel i5+)
• Modern OS
X
Friday, June 14, 13
28. Tools
• Chef (obviously)
• Virtualization provider
• Virtualization automation
(Vagrant)
• Cookbook dependency
manager (Berkshelf,
Librarian)
• Unit and acceptance testing
frameworks
Friday, June 14, 13
30. Different Types of Testing
• There are formal
Software Engineering
definitions for testing
Friday, June 14, 13
31. Different Types of Testing
• There are formal
Software Engineering
definitions for testing
• Unit test
Friday, June 14, 13
32. Different Types of Testing
• There are formal
Software Engineering
definitions for testing
• Unit test
• Integration test
Friday, June 14, 13
33. Different Types of Testing
• There are formal
Software Engineering
definitions for testing
• Unit test
• Integration test
• Acceptance test
Friday, June 14, 13
34. Different Types of Testing
• There are formal
Software Engineering
definitions for testing
• Unit test
• Integration test
• Acceptance test
• An easy explanation for
SAs is ...
Friday, June 14, 13
35. • Unit Test: Signal Input
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
36. • Unit Test: Signal Input
• Did I send Chef the correct
command?
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
37. • Unit Test: Signal Input
• Did I send Chef the correct
command?
• Signal Processing
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
38. • Unit Test: Signal Input
• Did I send Chef the correct
command?
• Signal Processing
• Did Chef interpret my command
correctly?
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
39. • Unit Test: Signal Input
• Did I send Chef the correct
command?
• Signal Processing
• Did Chef interpret my command
correctly?
• Acceptance Test: Signal Output
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
40. • Unit Test: Signal Input
• Did I send Chef the correct
command?
• Signal Processing
• Did Chef interpret my command
correctly?
• Acceptance Test: Signal Output
• Did my expressed intent, executed
by Chef, achieve the desired
result?
What and When To Test
Flickr user: Rain Rabbit
Friday, June 14, 13
43. Chef Testing Tools
• Signal Input
• ChefSpec
• Signal out
• Chef Minitests & Minitest Handler
Friday, June 14, 13
44. Chef Testing Tools
• Signal Input
• ChefSpec
• Signal out
• Chef Minitests & Minitest Handler
• Signal processing
• Who cares; that’s what Opscode’s own tests for
Chef are for!
Friday, June 14, 13
46. General Philosophy for Chef Testing
• Unit tests
• ChefSpec assertion for every resource of interest
• Each recipe should get its own test file
Friday, June 14, 13
47. General Philosophy for Chef Testing
• Unit tests
• ChefSpec assertion for every resource of interest
• Each recipe should get its own test file
• Acceptance tests
• Anything that you couldn’t test in a unit test
Friday, June 14, 13
48. General Philosophy for Chef Testing
• Unit tests
• ChefSpec assertion for every resource of interest
• Each recipe should get its own test file
• Acceptance tests
• Anything that you couldn’t test in a unit test
• Don’t repeat yourself!
Friday, June 14, 13
50. ChefSpec Overview
• Built on top of RSpec
• Converge a Chef run in memory
• Overrides all providers to take no action
• Make assertions about the in-memory Chef run
• Mock Ohai data (automatic attributes) with Fauxhai
Friday, June 14, 13
51. Example Recipe Part One
include_recipe “java”
user node['sauceproxy']['server']['user'] do
comment "SauceLabs Proxy User"
system true
action :create
end
directory node['sauceproxy']['server']['install_dir'] do
owner node['sauceproxy']['server']['user']
mode 00755
action :create
end
# Can't assume we have unzip
package "unzip" do
action :install
end
execute "unzip-saucelabs-proxy" do
cwd node['sauceproxy']['server']['install_dir']
command "unzip -o #{Chef::Config[:file_cache_path]}/#{node['sauceproxy']['server']['zipfile']}"
action :nothing
notifies :restart, "service[sauceproxy]"
end
https://github.com/juliandunn/sauceproxy/blob/master/recipes/server.rb
Friday, June 14, 13
52. Example Recipe Part Two
remote_file "#{Chef::Config[:file_cache_path]}/#{node['sauceproxy']['server']['zipfile']}" do
source "#{node['sauceproxy']['server']['download_url']}/#{node['sauceproxy']['server']['zipfile']}"
action :create_if_missing
notifies :run, "execute[unzip-saucelabs-proxy]", :immediately
end
template "/etc/init.d/sauceproxy" do
source "sauceproxy.init.erb"
mode 00755
owner "root"
group "root"
action :create
end
template "/etc/sysconfig/sauceproxy" do
source "sauceproxy.sysconfig.erb"
mode 00644
owner "root"
group "root"
action :create
end
service "sauceproxy" do
supports :restart => true
action [:enable, :start]
end
Friday, June 14, 13
53. Example ChefSpec Test: Setup
describe 'sauceproxy::server' do
let (:chef_run) do
runner = ChefSpec::ChefRunner.new(
platform: 'centos',
version: '6.3'
)
runner.node.set['sauceproxy']['server']['user'] = 'fake'
runner.node.set['sauceproxy']['server']['install_dir'] =
'/tmp/fake'
runner.node.set['sauceproxy']['server']['version'] = '3.14159'
runner.converge('sauceproxy::server')
end
Friday, June 14, 13
54. Example ChefSpec Test: Expectations
it 'should create a sauceproxy directory with the right
ownership' do
expect(chef_run).to create_directory('/tmp/fake')
expect(chef_run.directory('/tmp/fake')).to
be_owned_by('fake')
end
it 'should start a service called sauceproxy' do
expect(chef_run).to start_service('sauceproxy')
expect(chef_run).to
set_service_to_start_on_boot('sauceproxy')
end
end
Friday, June 14, 13
56. ChefSpec: Expectations
• Many expectations (assertions) possible
• https://github.com/acrmp/chefspec#making-
assertions
• Don’t (just) restate static resources
• Mock out data
• Static resource assertions: good for regressions
• Whoops, I deleted the service resource
Friday, June 14, 13
60. Acceptance Tests as Report Handler
• Acceptance testing as a Chef Report Handler
• Many tools (serverspec, bats, minitest)
• I’ll demo Chef-MiniTest-Handler; most widely used
Friday, June 14, 13
61. MiniTest Handler Cookbook
• http://community.opscode.com/cookbooks/minitest-
handler
• Installs Minitest Gems
• Installs Chef Minitest Gems
• Installs the Chef-Minitest-Handler Notification
Handler for Chef-Client
• Places test files from cookbooks on the target node
as part of a Chef-client run
Friday, June 14, 13
62. MiniTest Files
• Each recipe gets an individual test file.
• recipes/server.rb
• files/default/test/server_test.rb
• Tests for each recipe are automatically loaded by the
handler
Friday, June 14, 13
63. Example MiniTest
require 'minitest/spec'
describe_recipe 'sauceproxy::server' do
it 'runs as a daemon' do
service('sauceproxy').must_be_running
end
end
http://tinyurl.com/minitest-examples
for many more example tests
Friday, June 14, 13
64. Make this go on a
with virtualization!
Friday, June 14, 13
65. Using Vagrant & Berkshelf to Iterate
• Vagrant is virtualization middleware
• Driven from Vagrantfile
• Defines VM images, customization parameters,
provisioners (Chef in our case)
• Berkshelf is a cookbook dependency manager
• Get dependent cookbooks from community API
• Feed them to Vagrant Chef provisioner
Friday, June 14, 13
66. Example Vagrantfile
Vagrant.configure("2") do |config|
config.vm.hostname = "sauceproxy-berkshelf"
config.vm.box = "opscode-centos-6.4"
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/
opscode_centos-6.4_chef-11.4.4.box"
config.ssh.max_tries = 40
config.ssh.timeout = 120
config.vm.provision :chef_solo do |chef|
chef.json = {}
chef.run_list = [
"recipe[minitest-handler]",
"recipe[sauceproxy::server]"
]
end
end
Friday, June 14, 13
67. % vagrant up
Bringing Up Vagrant
borkbork:~/Dropbox/devel/github/juliandunn/sauceproxy (master)$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'centos-6.4'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Updating Vagrant's berkshelf: '/Users/juliandunn/.berkshelf/vagrant/
berkshelf-20130611-20810-rt7k01'
[Berkshelf] Using sauceproxy (0.1.8) at path: '/Users/juliandunn/Dropbox/devel/github/juliandunn/
sauceproxy'
[Berkshelf] Using minitest-handler (0.2.1)
[Berkshelf] Using java (1.11.4)
[Berkshelf] Using windows (1.8.10)
[Berkshelf] Using chef_handler (1.1.4)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
Friday, June 14, 13
68. % vagrant up
Bringing Up Vagrant
borkbork:~/Dropbox/devel/github/juliandunn/sauceproxy (master)$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'centos-6.4'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Updating Vagrant's berkshelf: '/Users/juliandunn/.berkshelf/vagrant/
berkshelf-20130611-20810-rt7k01'
[Berkshelf] Using sauceproxy (0.1.8) at path: '/Users/juliandunn/Dropbox/devel/github/juliandunn/
sauceproxy'
[Berkshelf] Using minitest-handler (0.2.1)
[Berkshelf] Using java (1.11.4)
[Berkshelf] Using windows (1.8.10)
[Berkshelf] Using chef_handler (1.1.4)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
Friday, June 14, 13
69. Vagrant Run Continued
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
GuestAdditions 4.2.12 running --- OK.
[default] Setting hostname...
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
[2013-06-12T02:52:26+00:00] INFO: *** Chef 11.4.4 ***
[2013-06-12T02:52:26+00:00] INFO: Setting the run_list to ["recipe[minitest-
handler]", "recipe[sauceproxy::server]"] from JSON
[2013-06-12T02:52:26+00:00] INFO: Run List is [recipe[minitest-handler],
recipe[sauceproxy::server]]
[2013-06-12T02:52:26+00:00] INFO: Run List expands to [minitest-handler,
sauceproxy::server]
[2013-06-12T02:52:26+00:00] INFO: Starting Chef Run for sauceproxy-berkshelf
Friday, June 14, 13
70. Vagrant Run Continued
[2013-06-12T02:55:22+00:00] INFO: Chef Run complete in 175.788656866 seconds
[2013-06-12T02:55:22+00:00] INFO: Running report handlers
Run options: -v --seed 31883
# Running tests:
recipe::java::openjdk#test_0001_installs the correct version of the jdk =
0.11 s = .
recipe::java::openjdk#test_0002_properly sets JAVA_HOME environment variable =
0.04 s = .
recipe::sauceproxy::server#test_0001_runs as a daemon =
0.09 s = .
Finished tests in 0.244690s, 12.2604 tests/s, 12.2604 assertions/s.
3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
[2013-06-12T02:55:22+00:00] INFO: Report handlers complete
Friday, June 14, 13
71. Vagrant Run Continued
[2013-06-12T02:55:22+00:00] INFO: Chef Run complete in 175.788656866 seconds
[2013-06-12T02:55:22+00:00] INFO: Running report handlers
Run options: -v --seed 31883
# Running tests:
recipe::java::openjdk#test_0001_installs the correct version of the jdk =
0.11 s = .
recipe::java::openjdk#test_0002_properly sets JAVA_HOME environment variable =
0.04 s = .
recipe::sauceproxy::server#test_0001_runs as a daemon =
0.09 s = .
Finished tests in 0.244690s, 12.2604 tests/s, 12.2604 assertions/s.
3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
[2013-06-12T02:55:22+00:00] INFO: Report handlers complete
Friday, June 14, 13
72. Minitests from Java cookbook ran too!
[2013-06-12T02:55:22+00:00] INFO: Chef Run complete in 175.788656866 seconds
[2013-06-12T02:55:22+00:00] INFO: Running report handlers
Run options: -v --seed 31883
# Running tests:
recipe::java::openjdk#test_0001_installs the correct version of the jdk =
0.11 s = .
recipe::java::openjdk#test_0002_properly sets JAVA_HOME environment variable =
0.04 s = .
recipe::sauceproxy::server#test_0001_runs as a daemon =
0.09 s = .
Finished tests in 0.244690s, 12.2604 tests/s, 12.2604 assertions/s.
3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
[2013-06-12T02:55:22+00:00] INFO: Report handlers complete
Friday, June 14, 13
73. Minitests from Java cookbook ran too!
[2013-06-12T02:55:22+00:00] INFO: Chef Run complete in 175.788656866 seconds
[2013-06-12T02:55:22+00:00] INFO: Running report handlers
Run options: -v --seed 31883
# Running tests:
recipe::java::openjdk#test_0001_installs the correct version of the jdk =
0.11 s = .
recipe::java::openjdk#test_0002_properly sets JAVA_HOME environment variable =
0.04 s = .
recipe::sauceproxy::server#test_0001_runs as a daemon =
0.09 s = .
Finished tests in 0.244690s, 12.2604 tests/s, 12.2604 assertions/s.
3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
[2013-06-12T02:55:22+00:00] INFO: Report handlers complete
Friday, June 14, 13
74. New Test/Dev Cycle
Write Unit Tests
Worked?
Run ChefSpec
No
Write Recipe
Code
Write Acceptance
Tests
Yes
Worked?
Run Vagrant + Minitest Handler
No
vagrant destroy
Yes Commit/Tag Code,
etc.
Friday, June 14, 13
76. Continuous Integration Pipeline
• Run unit tests in your pipeline
• Run acceptance tests in your
pipeline
• Drive cookbook uploads as the
output!
Friday, June 14, 13
77. Travis-CI Example for SauceProxy
language: ruby
gemfile:
- gemfiles/travis.gemfile
rvm:
- "1.9.2"
- "1.9.3"
script: bundle exec rake test:syntax test:lint test:spec
notifications:
email:
- jdunn@opscode.com
Friday, June 14, 13
78. Rakefile Example
• Too long to post here
• Rake tasks for Foodcritic
and ChefSpec
• https://github.com/
juliandunn/sauceproxy/
blob/master/Rakefile
Friday, June 14, 13
81. Test Kitchen (alpha)
• Run acceptance test suite on
multiple OSes
• Different fixtures for each, if desired
• Different drivers (vagrant, ec2, lxc,
etc.)
• Hook up to Jenkins or other CI
system if desired
Friday, June 14, 13
86. More on Testing
• Chef-NYC: The Hows and Whys
of Cookbook Testing
• Seth Vargo (Author of ChefSpec,
Fauxhai, many others)
• http://www.meetup.com/Chef-
NYC/events/122219772/
• June 25th in Manhattan
Friday, June 14, 13
87. Chef Fundamentals Training
• Boston, July 11-12
(CompuWorks, 263
Summer St.)
• eventbrite.com/event/
6652057483
• Use code BOSTON-
MEETUP to save 25%!
Friday, June 14, 13
88. Questions and Prizes
Also, we’re hiring! Automate all the things for fun and profit!
http://www.opscode.com/blog/careers/
(and/or see me after)
Friday, June 14, 13