Table of Contents – Infrastructure Validation
This chapter is the one I’ve been expecting all along, and that’s most likely due to it being a selling point of Pester, in my opinion. That’s infrastructure validation, or infrastructure testing, and I’ve seen it discussed in several blog posts prior to its chapter breakdown here. This testing had its hand in how I first used Pester, and I believe it’s one way to get people uninterested in Pester, interested in Pester.
When I started my chapter reviews on The Pester Book, I did so with a story of how I had previously used Pester. You can read it in my introduction post. It discusses the need to verify multiple settings on a work group server in AWS. As we didn’t have Active Directory, a good deal of settings required automation and instead of manually checking that my automation had done what it was supposed to do — which just seems weird anyway — I used Pester to verify my systems were built out as expected. It was a moment in which I was proud, and a part of ensuing that I would know Pester, as well as I can one day. The whole did-it-actually-do-what-it-was-expected-to-do mentality, is a bit of shift after the first 14 chapters.
This chapter does that same thing — automated checking and verification — but does so as it steps away from what we’ve been learning all along. We’re not worried about breaking external dependency, such as we do with unit testing, and instead we need to test that dependencies are actually in place. If we’re creating users in Active Directory, we need Active Directory. If we’re using a CSV file of users to create, we need a CSV. Even more, we need to know that the file contains the data we’re expecting. All these things, are the dependencies we require in order to create the users in the directory. This was in fact the example used by the book, and it was a helpful breakdown of this entire process.
What’s interesting, is that when I think thought infrastructure, I often considered hardware, or at least VMs. Like, real honest pieces of infrastructure. I didn’t actually think of users, and therefore, this chapter’s example was beneficial, as infrastructure can in fact be users. I can buy into that, especially in relation to infrastructure testing.
And now, moving along. We have a couple more chapters in this part of the book.
Update: I located an image of the Pester testing mentioned here and in my introduction post, as well. It’s been included below. It took only 950 milliseconds to completely check that my machine was built property. It checks for Registry entries, a certificate, PowerShell modules, and more. I couldn’t even do the first test manually — checking for a Registry subkey — in that amount of time. I’d be lucky if the Registry would even open in under a second.