Are you wondering how to solve repetitive tasks with software automation, but you struggle every time you see the word “developer” or “code?” Do you know what APIs are and how they make these tasks easy to solve? In this session, we’ll explore the framework that can apply to mundane tasks (i.e. PowerShell, Pester), and we’ll discuss what open source tools are available to help solve these problems. Walk away with the advice you need to get started!
10. The Main Drivers
• You want to test your scripts for bugs
- But you feel bad making other humans do this for you
• You freely admit and acknowledge that testing isn’t possible with your own meat
spatulas
• You also like to automate stuff to avoid more work
11. How Pester Helps
• You write one or more unit tests
• Pester executes them
• The tests either pass or fail
• Results are displayed
11
14. What Happened?
• The function was evaluated
• The return value was $true
• Pester uses the “Should Be” to compare against $false
• These values don’t match
• The test fails
14
16. The Describe Block
• This is your logical grouping of tests
• It’s also a testing scope
- You can define “mock” commands within this scope
• Child objects:
- Context = a group of “it” tests
- It = a single test
17. The Context Block
• A way to logically divide your Describe blocks
- Ex: Run tests under one context / account, then repeat using a different one
- Ex: Test using a “user” account and then again using a “super user” or “admin” account
- Ex: Start with a relative path and then a strict path
17
18. The It Block
• This is where you run a specific test
• One set of inputs, one set of outputs
- Don’t get all fancy pants!
• Use the Arrange-Act-Assert format
- Get data
- Test it
- Make sure it ran (code coverage)
18
19. Describe, Context, and It
• Describe … a group of API specific tests
- Context … a group of tests against an old API version
• It … runs tests against function1
• It … runs tests against function2
• It … runs tests against function3
- Context … a group of tests against a new API version
• It … (repeat tests from before)
• Describe … a group of parameter tests
And so on …
19
26. Why Does Vester Exist?
• Other configuration software focused on the guests and applications
• Not the hypervisor / cluster config
• You don’t know and/or are afraid of Microsoft DSC
• You can’t (or don’t want to) set up a push or pull server
• You are a contractor doing an audit of a customer’s environment
• You’re looking for a very quick way to create your own custom tests
• You aren’t able to install agents or are just generally opposed to agents
for management
• You’re comfortable with PowerShell as a cross-platform development
framework
32. The Future!
• Infrastructure as Code means no boundaries
- The framework supports any configuration requirements
• Fork the project
- Nutanix + Pester = Nester? ☺
- Lots of great use cases available!
• Consistency?
- Deploy like-for-like environments globally
- Make sure you don’t mess things up with your meat spatulas
• STIGs?
- Acropolis Virtual Storage Controller STIG
- Nutanix Prism Web Server STIG (for tomcat)
- Nutanix Prism Proxy Server STIG (for Apache)
- Nutanix JRE8 STIG
- AHV STIG
33. Thoughts
• Keep your functions as small as possible
- I prefer one logical statement per function
• Unit test the functions rather than the workflows
• Embrace TDD and creating tests for everything you do
- Test Driven Development (of infrastructure, too!)
• As you encounter an issue, build a test for it
- That way it never happens again
- Crush tribal knowledge!
• Be kind to your future self
33