Add recording_channel_ssh_aggregate view
This commit is contained in:
1 parent
89befba55e
commit
386eac072c
2 files changed
+38
-1
No files matched your search
@@ -3,6 +3,25 @@
|
||||
|
||||
begin;
|
||||
|
||||
create view recording_channel_ssh_aggregate as
|
||||
select
|
||||
rch.public_id,
|
||||
rch.recording_connection_id,
|
||||
rch.create_time,
|
||||
rch.update_time,
|
||||
rch.start_time,
|
||||
rch.end_time,
|
||||
rch.bytes_up,
|
||||
rch.bytes_down,
|
||||
rch.channel_type,
|
||||
rchsc.program as channel_program
|
||||
from recording_channel_ssh rch
|
||||
left join recording_channel_ssh_session_channel rchsc on
|
||||
rch.public_id = rchsc.recording_channel_id;
|
||||
comment on view recording_channel_ssh_aggregate is
|
||||
'recording_channel_ssh_aggregate contains the ssh channel recording info along with other info needed for displaying it on the api.';
|
||||
|
||||
|
||||
create view session_recording_aggregate as
|
||||
select
|
||||
rs.public_id,
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
-- subsystem_shorter_than_1024_bytes
|
||||
|
||||
begin;
|
||||
select plan(12);
|
||||
select plan(14);
|
||||
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'sessions');
|
||||
|
||||
select has_view('recording_channel_ssh_aggregate', 'view for aggregating channel recording info does not exist');
|
||||
|
||||
insert into recording_session
|
||||
(public_id, storage_bucket_id, session_id, state)
|
||||
values
|
||||
@@ -91,6 +93,22 @@ begin;
|
||||
values
|
||||
('chr_456789123', 'sftp');
|
||||
|
||||
prepare select_session_recordings as
|
||||
select public_id::text, recording_connection_id::text, bytes_up::int, bytes_down::int,
|
||||
channel_type::text, channel_program::text
|
||||
from recording_channel_ssh_aggregate
|
||||
order by public_id;
|
||||
|
||||
select results_eq(
|
||||
'select_session_recordings',
|
||||
$$VALUES
|
||||
('chr_123456789', 'cr_123456789', 10, 10, 'session', 'none'),
|
||||
('chr_234567891', 'cr_123456789', 10, 10, 'session', 'shell'),
|
||||
('chr_345678912', 'cr_123456789', 10, 10, 'session', 'exec'),
|
||||
('chr_456789123', 'cr_123456789', 10, 10, 'session', 'subsystem'),
|
||||
('chr_567891234', 'cr_123456789', 10, 10, 'x11', null)$$
|
||||
);
|
||||
|
||||
-- Check that the rows were inserted
|
||||
select is(count(*), 5::bigint) from recording_channel_ssh where recording_connection_id = 'cr_123456789';
|
||||
select is(count(*), 5::bigint) from recording_channel where recording_connection_id = 'cr_123456789';
|
||||
|
||||
Reference in new issue
Block a user