Skip to content

Commit

Permalink
fix: add pipefail option and fix chown in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
williarin committed Jan 9, 2022
1 parent 9947543 commit e2532d8
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/backup
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/lib/env.sh"
Expand Down
2 changes: 1 addition & 1 deletion src/decrypt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/lib/file.sh"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/db.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

#/ Retrieve the list of all databases, excluding system databases
#/
#/ @usage var="$(mysql_command "localhost" "3306" "root" "root" "SHOW DATABASES;")"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

#/ Helper function to lookup "env_FILE", "env", then fallback
#/
#/ @usage var="$(get_env "MYSQL_PASSWORD" "fallback_value")"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/file.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/env.sh"

Expand Down
2 changes: 1 addition & 1 deletion src/run-cron
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/lib/env.sh"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/create_archive.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setup() {
source file.sh

mkdir -p /tmp/backup /backup
chown "$USER:$GROUP" /tmp/backup /backup
chown "$(id -u):$(id -g)" /tmp/backup /backup
}

@test "fails if no argument given" {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/decrypt_archive.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setup() {
source file.sh

mkdir -p /tmp/backup /backup
chown "$USER:$GROUP" /tmp/backup /backup
chown "$(id -u):$(id -g)" /tmp/backup /backup
}

@test "fails if no argument given" {
Expand Down

0 comments on commit e2532d8

Please sign in to comment.