diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6109d01..82c4eeb 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -33,3 +33,6 @@ jobs: - name: Setup Tests run: bats bats/setup.bats + + - name: Test ext4 + run: bats bats/ext4.bats diff --git a/bats/ext4.bats b/bats/ext4.bats new file mode 100644 index 0000000..8deb7df --- /dev/null +++ b/bats/ext4.bats @@ -0,0 +1,21 @@ +#!/usr/bin/env bats +# vim: set ft=sh sw=4 : + +load helper_print-info + +setup() { + # get the containing directory of this file + # use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0, + # as those will point to the bats executable's location or the preprocessed file respectively + DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" + # make executables in root of the repo visible to PATH + PATH="$DIR/../:$PATH" +} + +@test "format & mount loop with ext4" { + run sudo $(command -v ebs-bootstrap) -config /tmp/ext4-bootstrap.yaml -mode force + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" = *"Successfuly formatted /dev/loop"*" to ext4"* ]] +} diff --git a/bats/setup.bats b/bats/setup.bats index 920a398..c4327ec 100644 --- a/bats/setup.bats +++ b/bats/setup.bats @@ -24,3 +24,16 @@ setup() { [ "$status" -eq 0 ] && [[ "$output" = *"/tmp/fs"* ]] } + +@test "setup ext4 config" { + echo """ +--- +devices: + $(cat /tmp/loopdev): + fs: ext4 + mountPoint: /tmp/ext4 +""" > /tmp/ext4-bootstrap.yaml + + run mkdir /tmp/ext4 + [ "$status" -eq 0 ] +}