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 68c2d4b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 🦇
Expand All @@ -23,13 +23,16 @@ 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 \
-o ebs-bootstrap
chmod +x ebs-bootstrap
- name: Setup Tests
- name: Setup tests ⚙️
run: bats bats/setup.bats

- name: Test ext4 🧪
run: bats bats/ext4.bats
21 changes: 21 additions & 0 deletions bats/ext4.bats
Original file line number Diff line number Diff line change
@@ -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"* && "$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 68c2d4b

Please sign in to comment.