github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/test/builder_lxc.bats (about) 1 #!/usr/bin/env bats 2 # 3 # This tests the lxc builder. The teardown function will 4 # delete any images in the output-lxc-* folders. 5 6 #load test_helper 7 #fixtures builder-lxc 8 FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/builder-lxc" 9 10 # Required parameters 11 command -v lxc-create >/dev/null 2>&1 || { 12 echo "'lxc-create' must be installed via the lxc (or lxc1 for ubuntu >=16.04) package" >&2 13 exit 1 14 } 15 16 teardown() { 17 rm -rf output-lxc-* 18 } 19 20 @test "lxc: build centos minimal.json" { 21 run packer build -var template_name=centos $FIXTURE_ROOT/minimal.json 22 [ "$status" -eq 0 ] 23 [ -f output-lxc-centos/rootfs.tar.gz ] 24 [ -f output-lxc-centos/lxc-config ] 25 } 26 27 28 @test "lxc: build trusty minimal.json" { 29 run packer build -var template_name=ubuntu -var template_parameters="SUITE=trusty" $FIXTURE_ROOT/minimal.json 30 [ "$status" -eq 0 ] 31 [ -f output-lxc-ubuntu/rootfs.tar.gz ] 32 [ -f output-lxc-ubuntu/lxc-config ] 33 } 34 35 @test "lxc: build debian minimal.json" { 36 run packer build -var template_name=debian -var template_parameters="SUITE=jessie" $FIXTURE_ROOT/minimal.json 37 [ "$status" -eq 0 ] 38 [ -f output-lxc-debian/rootfs.tar.gz ] 39 [ -f output-lxc-debian/lxc-config ] 40 }