From c3b4f19c6b1ad43fa0974bbed83a742a06a2bda0 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Mon, 20 May 2024 19:51:30 +1000 Subject: [PATCH] WIP test ext4 --- .github/workflows/build-and-release.yml | 3 +++ bats/ext4.bats | 29 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 bats/ext4.bats 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..d19dba0 --- /dev/null +++ b/bats/ext4.bats @@ -0,0 +1,29 @@ +#!/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 loop with ext4" { + echo """ +--- +devices: + $(cat /tmp/loopdev): + fs: ext4 + force: true +""" > /tmp/ext4-bootstrap.yaml + + run sudo ebs-bootstrap -config /tmp/ext4-bootstrap.yaml + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" = *"/tmp/fs"* ]] +}