Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2ompPdX.
Matt Long talks about some approaches to environment infrastructure testing that his team at OpenCredo has created using Ruby, a language they feel is uniquely positioned to work with both infrastructure and testing. Filmed at qconlondon.com.
Matt Long works as a QA Consultant for OpenCredo, a London-based consultancy specializing in helping clients build and deploy emerging technologies. He is responsible for the testing requirements in a number of OpenCredo engagements, with specialist knowledge in the creation and deployment of automated testing frameworks. He works with tools such as Java, Selenium, Cucumber, Ruby, and Gatling.
2. InfoQ.com: News & Community Site
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations
/opencredo-ruby
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
3. Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon London
www.qconlondon.com
9. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
THE APPLICATION OF METHODS AND TOOLING
FROM SOFTWARE DEVELOPMENT TO THE
MANAGEMENT OF IT INFRASTRUCTURE
PROGRAMMABLE INFRASTRUCTURE IS..
THE INTERNET
10. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
WHAT DO WE MEAN BY THIS?
▸ Automated provisioning & configuration
▸ Configuration as code
▸ Version / source controlled
20. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
BENEFITS
▸ Quick, easy provisioning
▸ one team previously took 3 months
▸ Don't need to work at a low level
▸ Templates for common dev environments
▸ Built in best practice: monitoring, security
▸ Track spending
23. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
WORKFLOW
▸ Log into Web UI
▸ Fill in information about environment
▸ Broker creates and bootstraps resources
▸ SSH into resources
28. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
WHAT TO TEST?
Deployment
scripts unit tests?
Does the VPN server work?
Can instances
access one another?
Are services running?
Linting?
30. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Does the VPN box work?
Can I SSH into a server?
Do our deployment scripts work?
Linting?
Are services running?
ANOTHER TESTING PYRAMID?
credit: Ubuntu dev quality guide
https://developer.ubuntu.com/en/phone/platform/quality/
Can instances access one another?
expensive, slow
cheap, fast
36. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
▸ Ruby / RSpec based
▸ Great community
▸ Very readable
▸ Very quick!
▸ Can SSH into instances
SERVERSPEC
37. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
SERVERSPEC EXAMPLE
describe package('jenkins') do
it { should be_installed }
end
describe service('jenkins') do
it { should be_enabled }
it { should be_running }
end
describe port(8080) do
it { should be_listening }
end
40. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Scenario: Searching for Wikipedia
Given I am on the website "www.google.com"
When I search for "Wikipedia"
Then the first link should be "www.wikipedia.org"
CUCUMBER EXAMPLE
51. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Background:
Given environment has been created
And the following user details:
| user_alias | username | public_key |
| userA | testuser | test |
Scenario: IPA - Login via SSH Key authentication succeeds
Given user "userA" is authorised to access environment vms
When user "userA" starts ssh session in host "env"
Then I should be able to echo "hello world"
CUCUMBER FOR ACCEPTANCE TESTING
52. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Background:
Given environment has been created
And the following user details:
| user_alias | username | public_key |
| userA | testuser | test |
Scenario: IPA - Login via SSH Key authentication succeeds
Given user "userA" is authorised to access environment vms
When user "userA" starts ssh session in host "env"
Then I should be able to echo "hello world"
CUCUMBER FOR ACCEPTANCE TESTING
Cloud broker APIs
53. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Background:
Given environment has been created
And the following user details:
| user_alias | username | public_key |
| userA | testuser | test |
Scenario: IPA - Login via SSH Key authentication succeeds
Given user "userA" is authorised to access environment vms
When user "userA" starts ssh session in host "env"
Then I should be able to echo "hello world"
CUCUMBER FOR ACCEPTANCE TESTING
Standard Ruby
54. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
Background:
Given environment has been created
And the following user details:
| user_alias | username | public_key |
| userA | testuser | test |
Scenario: IPA - Login via SSH Key authentication succeeds
Given user "userA" is authorised to access environment vms
When user "userA" starts ssh session in host "env"
Then I should be able to echo "hello world"
CUCUMBER FOR ACCEPTANCE TESTING
RSpec assertions
55. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
UNDER THE CUCUMBER, PLAIN RUBY
Then(/^I should be able to echo "([^"]*)"$/) do |text|
cmd = "echo #{text}"
output = @session.exec!(cmd)
close_ssh(@session)
expect(output.to_s.strip).to eql(text)
end
57. @burythehammerTESTING PROGRAMMABLE INFRASTRUCTURE
THE GOOD
▸ Specialised tests for each layer
▸ Quick, expressive ServerSpec
tests
▸ Power of a full programming
language for user tests
▸ ... it's also totally doable!
Credit: Overwatch, Blizzard Entertainment
66. TESTING PROGRAMMABLE INFRASTRUCTURE @burythehammer
THE APPLICATION OF METHODS AND TOOLING
FROM SOFTWARE DEVELOPMENT TO
MANAGEMENT OF IT INFRASTRUCTURE
PROGRAMMABLE INFRASTRUCTURE IS..