feat(sql): Add target and host history tables to session recording
This adds four columns to the `recording_session` table which are foreign keys to the `iam_scope_hst`, `target_ssh_hst`, `host_history_base`, and `host_catalog_history_base` tables. The foreign key to the `iam_scope_hst` table references the project scope of the target at the time of the recording.
This commit is contained in:
1 parent
73b710cd06
commit
477e6df269
14 files changed
+220
-118
No files matched your search
@@ -2,7 +2,7 @@
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
begin;
|
||||
select plan(9);
|
||||
select plan(12);
|
||||
|
||||
-- Ensure session state table is populated
|
||||
select is(count(*), 1::bigint) from session_state where session_id = 's1_____clare' and state='pending';
|
||||
@@ -10,19 +10,23 @@ begin;
|
||||
select is(count(*), 1::bigint) from session_state where session_id = 's1_____ciara' and state='canceling';
|
||||
select is(count(*), 1::bigint) from session_state where session_id = 's1_____carly' and state='active';
|
||||
|
||||
-- Check that we have 4 sessions using this target
|
||||
select is(count(*), 4::bigint) from session where target_id = 't_________cb';
|
||||
|
||||
select is(count(*), 3::bigint) from session where target_id = 't_________cb';
|
||||
select is(count(*), 2::bigint) from session where target_id = 'tssh______cb';
|
||||
|
||||
-- Delete target, expect no errors
|
||||
delete from target where public_id='t_________cb';
|
||||
select is(count(*), 0::bigint) from target where public_id='t_________cb';
|
||||
|
||||
delete from target where public_id='tssh______cb';
|
||||
select is(count(*), 0::bigint) from target where public_id='tssh______cb';
|
||||
|
||||
-- Ensure we no longer have sessions associated with this target
|
||||
select is(count(*), 0::bigint) from session where target_id = 't_________cb';
|
||||
select is(count(*), 0::bigint) from session where target_id = 'tssh______cb';
|
||||
|
||||
-- Ensure sessions that were pending or active are now in canceling state
|
||||
select is(count(*), 1::bigint) from session_state where state = 'canceling' and session_id = 's1_____clare';
|
||||
select is(count(*), 1::bigint) from session_state where state = 'canceling' and session_id = 's1_____carly';
|
||||
|
||||
select * from finish();
|
||||
rollback;
|
||||
rollback;
|
||||
Reference in new issue
Block a user