Skip to content

Commit 0409578

Browse files
committed
Make tests more robust Vs system/users's umask
1 parent a55dacb commit 0409578

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

tests/create_command.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Should succeed - create a secret in a new folder, with info about recipients add
2525

2626
If the secret is a staging secret, its only recipient should be @everyone.
2727

28-
Newly created secrets should have permissions 0o644
29-
$ stat -c "%a" $PASSAGE_DIR/secrets/new/secret.age
30-
644
28+
Newly created secrets should have permissions 0o644 or less
29+
$ stat -c "%a" $PASSAGE_DIR/secrets/new/secret.age | more_deterministic_permissions
30+
6xx
3131

3232
Should succeed - handle secrets with comments too
3333
$ printf "secret\n\ncomment" | passage create new/single-line

tests/refresh_command.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Should show individual operations on secrets when -v is passed
2727
I: refreshed test_secret
2828
I: refreshed 6 secrets, skipped 4, failed 0
2929

30-
Refreshed secrets should have the same permissions as before (0o644)
31-
$ stat -c "%a" $PASSAGE_DIR/secrets/test_secret.age
32-
644
30+
Refreshed secrets should have the same permissions as before (0o644 or less)
31+
$ stat -c "%a" $PASSAGE_DIR/secrets/test_secret.age | more_deterministic_permissions
32+
6xx
3333

3434
Secret content should be the same before and after refresh.
3535
$ passage cat test_secret

tests/replace_command.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Should succeed - replace a secret that does not yet exist in a folder where we a
2121
new secret line 2
2222
new secret line 3\123\65
2323

24-
Newly created secrets should have permissions 0o644
25-
$ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_singleline.age
26-
644
27-
$ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_multiline.age
28-
644
24+
Newly created secrets should have permissions 0o644 or less
25+
$ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_singleline.age | more_deterministic_permissions
26+
6xx
27+
$ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_multiline.age | more_deterministic_permissions
28+
6xx
2929

3030
Should fail - replace a secret that does not yet exist in a folder where we are NOT listed on the .keys (invariant)
3131
$ echo "new secret" | passage replace 01/00/new_secret_singleline

tests/setup_fixtures.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,7 @@ EOF
267267
setup_keys_dir
268268
setup_secrets_dir
269269
setup_templates
270+
271+
more_deterministic_permissions () {
272+
sed 's/^6../6xx/'
273+
}

0 commit comments

Comments
 (0)