Files
threshold/internal/db/sqltest/tests/wh/session_connection/update.sql
T
Michael Gaffney 477e6df269 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.
2023-05-31 12:18:17 +00:00

25 lines
1.4 KiB
PL/PgSQL

-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: MPL-2.0
begin;
select plan(8);
select is(count(*), 1::bigint) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select is(bytes_up, null) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select is(bytes_down, null) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select is(connection_closed_time, 'infinity'::wh_timestamp) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
update session_connection set
bytes_up = 10,
bytes_down = 5,
closed_reason = 'closed by end-user'
where public_id = 'sc1_____clare';
select is(count(*), 2::bigint) from wh_session_connection_accumulating_fact;
select is(bytes_up, 10::wh_bytes_transmitted) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select is(bytes_down, 5::wh_bytes_transmitted) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select is(connection_closed_time, now()::wh_timestamp) from wh_session_connection_accumulating_fact where connection_id = 'sc1_____clare';
select * from finish();
rollback;