github.com/amanya/packer@v0.12.1-0.20161117214323-902ac5ab2eb6/test/provisioner_file.bats (about)

     1  #!/usr/bin/env bats
     2  #
     3  # This tests the amazon-ebs builder. The teardown function will automatically
     4  # delete any AMIs with a tag of `packer-test` being equal to "true" so
     5  # be sure any test cases set this.
     6  
     7  load test_helper
     8  fixtures provisioner-file
     9  
    10  setup() {
    11      cd $FIXTURE_ROOT
    12  }
    13  
    14  teardown() {
    15      aws_ami_cleanup
    16  }
    17  
    18  @test "file provisioner: single file" {
    19      run packer build $FIXTURE_ROOT/file.json
    20      [ "$status" -eq 0 ]
    21      [[ "$output" == *"24901 miles"* ]]
    22  }
    23  
    24  @test "file provisioner: directory (no trailing slash)" {
    25      run packer build $FIXTURE_ROOT/dir_no_trailing.json
    26      [ "$status" -eq 0 ]
    27      [[ "$output" == *"337 miles"* ]]
    28  }
    29  
    30  @test "file provisioner: directory (with trailing slash)" {
    31      run packer build $FIXTURE_ROOT/dir_with_trailing.json
    32      [ "$status" -eq 0 ]
    33      [[ "$output" == *"337 miles"* ]]
    34  }
    35  
    36  @test "file provisioner: single file through sftp" {
    37      run packer build $FIXTURE_ROOT/file_sftp.json
    38      [ "$status" -eq 0 ]
    39      [[ "$output" == *"24901 miles"* ]]
    40  }
    41  
    42  @test "file provisioner: directory through sftp (no trailing slash)" {
    43      run packer build $FIXTURE_ROOT/dir_no_trailing_sftp.json
    44      [ "$status" -eq 0 ]
    45      [[ "$output" == *"337 miles"* ]]
    46  }
    47  
    48  @test "file provisioner: directory through sftp (with trailing slash)" {
    49      run packer build $FIXTURE_ROOT/dir_with_trailing_sftp.json
    50      [ "$status" -eq 0 ]
    51      [[ "$output" == *"337 miles"* ]]
    52  }