Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Run encryption tests in CI with test keys (#4335)

GFR1caafe9d30ed
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 61418d6477..7c4f30c97e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -155,6 +155,27 @@ jobs:
- name: Unit and integration tests
run: bin/rails test
+ # Encryption tests skip unless Active Record encryption is configured
+ # through ENV or credentials (Encryptable.encryption_ready?), so the run
+ # above never exercises them. Rerun every test file that checks
+ # encryption_ready? with throwaway keys, so new encryption tests are
+ # picked up without a hand-kept list. The whole suite is not run with
+ # keys because unrelated tests assume encryption is off.
+ - name: Encryption tests
+ if: ${{ !cancelled() }}
+ env:
+ ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY: test
+ ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY: test
+ ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: test
+ run: |
+ mapfile -t files < <(grep -rl --include='*_test.rb' 'encryption_ready?' test | sort)
+ if [ "${#files[@]}" -eq 0 ]; then
+ echo "No encryption tests found" >&2
+ exit 1
+ fi
+ printf '%s\n' "${files[@]}"
+ bin/rails test "${files[@]}"
+
test_system:
runs-on: ubuntu-latest
timeout-minutes: 20