From the course: Learning HashiCorp Packer

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing

Testing - Packer Tutorial

From the course: Learning HashiCorp Packer

Start my 1-month free trial

Testing

- [Instructor] As we can add multiple provisioners to Packer, I'm gonna use this to run some tests. These tests will run before Packer takes an image, so if they fail, Packer will cancel the process and no image will be made. I'm going to be using the Testinfra framework, which is a really simple Python framework. So I've written a few tests here already, and what they do is they will ensure that I've installed Jenkins, which is test number one. Second test will ensure that Jenkins is actually up and running. The third test will ensure that I've got Ansible installed on the box. And the fourth test will ensure that I've installed Packer. Now I know that Ansible is doing all these things for us, but we definitely don't want an image that's created where they failed and Ansible hasn't picked it up. So this is like a belt and braces. So what we're going to do is have a look at where I'm running these inside Packer. So we've got up here our existing provisioner, where we run Ansible. And…

Contents