test(sqltest): Fix tests due to new auth_token insert trigger

With the addition of an after insert trigger to the auth_token table,
entries are added to the wh_user_dimension table when auth token's are
inserted with the 'token issued' status. This caused a number of tests
to fail that assumed the user dimension table would be empty prior to
inserting sessions. This introduces a number of changes to the tests:

- In the test setup, auth tokens are not created with an explicit
  expiration time and status. The expiration time ensures that the
  tokens are 'valid' for the test. The status allows test to make
  assertions on tokens in different statuses, and allow the status to
  change during the test.
- Tests make the correct assertions on the number of entries in the user
  dimension table after test setup.
- User dimension tests modify a user after the standard setup to ensure
  that a new user dimension is added when a session is inserted.
This commit is contained in:
Timothy Messier committed 2024-02-23 15:44:08 +00:00
1 parent 9e0d96b887
commit 9514a76289
11 files changed
+258 -190

No files matched your search

@@ -199,13 +199,13 @@ begin;
('p____gcolors', 'hc__st_____g', 'Green Color Static Catalog');
insert into auth_token
(key_id, auth_account_id, public_id, token)
(key_id, auth_account_id, public_id, token, expiration_time, status)
values
('kdkv__colors', 'apa____clare', 'tok____clare', 'tok____clare'::bytea),
('kdkv__colors', 'apa____cindy', 'tok____cindy', 'tok____cindy'::bytea),
('kdkv__colors', 'apa____ciara', 'tok____ciara', 'tok____ciara'::bytea),
('kdkv__colors', 'apa____carly', 'tok____carly', 'tok____carly'::bytea),
('kdkv__colors', 'apa_____cora', 'tok_____cora', 'tok_____cora'::bytea);
('kdkv__colors', 'apa____clare', 'tok____clare', 'tok____clare'::bytea, now() + interval '15 days', 'token issued'),
('kdkv__colors', 'apa____cindy', 'tok____cindy', 'tok____cindy'::bytea, now() + interval '15 days', 'token issued'),
('kdkv__colors', 'apa____ciara', 'tok____ciara', 'tok____ciara'::bytea, now() + interval '15 days', 'auth token pending'),
('kdkv__colors', 'apa____carly', 'tok____carly', 'tok____carly'::bytea, now() + interval '15 days', 'token issued'),
('kdkv__colors', 'apa_____cora', 'tok_____cora', 'tok_____cora'::bytea, now() + interval '15 days', 'auth token pending');
insert into static_host
(catalog_id, public_id, address)
@@ -133,7 +133,7 @@ begin;
(key_id, table_name, total_count)
values
('kdkv___widget', 'auth_token', 100);
end;
$$ language plpgsql;
@@ -172,13 +172,13 @@ begin;
update auth_account set iam_user_id = 'u_____wilson' where public_id = 'apa___wilson';
insert into auth_token
(key_id, auth_account_id, public_id, token)
(key_id, auth_account_id, public_id, token, expiration_time, status)
values
('kdkv___widget', 'apa___walter', 'tok___walter', 'tok___walter'::bytea),
('kdkv___widget', 'apa1__walter', 'tok1__walter', 'tok1__walter'::bytea),
('kdkv___widget', 'apa___warren', 'tok___warren', 'tok___warren'::bytea),
('kdkv___widget', 'apa___waylon', 'tok___waylon', 'tok___waylon'::bytea),
('kdkv___widget', 'apa___wilson', 'tok___wilson', 'tok___wilson'::bytea);
('kdkv___widget', 'apa___walter', 'tok___walter', 'tok___walter'::bytea, now() + interval '15 days', 'token issued'),
('kdkv___widget', 'apa1__walter', 'tok1__walter', 'tok1__walter'::bytea, now() + interval '15 days', 'token issued'),
('kdkv___widget', 'apa___warren', 'tok___warren', 'tok___warren'::bytea, now() + interval '15 days', 'token issued'),
('kdkv___widget', 'apa___waylon', 'tok___waylon', 'tok___waylon'::bytea, now() + interval '15 days', 'token issued'),
('kdkv___widget', 'apa___wilson', 'tok___wilson', 'tok___wilson'::bytea, now() + interval '15 days', 'auth token pending');
insert into auth_oidc_method
(scope_id, public_id, client_id, name, state, key_id, issuer)
@@ -206,7 +206,7 @@ begin;
('o_____widget', 'alm___widget', 'Widget LDAP', 'active-private');
insert into auth_ldap_url
(ldap_method_id, url, connection_priority)
values
values
('alm___widget', 'ldaps://ldap1', 1);
insert into auth_ldap_account
@@ -9,12 +9,12 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 0::bigint) from wh_user_dimension where user_id = 'u_____wilson';
select lives_ok($$select wh_upsert_user('u_____walter', 'tok___walter')$$);
select lives_ok($$select wh_upsert_user('tok___wilson')$$);
-- upsert should insert a user_dimension
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____wilson';
select * from finish();
rollback;
@@ -9,7 +9,7 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 0::bigint) from wh_user_dimension where user_id = 'u_____wilson';
insert into wh_user_dimension
(
@@ -25,8 +25,8 @@ begin;
values
(
'wud_____1',
'u_____walter', 'Walter', 'This is Walter',
'apa___walter', 'password auth account', 'walter', 'Account for Walter',
'u_____wilson', 'Wilson', 'This is Wilson',
'apa___wilson', 'password auth account', 'wilson', 'Account for Wilson',
'None', 'None', 'None',
'apm___widget', 'password auth method', 'Widget Auth Password', 'None',
'None',
@@ -34,11 +34,11 @@ begin;
'Current', '2021-07-21T12:01'::timestamptz, 'infinity'::timestamptz
);
select lives_ok($$select wh_upsert_user('u_____walter', 'tok___walter')$$);
select lives_ok($$select wh_upsert_user('tok___wilson')$$);
-- upsert should insert a user_dimension
select is(count(*), 2::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(count(*), 2::bigint) from wh_user_dimension where user_id = 'u_____wilson';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____wilson' and current_row_indicator = 'Current';
select * from finish();
rollback;
@@ -1,15 +1,23 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
-- oidc_auth_new_session tests the wh_user_dimesion when
-- a new session is created using the oidc auth method.
-- ldap_auth_new_session tests the wh_user_dimesion when
-- a new session is created using the ldap auth method.
begin;
select plan(40);
select plan(41);
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimension from auth tokens
select is(count(*), 2::bigint)
from wh_user_dimension
where user_id in ('u_____walter', 'u_____warren')
and auth_method_id = 'alm___widget';
-- update walter and warren so the user dimension is changed when the session is inserted
update iam_user
set description = 'LDAP Auth New Session'
where public_id in ('u_____walter', 'u_____warren');
-- insert first session, should result in a new user dimension
insert into session
@@ -21,30 +29,43 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
-- inserting the session should result in a new user dimension.
select is(count(*), 1::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'alm___widget'
and user_description = 'LDAP Auth New Session';
select is(auth_account_id, 'ala___walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_type, 'ldap auth account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_name, 'walter account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_description, 'Walter LDAP Account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_external_id, 'walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_full_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_email, 'walter@widget.test') from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_description, 'LDAP Auth New Session') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_id, 'alm___widget') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_type, 'ldap auth method') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_name, 'Widget LDAP') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_id, 'ala___walter') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_type, 'ldap auth account') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_name, 'walter account') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_description, 'Walter LDAP Account') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_external_id, 'walter') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_full_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_email, 'walter@widget.test') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_id, 'alm___widget') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_type, 'ldap auth method') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_name, 'Widget LDAP') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(session_fact.user_key, user_dim.key)
from wh_session_connection_accumulating_fact as session_fact,
wh_user_dimension as user_dim
where session_fact.session_id = 's1____walter'
and user_dim.user_id = 'u_____walter';
-- insert session without full name or email
insert into session
@@ -56,29 +77,29 @@ begin;
values
('s1____warren', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____warren';
select is(user_name, 'Warren') from wh_user_dimension where user_id = 'u_____warren';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_name, 'Warren') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_description, 'LDAP Auth New Session') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_id, 'ala___warren') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_type, 'ldap auth account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_name, 'warren account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_description, 'Warren LDAP Account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_external_id, 'warren') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_full_name, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_email, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_id, 'ala___warren') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_type, 'ldap auth account') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_name, 'warren account') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_description, 'Warren LDAP Account') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_external_id, 'warren') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_full_name, 'None') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_account_email, 'None') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_id, 'alm___widget') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_type, 'ldap auth method') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_name, 'Widget LDAP') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_id, 'alm___widget') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_type, 'ldap auth method') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_name, 'Widget LDAP') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____warren';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____warren' and auth_method_id = 'alm___widget' and user_description = 'LDAP Auth New Session';
select * from finish();
rollback;
@@ -8,8 +8,16 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimension from auth tokens
select is(count(*), 2::bigint)
from wh_user_dimension
where user_id in ('u_____walter', 'u_____warren')
and auth_method_id = 'aom___widget';
-- update walter and warren so the user dimension is changed when the session is inserted
update iam_user
set description = 'OIDC Auth New Session'
where public_id in ('u_____walter', 'u_____warren');
-- insert first session, should result in a new user dimension
insert into session
@@ -21,30 +29,30 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_description, 'OIDC Auth New Session') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_id, 'aoa___walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_type, 'oidc auth account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_name, 'walter account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_description, 'Walter OIDC Account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_external_id, 'sub___walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_full_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_email, 'walter@widget.test') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_id, 'aoa___walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_type, 'oidc auth account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_name, 'walter account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_description, 'Walter OIDC Account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_external_id, 'sub___walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_full_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_account_email, 'walter@widget.test') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_method_id, 'aom___widget') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_type, 'oidc auth method') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_name, 'Widget OIDC') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_external_id, 'https://oidc.widget.test') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_id, 'aom___widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_method_type, 'oidc auth method') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_method_name, 'Widget OIDC') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(auth_method_external_id, 'https://oidc.widget.test') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'OIDC Auth New Session';
-- insert session without full name or email
insert into session
@@ -56,29 +64,29 @@ begin;
values
('s1____warren', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____warren';
select is(user_name, 'Warren') from wh_user_dimension where user_id = 'u_____warren';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(user_name, 'Warren') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(user_description, 'OIDC Auth New Session') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_id, 'aoa___warren') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_type, 'oidc auth account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_name, 'warren account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_description, 'Warren OIDC Account') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_external_id, 'sub___warren') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_full_name, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_email, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_account_id, 'aoa___warren') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_type, 'oidc auth account') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_name, 'warren account') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_description, 'Warren OIDC Account') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_external_id, 'sub___warren') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_full_name, 'None') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_account_email, 'None') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_method_id, 'aom___widget') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_type, 'oidc auth method') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_name, 'Widget OIDC') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_external_id, 'https://oidc.widget.test') from wh_user_dimension where user_id = 'u_____warren';
select is(auth_method_id, 'aom___widget') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_method_type, 'oidc auth method') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_method_name, 'Widget OIDC') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(auth_method_external_id, 'https://oidc.widget.test') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____warren';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____warren';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____warren' and user_description = 'OIDC Auth New Session';
select * from finish();
rollback;
@@ -5,12 +5,20 @@
-- sessions are created using the password auth method
-- after the auth_password_account has its description change.
begin;
select plan(40);
select plan(41);
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimension from auth tokens
select is(count(*), 1::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'apm___widget';
-- update walter so the user dimension is changed when the session is inserted
update iam_user
set description = 'Passwd Change Description'
where public_id = 'u_____walter';
-- insert first session, should result in a new user dimension
insert into session
@@ -22,36 +30,42 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
-- inserting the session should result in a new user dimension.
select is(count(*), 1::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'apm___widget'
and user_description = 'Passwd Change Description';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_description, 'Passwd Change Description') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description';
-- change auth description
update auth_password_account set
description = 'Walter Password Account'
where
public_id = 'apa___walter';
update auth_password_account
set description = 'Walter Password Account'
where public_id = 'apa___walter';
-- another session with:
-- * same user
@@ -67,29 +81,33 @@ begin;
values
('s2____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 2::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 2::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'apm___widget'
and user_description = 'Passwd Change Description';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(user_description, 'Passwd Change Description') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_description, 'Walter Password Account') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_description, 'Walter Password Account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and current_row_indicator = 'Current';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Change Description' and current_row_indicator = 'Current';
select * from finish();
rollback;
@@ -4,12 +4,20 @@
-- password_auth_new_session tests the wh_user_dimesion when
-- a new session is created using the password auth method.
begin;
select plan(21);
select plan(22);
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimensions from auth tokens
select is(count(*), 1::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'apm___widget';
-- update walter so the user dimension is changed when the session is inserted
update iam_user
set description = 'Passwd Auth New Session'
where public_id = 'u_____walter';
-- insert first session, should result in a new user dimension
insert into session
@@ -21,30 +29,37 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter';
select is(user_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
-- inserting the session should result in a new user dimension.
select is(count(*), 1::bigint)
from wh_user_dimension
where user_id = 'u_____walter'
and auth_method_id = 'apm___widget'
and user_description = 'Passwd Auth New Session';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_name, 'Walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_description, 'Passwd Auth New Session') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_account_id, 'apa___walter') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_type, 'password auth account') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_name, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_full_name, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_account_email, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter';
select is(auth_method_id, 'apm___widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_method_type, 'password auth method') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_method_name, 'Widget Auth Password') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_method_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(auth_method_external_id, 'Not Applicable') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter';
select is(user_organization_id, 'o_____widget') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_organization_name, 'Widget Inc') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(user_organization_description, 'None') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select is(current_row_indicator, 'Current') from wh_user_dimension where user_id = 'u_____walter' and user_description = 'Passwd Auth New Session';
select * from finish();
rollback;
@@ -8,8 +8,8 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimensions from auth tokens
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- insert first session, should result in a new user dimension
insert into session
@@ -21,7 +21,7 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- another session with:
-- * same user
@@ -37,7 +37,7 @@ begin;
values
('s2____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- another session with:
-- * same user
@@ -53,7 +53,7 @@ begin;
values
('s3____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select * from finish();
rollback;
@@ -9,8 +9,8 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimensions from auth tokens
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- insert first session, should result in a new user dimension
insert into session
@@ -22,7 +22,7 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- another session with:
-- * same user
@@ -38,7 +38,7 @@ begin;
values
('s4____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 2::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 8::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____walter' and auth_account_id = 'apa1__walter';
select is(user_id, 'u_____walter') from wh_user_dimension where user_id = 'u_____walter' and auth_account_id = 'apa1__walter';
@@ -8,8 +8,10 @@ begin;
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
-- existing dimension via auth tokens
select is(count(*), 4::bigint)
from wh_user_dimension
where user_id = 'u_____walter';
-- insert first session, should result in a new user dimension
insert into session
@@ -21,7 +23,9 @@ begin;
values
('s1____walter', 's___1wb-sths', 'h_____wb__01');
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 4::bigint)
from wh_user_dimension
where user_id = 'u_____walter';
-- update session, should not impact wh_user_dimension
update session set
@@ -29,7 +33,9 @@ begin;
where
public_id = 's1____walter';
select is(count(*), 1::bigint) from wh_user_dimension where user_organization_id = 'o_____widget';
select is(count(*), 4::bigint)
from wh_user_dimension
where user_id = 'u_____walter';
select * from finish();
rollback;