Skip to content

Commit

Permalink
WIP test ext4
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-jay committed May 20, 2024
1 parent 0f004c3 commit 80c918c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:
- name: Setup Tests
run: bats bats/setup.bats

- name: Test ext4
run: bats bats/ext4.bats
22 changes: 22 additions & 0 deletions bats/ext4.bats
Original file line number Diff line number Diff line change
@@ -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" = *"Successfuly formatted /dev/loop"*" to ext4"* ]] &&
[[ "$output" = *"Successfully mounted /dev/loop"*" to /tmp/ext4"* ]]
}
13 changes: 13 additions & 0 deletions bats/setup.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}

0 comments on commit 80c918c

Please sign in to comment.