github.com/tonnydourado/packer@v0.6.1-0.20140701134019-5d0cd9676a37/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_CLIENT_SECRETS_FILE`
    45  * `GC_PRIVATE_KEY_FILE`
    46  * `GC_PROJECT_ID`
    47  
    48  ### Running
    49  
    50  These tests are meant to be run _one file at a time_. There are some
    51  test files (such as the amazon-chroot builder test) that simply won't
    52  run except in special environments, so running all test files will probably
    53  never work.
    54  
    55  If you're working on Packer and want to test that your change didn't
    56  adversely affect something, try running only the test that is related to
    57  your change.
    58  
    59  ```
    60  $ bats builder_amazon_ebs.bats
    61  ```
    62  
    63  Note: Working directory doesn't matter. You can call the bats test file
    64  from any directory.