Add script to launch SQL test

This commit is contained in:
2020-03-18 02:18:10 +01:00
parent 06684120ce
commit 64e3fb0134
70 changed files with 39 additions and 108 deletions

View File

@@ -30,6 +30,3 @@ begin
raise notice 'constitution test pass';
end
$$;
-- select uuid_generate_v4();

View File

@@ -24,4 +24,4 @@ begin
select (a->>'id')::uuid into _article_id from upsert_article(created_article) a;
end if;
end;
$$
$$;

View File

@@ -21,4 +21,4 @@ begin
select upsert_citizen(created_citizen) into created_citizen;
_citizen_id := created_citizen->>'id';
end
$$
$$;

View File

@@ -15,4 +15,4 @@ begin
select insert_user(created_user) into created_user;
user_id := created_user->>'id';
end
$$
$$;

View File

@@ -26,4 +26,4 @@ begin
select upsert_workgroup(created_workgroup) into created_workgroup;
assert created_workgroup->>'description' is not null, 'description should not be null';
end;
$$
$$;

View File

@@ -83,7 +83,6 @@ begin
assert(select (a#>>'{opinions, Opinion1}')::int = 1
from find_article_by_id((created_article->>'id')::uuid) a), 'the article must be have a opinion';
raise notice '%', opinion2;
assert(select (opinion2#>>'{choice, id}')::uuid = opinion_choice2_id), 'opinion2 is not inserted';
assert(select (opinion2#>>'{choice, name}') = 'Opinion2'), 'no name for opinion2';

6
src/test/test.sh Normal file
View File

@@ -0,0 +1,6 @@
#bin/bash
echo "Start tests"
cat ../main/resources/sql/functions/*/*.sql ../main/resources/sql/migrations/*.sql ./sql/fixtures/*.sql ./sql/*.sql > ./allSQL.sql
docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql
rm ./allSQL.sql
#sleep 20