mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 11:17:46 +00:00
Add maplapse unit tests
This commit is contained in:
36
tests/sql/maplapse.sql
Normal file
36
tests/sql/maplapse.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
---------------------------------------------------------------------------
|
||||
-- Listing
|
||||
--
|
||||
|
||||
-- List current database
|
||||
select current_database();
|
||||
|
||||
-- connect to the DB
|
||||
\c signalk
|
||||
|
||||
-- output display format
|
||||
\x on
|
||||
|
||||
-- Assign vessel_id var
|
||||
SELECT v.vessel_id as "vessel_id_kapla" FROM auth.vessels v WHERE v.owner_email = 'demo+kapla@openplotter.cloud' \gset
|
||||
SELECT v.vessel_id as "vessel_id_aava" FROM auth.vessels v WHERE v.owner_email = 'demo+aava@openplotter.cloud' \gset
|
||||
|
||||
-- user_role
|
||||
SET ROLE user_role;
|
||||
SELECT set_config('vessel.id', :'vessel_id_kapla', false) IS NOT NULL as vessel_id;
|
||||
-- insert fake request maplapse
|
||||
\echo 'Insert fake request maplapse'
|
||||
SELECT api.maplapse_record_fn('Kapla,?start_log=1&end_log=1&height=100vh');
|
||||
|
||||
-- maplapse_role
|
||||
SET ROLE maplapse_role;
|
||||
|
||||
\echo 'GET pending maplapse task'
|
||||
SELECT id as maplapse_id from process_queue where channel = 'maplapse_video' and processed is null order by stored asc limit 1 \gset
|
||||
SELECT count(id) from process_queue where channel = 'maplapse_video' and processed is null limit 1;
|
||||
|
||||
\echo 'Update process on completion'
|
||||
UPDATE process_queue SET processed = NOW() WHERE id = :'maplapse_id';
|
||||
|
||||
\echo 'Insert video availability notification in process queue'
|
||||
INSERT INTO process_queue ("channel", "payload", "ref_id", "stored") VALUES ('new_video', CONCAT('video_', :'vessel_id_kapla'::TEXT, '_1', '_1.mp4'), :'vessel_id_kapla'::TEXT, NOW());
|
24
tests/sql/maplapse.sql.output
Normal file
24
tests/sql/maplapse.sql.output
Normal file
@@ -0,0 +1,24 @@
|
||||
current_database
|
||||
------------------
|
||||
signalk
|
||||
(1 row)
|
||||
|
||||
You are now connected to database "signalk" as user "username".
|
||||
Expanded display is on.
|
||||
SET
|
||||
-[ RECORD 1 ]
|
||||
vessel_id | t
|
||||
|
||||
Insert fake request maplapse
|
||||
-[ RECORD 1 ]------+--
|
||||
maplapse_record_fn | t
|
||||
|
||||
SET
|
||||
GET pending maplapse task
|
||||
-[ RECORD 1 ]
|
||||
count | 1
|
||||
|
||||
Update process on completion
|
||||
UPDATE 1
|
||||
Insert video availability notification in process queue
|
||||
INSERT 0 1
|
Reference in New Issue
Block a user