diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 6109d01..59969ef 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -12,7 +12,7 @@ jobs: system-test: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout code ๐Ÿ›’ uses: actions/checkout@v4 - name: Setup bats ๐Ÿฆ‡ @@ -23,7 +23,7 @@ jobs: # - name: Download all workflow run artifacts # uses: actions/download-artifact@v3 - - name: Download + - name: Download ๐Ÿ“ฅ shell: bash run: | curl -fLsS https://github.com/reecetech/ebs-bootstrap/releases/download/v1.0.7/ebs-bootstrap-linux-x86_64 \ @@ -31,5 +31,8 @@ jobs: chmod +x ebs-bootstrap - - name: Setup Tests + - 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..ce36485 --- /dev/null +++ b/bats/ext4.bats @@ -0,0 +1,22 @@ +#!/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" = *"Successfully formatted /dev/loop"*" to ext4"* ]] && + [[ "$output" = *"Successfully mounted /dev/loop"*" to /tmp/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 ] +}