github.com/swisspost/terratest@v0.0.0-20230214120104-7ec6de2e1ae0/examples/packer-hello-world-example/README.md (about)

     1  # Packer "Hello, World" Example
     2  
     3  This folder contains the simplest possible Packer template—one that builds a Docker image with a text file that says
     4  "Hello, World"!—to demonstrate how you can use Terratest to write automated tests for your Packer templates.
     5  
     6  Check out [test/packer_hello_world_example_test.go](/test/packer_hello_world_example_test.go) to see how you can write
     7  automated tests for this simple template.
     8  
     9  
    10  ## Installation steps
    11  1. Install [Packer](https://www.packer.io/) and make sure it's on your `PATH`.
    12  1. Install [Docker](https://www.docker.com/) and make sure it's on your `PATH`.
    13  
    14  
    15  ## Building the Packer template (Packer >= 1.7.0)
    16  1. Run `packer init build.pkr.hcl`.
    17  1. Run `packer build build.pkr.hcl`.
    18  
    19  
    20  ## Building the Packer template (Packer < 1.7.0)
    21  1. Run `packer build build.json`.
    22  
    23  
    24  ## Run Docker
    25  1. Run `docker run -it --rm gruntwork/packer-hello-world-example cat /test.txt`.
    26  1. You should see the text "Hello, World!"
    27  
    28  
    29  ## Running automated tests against the Packer template
    30  
    31  1. Install [Packer](https://www.packer.io/) and make sure it's on your `PATH`.
    32  1. Install [Docker](https://www.docker.com/) and make sure it's on your `PATH`.
    33  1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`.
    34  1. `cd test`
    35  1. `go test -v -run TestPackerHelloWorldExample`