Skip to content

Commit 918130d

Browse files
committed
Add a step to completely clean the database between tests
Eliminates test contamination when tests are run multiple times
1 parent e60861a commit 918130d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tasks/reset.sh

+3
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ fail_if_postgres_not_running
2626
# Uninstall
2727
cat release/cipherstash-encrypt-uninstall.sql | docker exec -i ${container_name} psql ${connection_url} -f-
2828

29+
# Wipe test data
30+
cat tests/999-wipe-test-data.sql | docker exec -i ${container_name} psql ${connection_url} -f-
31+
2932
# Install
3033
cat release/cipherstash-encrypt.sql | docker exec -i ${container_name} psql ${connection_url} -f-

tests/999-wipe-test-data.sql

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- !!! Only used during tests !!
2+
-- Fully clean out the database between test runs
3+
4+
DROP SCHEMA public CASCADE;
5+
CREATE SCHEMA public;
6+
GRANT ALL ON SCHEMA public TO postgres;
7+
GRANT ALL ON SCHEMA public TO public;

0 commit comments

Comments
 (0)