diff --git a/.ocamlformat b/.ocamlformat index f176b24..fe088d1 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version=0.24.1 +version=0.26.2 profile=default ocaml-version=4.14.0 @@ -17,4 +17,3 @@ nested-match=align # deprecated parens-ite=true parens-tuple=multi-line-only type-decl=sparse - diff --git a/tests/create_command.t b/tests/create_command.t index 59ebcd2..fdc15dc 100644 --- a/tests/create_command.t +++ b/tests/create_command.t @@ -25,9 +25,8 @@ Should succeed - create a secret in a new folder, with info about recipients add If the secret is a staging secret, its only recipient should be @everyone. - Newly created secrets should have permissions 0o644 - $ stat -c "%a" $PASSAGE_DIR/secrets/new/secret.age + $ check_permissions $PASSAGE_DIR/secrets/new/secret.age 644 Should succeed - handle secrets with comments too diff --git a/tests/refresh_command.t b/tests/refresh_command.t index d14fca1..e6e7175 100644 --- a/tests/refresh_command.t +++ b/tests/refresh_command.t @@ -28,7 +28,7 @@ Should show individual operations on secrets when -v is passed I: refreshed 6 secrets, skipped 4, failed 0 Refreshed secrets should have the same permissions as before (0o644) - $ stat -c "%a" $PASSAGE_DIR/secrets/test_secret.age + $ check_permissions $PASSAGE_DIR/secrets/test_secret.age 644 Secret content should be the same before and after refresh. diff --git a/tests/replace_command.t b/tests/replace_command.t index 0dd8780..41e7e3e 100644 --- a/tests/replace_command.t +++ b/tests/replace_command.t @@ -22,9 +22,9 @@ Should succeed - replace a secret that does not yet exist in a folder where we a new secret line 3\123\65 Newly created secrets should have permissions 0o644 - $ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_singleline.age + $ check_permissions $PASSAGE_DIR/secrets/00/new_secret_singleline.age 644 - $ stat -c "%a" $PASSAGE_DIR/secrets/00/new_secret_multiline.age + $ check_permissions $PASSAGE_DIR/secrets/00/new_secret_multiline.age 644 Should fail - replace a secret that does not yet exist in a folder where we are NOT listed on the .keys (invariant) diff --git a/tests/setup_fixtures.sh b/tests/setup_fixtures.sh index b38031b..894474b 100644 --- a/tests/setup_fixtures.sh +++ b/tests/setup_fixtures.sh @@ -120,6 +120,17 @@ setup_multiline_secret_with_comments() { EOF } +check_permissions() { + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + stat -c "%a" $1 + elif [[ "$OSTYPE" == "darwin"* ]]; then + stat -f "%A" $1 + else + echo "Unsupported OS" + exit 1 + fi +} + # $PASSAGE_DIR/secrets/ # ├── .keys # ├── 00