github.com/amanya/packer@v0.12.1-0.20161117214323-902ac5ab2eb6/test/README.md (about) 1 # Packer Black-Box Tests 2 3 This folder contains tests that test Packer using a black-box approach: 4 `packer` is executed directly (with whatever is on the PATH) and certain 5 results are expected. 6 7 Tests are run using [Bats](https://github.com/sstephenson/bats), and therefore 8 Bash is required to run any tests. 9 10 **Warning:** Many of these tests run using AWS, and therefore have a 11 real-world cost associated with running the tests. Be aware of that prior 12 to running the tests. Additionally, many tests will leave left-over artifacts 13 (AMIs) that you'll have to manually clean up. 14 15 ## Running Tests 16 17 ### Required Software 18 19 Before running the tests, you'll need the following installed. If you're 20 running on Mac OS X, most of these are available with `brew`: 21 22 * [Bats](https://github.com/sstephenson/bats) 23 24 * [AWS cli](http://aws.amazon.com/cli/) for AWS tests as well as most 25 of the components. 26 27 * [gcutil](https://developers.google.com/compute/docs/gcutil/#install) for 28 Google Compute Engine tests. 29 30 ### Configuring Tests 31 32 **For tests that require AWS credentials:** 33 34 Set the following self-explanatory environmental variables: 35 36 * `AWS_ACCESS_KEY_ID` 37 * `AWS_SECRET_ACCESS_KEY` 38 39 **For tests that test Google Compute Engine:** 40 41 Set the following environmental variables: 42 43 * `GC_BUCKET_NAME` 44 * `GC_ACCOUNT_FILE` 45 * `GC_PROJECT_ID` 46 47 ### Running 48 49 These tests are meant to be run _one file at a time_. There are some 50 test files (such as the amazon-chroot builder test) that simply won't 51 run except in special environments, so running all test files will probably 52 never work. 53 54 If you're working on Packer and want to test that your change didn't 55 adversely affect something, try running only the test that is related to 56 your change. 57 58 ``` 59 $ bats builder_amazon_ebs.bats 60 ``` 61 62 Note: Working directory doesn't matter. You can call the bats test file 63 from any directory.