Download presentation
Presentation is loading. Please wait.
1
Test Driven Infrastructure
Bringing Software Development Techniques to Operations Alejandro González Pérez Ebury -
2
Infrastructure as Code: Why?
- Reproducible Results - Avoid Snowflake Servers - Testable - Automate deploy & Recovery process - Easier autoscaling - Versioning 2
3
Infrastructure as Code: What we want to avoid
3
4
Infrastructure as Code: Principles
- Write definition files to define your infrastructure - Keep it in VCS: Git, SVN, Mercurial, etc. - Self documented process “Treat your servers as cattle, not pets” It’s need testing. 4
5
Test Driven Infrastructure
Why TDI? - The earlier we found the bug the cheaper - Focus on the code you need - Code Quality We need to bring techniques from Software Developers Teams and TDD it’s a great example. 5
6
TDI 6
7
Testing your Infrastructure
- Why we need to add tests to infrastructure? Because It’s code. - What to test? I’m not asking you to test everything, just complex situations that can escape to your control. 7
8
TDD / TDI Diagram 8
9
Test Pyramid 9
10
Avoiding an Unbalanced Test suite
10
11
Test Pyramid: Low-level tests
11
12
Low level tests – Static analysis– Ansible
- Ansible Lint - - Ansible-playbook -- check and -- diff options 12
13
Low level tests – Other Options
13
14
Test Pyramid: Medium-level tests
14
15
Medium Level Tests: Inspec
- Testing framework - Written in ruby - Human Readable Syntax - You can run your tests via: local, ssh ,winrm or docker 15
16
Medium Level Tests: Inspec basic usage
How to install? - inspec init profile [Profile Name] - inspec exec [folder] [-t target] 16
17
Medium Level Tests: Inspec Syntax
17
18
Medium Level Tests: Inspec syntax
18
19
Medium Level Tests: Inspec resources
- Around 100 different resources - System: service, crontab, port, etc. - Specific software config file checking: nginx_conf, mysql_conf, etc. - File parsing, XML, Yaml, json, etc. If none of those suits you, you can use “bash” or “command” 19
20
Test Pyramid: High-level tests
20
21
High-level tests: Inspec
21
22
High-level tests: Testing your cloud
Awspec: 22
23
Test Pyramid: Summary 23
24
Integrate it with your workflow
24
25
Integrate it with your workflow: Ebury Example
25
26
Testing Frameworks 26
27
Summary Test your code. 27
28
Testing your Infrastructure
Resources: - Infrastructure as Code - Inspec io Official Documentation - Ansible Official documentation - Puppet: - FoodCritic: - Test Driven Development - Molecule: - KitchenCI: 28
29
Demo
30
Questions?
31
THANK YOU!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.