diff --git a/internal/db/sqltest/initdb.d/01_colors_persona.sql b/internal/db/sqltest/initdb.d/01_colors_persona.sql index 2f87d5af1..1b2359616 100644 --- a/internal/db/sqltest/initdb.d/01_colors_persona.sql +++ b/internal/db/sqltest/initdb.d/01_colors_persona.sql @@ -1,32 +1,65 @@ -- Copyright (c) HashiCorp, Inc. -- SPDX-License-Identifier: MPL-2.0 +-- There is a theme to the data in this file. +-- There is an Organization called Colors R Us. +-- Colors R Us has a project for each of their color mills: the Blue Color Mill, +-- the Red Color Mill, and the Green Color Mill. +-- Public IDs are all created to make it easy to understand what the resource is +-- and what resource owns that resource. + +-- The sql insert statements are arranged to facilitate copying and pasting +-- which makes additions easier. Please take the time to understand the +-- patterns and follow them whenever possible. + +-- When adding items to this file, please follow these guidelines: +-- For new IDs: +-- * make them exactly 12 characters long +-- * use a prefix of 1-3 character to indicate the table +-- * the characters 5-12 are the id: +-- - for resources, the ending characters indicate either blue, red, or green +-- and a number if more than one is needed +-- - for users, sessions, or session recordings indicate the user and plus a +-- number if more than one is needed +-- * add _ characters between the prefix and the id to get to an ID size of 12 +-- +-- Using IDs of 12 characters allows alignment of insert values and makes +-- spotting issues easier. It also makes copying and pasting easier. +-- +-- In general, the order of the columns for insert statements should be +-- For insert statements, try to order your columns so that repeating values are +-- first, followed by the new unique id (public_id or private_id), and then +-- optional or non-standard columns. + begin; -- Add organizations insert into iam_scope - (parent_id, type, public_id, name) + (parent_id, type, public_id, name) values - ('global', 'org', 'o_____colors', 'Colors R Us'); + ('global', 'org', 'o_____colors', 'Colors R Us'); -- Add projects to the organizations insert into iam_scope - (parent_id, type, public_id, name) + (parent_id, type, public_id, name) values ('o_____colors', 'project', 'p____bcolors', 'Blue Color Mill'), ('o_____colors', 'project', 'p____rcolors', 'Red Color Mill'), ('o_____colors', 'project', 'p____gcolors', 'Green Color Mill'); - -- Add global users + -- Global user names start with a G to indicate global. + -- Nancy is a special case. N stands for none, not assigned, etc. + -- Nancy has no permissions. insert into iam_user - (scope_id, public_id, name) + (scope_id, public_id, name) values ('global', 'u_______gary', 'Gary'), ('global', 'u_______gina', 'Gina'), ('global', 'u______nancy', 'Nancy'); - -- Add organization users + -- User's in the Colors organization have names that start with C to indicate + -- Colors. insert into iam_user - (scope_id, public_id, name) + (scope_id, public_id, name) values ('o_____colors', 'u______clare', 'Clare'), ('o_____colors', 'u______cindy', 'Cindy'), @@ -34,29 +67,28 @@ begin; ('o_____colors', 'u______ciara', 'Ciara'), ('o_____colors', 'u_______cora', 'Cora'); - -- Add keys insert into kms_root_key - (private_id, scope_id) + (scope_id, private_id) values - ('krk_______colors', 'o_____colors'); + ('o_____colors', 'krk___colors'); insert into kms_root_key_version - (private_id, root_key_id, key) + (root_key_id, private_id, key) values - ('krkv_______colors', 'krk_______colors', '_______color1'::bytea); + ('krk___colors', 'krkv__colors', '_______color1'::bytea); insert into kms_data_key - (private_id, root_key_id, purpose) + (root_key_id, private_id, purpose) values - ('kdk_______colors', 'krk_______colors', 'database'); + ('krk___colors', 'kdk___colors', 'database'); insert into kms_data_key_version - (private_id, data_key_id, root_key_version_id, key) + (root_key_version_id, data_key_id, private_id, key) values - ('kdkv__colors', 'kdk_______colors', 'krkv_______colors', '_______color2'::bytea); + ('krkv__colors', 'kdk___colors', 'kdkv__colors', '_______color2'::bytea); insert into iam_group - (scope_id, public_id, name) + (scope_id, public_id, name) values ('global', 'g___gg-group', 'Global Group'), ('o_____colors', 'g___oc-group', 'Colors R Us Group'), @@ -65,7 +97,7 @@ begin; ('p____gcolors', 'g___cg-group', 'Green Color Group'); insert into iam_group_member_user - (group_id, member_id) + (group_id, member_id) values ('g___gg-group', 'u_______gary'), ('g___oc-group', 'u______clare'), @@ -74,7 +106,7 @@ begin; ('g___cg-group', 'u_______cora'); insert into iam_role - (scope_id, grant_scope_id, public_id, name) + (scope_id, grant_scope_id, public_id, name) values ('p____bcolors', 'p____bcolors', 'r_pp_bc__mix', 'Color Mixer'), ('p____rcolors', 'p____rcolors', 'r_pp_rc__mix', 'Color Mixer'), @@ -89,7 +121,7 @@ begin; ('global', 'global', 'r_gg____shop', 'Shopper'); insert into iam_role_grant - (role_id, canonical_grant, raw_grant) + (role_id, canonical_grant, raw_grant) values ('r_gg_____buy', 'type=*;action=purchase', 'purchase anything'), ('r_gg____shop', 'type=*;action=view', 'view anything'), @@ -104,7 +136,7 @@ begin; ('r_pp_gc__mix', 'type=color;action=mix', 'mix color'); insert into iam_group_role - (role_id, principal_id) + (role_id, principal_id) values ('r_op_rc__art', 'g___oc-group'), -- color ('r_pp_bc__mix', 'g___cb-group'), -- color @@ -112,7 +144,7 @@ begin; ('r_pp_gc__mix', 'g___cg-group'); -- color insert into iam_user_role - (role_id, principal_id) + (role_id, principal_id) values ('r_go____name', 'u_______gary'), ('r_gp____spec', 'u_______gina'), @@ -122,17 +154,16 @@ begin; insert into auth_password_conf (password_method_id, private_id) values - ('apm___colors', 'apmc__colors'); - + ('apm___colors', 'apmc__colors'); -- Add password auth method to organizations insert into auth_password_method - (scope_id, public_id, password_conf_id, name) + (scope_id, public_id, password_conf_id, name) values - ('o_____colors', 'apm___colors', 'apmc__colors', 'Colors Auth Password'); + ('o_____colors', 'apm___colors', 'apmc__colors', 'Colors Auth Password'); insert into auth_password_account - (auth_method_id, public_id, login_name) + (auth_method_id, public_id, login_name) values ('apm___colors', 'apa____clare', 'clare'), ('apm___colors', 'apa____cindy', 'cindy'), @@ -147,129 +178,129 @@ begin; update auth_account set iam_user_id = 'u______ciara' where public_id = 'apa____ciara'; insert into static_host_catalog - (project_id, public_id, name) + (project_id, public_id, name) values - ('p____bcolors', 'c___cb-sthcl', 'Blue Color Static Catalog'), - ('p____rcolors', 'c___cr-sthcl', 'Red Color Static Catalog'), - ('p____gcolors', 'c___cg-sthcl', 'Green Color Static Catalog'); + ('p____bcolors', 'hc__st_____b', 'Blue Color Static Catalog'), + ('p____rcolors', 'hc__st_____r', 'Red Color Static Catalog'), + ('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) 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), + ('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); insert into static_host - (catalog_id, public_id, address) + (catalog_id, public_id, address) values - ('c___cb-sthcl', 'h_____cb__01', '1.blue.color'), - ('c___cb-sthcl', 'h_____cb__02', '2.blue.color'), - ('c___cb-sthcl', 'h_____cb__03', '3.blue.color'), - ('c___cb-sthcl', 'h_____cb__04', '4.blue.color'), - ('c___cb-sthcl', 'h_____cb__05', '5.blue.color'), - ('c___cb-sthcl', 'h_____cb__06', '6.blue.color'), - ('c___cb-sthcl', 'h_____cb__07', '7.blue.color'), - ('c___cb-sthcl', 'h_____cb__08', '8.blue.color'), - ('c___cb-sthcl', 'h_____cb__09', '9.blue.color'), + ('hc__st_____b', 'h___st____b1', '1.blue.color'), + ('hc__st_____b', 'h___st____b2', '2.blue.color'), + ('hc__st_____b', 'h___st____b3', '3.blue.color'), + ('hc__st_____b', 'h___st____b4', '4.blue.color'), + ('hc__st_____b', 'h___st____b5', '5.blue.color'), + ('hc__st_____b', 'h___st____b6', '6.blue.color'), + ('hc__st_____b', 'h___st____b7', '7.blue.color'), + ('hc__st_____b', 'h___st____b8', '8.blue.color'), + ('hc__st_____b', 'h___st____b9', '9.blue.color'), - ('c___cr-sthcl', 'h_____cr__01', '1.red.color'), - ('c___cr-sthcl', 'h_____cr__02', '2.red.color'), - ('c___cr-sthcl', 'h_____cr__03', '3.red.color'), - ('c___cr-sthcl', 'h_____cr__04', '4.red.color'), - ('c___cr-sthcl', 'h_____cr__05', '5.red.color'), - ('c___cr-sthcl', 'h_____cr__06', '6.red.color'), - ('c___cr-sthcl', 'h_____cr__07', '7.red.color'), - ('c___cr-sthcl', 'h_____cr__08', '8.red.color'), - ('c___cr-sthcl', 'h_____cr__09', '9.red.color'), + ('hc__st_____r', 'h___st____r1', '1.red.color'), + ('hc__st_____r', 'h___st____r2', '2.red.color'), + ('hc__st_____r', 'h___st____r3', '3.red.color'), + ('hc__st_____r', 'h___st____r4', '4.red.color'), + ('hc__st_____r', 'h___st____r5', '5.red.color'), + ('hc__st_____r', 'h___st____r6', '6.red.color'), + ('hc__st_____r', 'h___st____r7', '7.red.color'), + ('hc__st_____r', 'h___st____r8', '8.red.color'), + ('hc__st_____r', 'h___st____r9', '9.red.color'), - ('c___cg-sthcl', 'h_____cg__01', '1.green.color'), - ('c___cg-sthcl', 'h_____cg__02', '2.green.color'), - ('c___cg-sthcl', 'h_____cg__03', '3.green.color'), - ('c___cg-sthcl', 'h_____cg__04', '4.green.color'), - ('c___cg-sthcl', 'h_____cg__05', '5.green.color'), - ('c___cg-sthcl', 'h_____cg__06', '6.green.color'), - ('c___cg-sthcl', 'h_____cg__07', '7.green.color'), - ('c___cg-sthcl', 'h_____cg__08', '8.green.color'), - ('c___cg-sthcl', 'h_____cg__09', '9.green.color'); + ('hc__st_____g', 'h___st____g1', '1.green.color'), + ('hc__st_____g', 'h___st____g2', '2.green.color'), + ('hc__st_____g', 'h___st____g3', '3.green.color'), + ('hc__st_____g', 'h___st____g4', '4.green.color'), + ('hc__st_____g', 'h___st____g5', '5.green.color'), + ('hc__st_____g', 'h___st____g6', '6.green.color'), + ('hc__st_____g', 'h___st____g7', '7.green.color'), + ('hc__st_____g', 'h___st____g8', '8.green.color'), + ('hc__st_____g', 'h___st____g9', '9.green.color'); insert into host_dns_name - (host_id, name) + (host_id, name) values -- note there are no dns names for blue 1 - ('h_____cb__02', '2.blue.color'), - ('h_____cb__03', '3.blue.color'), - ('h_____cb__04', '4.blue.color'), - ('h_____cb__05', '5.blue.color'), - ('h_____cb__06', '6.blue.color'), - ('h_____cb__07', '7.blue.color'), - ('h_____cb__08', '8.blue.color'), - ('h_____cb__09', '9.blue.color'), + ('h___st____b2', '2.blue.color'), + ('h___st____b3', '3.blue.color'), + ('h___st____b4', '4.blue.color'), + ('h___st____b5', '5.blue.color'), + ('h___st____b6', '6.blue.color'), + ('h___st____b7', '7.blue.color'), + ('h___st____b8', '8.blue.color'), + ('h___st____b9', '9.blue.color'), - ('h_____cr__02', '1.red.color'), - ('h_____cr__02', '2.red.color'), - ('h_____cr__03', '3.red.color'), - ('h_____cr__04', '4.red.color'), - ('h_____cr__05', '5.red.color'), - ('h_____cr__06', '6.red.color'), - ('h_____cr__07', '7.red.color'), - ('h_____cr__08', '8.red.color'), - ('h_____cr__09', '9.red.color'), + ('h___st____r2', '1.red.color'), + ('h___st____r2', '2.red.color'), + ('h___st____r3', '3.red.color'), + ('h___st____r4', '4.red.color'), + ('h___st____r5', '5.red.color'), + ('h___st____r6', '6.red.color'), + ('h___st____r7', '7.red.color'), + ('h___st____r8', '8.red.color'), + ('h___st____r9', '9.red.color'), - ('h_____cg__01', '1.green.color'), - ('h_____cg__02', '2.green.color'), - ('h_____cg__03', '3.green.color'), - ('h_____cg__04', '4.green.color'), - ('h_____cg__05', '5.green.color'), - ('h_____cg__06', '6.green.color'), - ('h_____cg__07', '7.green.color'), - ('h_____cg__08', '8.green.color'), - ('h_____cg__09', '9.green.color'); + ('h___st____g1', '1.green.color'), + ('h___st____g2', '2.green.color'), + ('h___st____g3', '3.green.color'), + ('h___st____g4', '4.green.color'), + ('h___st____g5', '5.green.color'), + ('h___st____g6', '6.green.color'), + ('h___st____g7', '7.green.color'), + ('h___st____g8', '8.green.color'), + ('h___st____g9', '9.green.color'); insert into host_ip_address - (host_id, address) + (host_id, address) values -- note there are no address for blue 1 - ('h_____cb__02', '10.0.0.2'), - ('h_____cb__03', 'fe80::3333:3333:3333:3333'), - ('h_____cb__04', '10.0.0.4'), - ('h_____cb__05', 'fe80::5555:5555:5555:5555'), - ('h_____cb__06', '10.0.0.6'), - ('h_____cb__07', 'fe80::7777:7777:7777:7777'), - ('h_____cb__08', '10.0.0.8'), - ('h_____cb__09', 'fe80::9999:9999:9999:9999'), + ('h___st____b2', '10.0.0.2'), + ('h___st____b3', 'fe80::3333:3333:3333:3333'), + ('h___st____b4', '10.0.0.4'), + ('h___st____b5', 'fe80::5555:5555:5555:5555'), + ('h___st____b6', '10.0.0.6'), + ('h___st____b7', 'fe80::7777:7777:7777:7777'), + ('h___st____b8', '10.0.0.8'), + ('h___st____b9', 'fe80::9999:9999:9999:9999'), - ('h_____cr__01', '11.11.11.11'), - ('h_____cr__02', '2001:4860:4860::2222'), - ('h_____cr__03', '33.33.33.33'), - ('h_____cr__04', '2001:4860:4860::4444'), - ('h_____cr__05', '55.55.55.55'), - ('h_____cr__06', '2001:4860:4860::6666'), - ('h_____cr__07', '77.77.77.77'), - ('h_____cr__08', '2001:4860:4860::8888'), - ('h_____cr__09', '99.99.99.99'), + ('h___st____r1', '11.11.11.11'), + ('h___st____r2', '2001:4860:4860::2222'), + ('h___st____r3', '33.33.33.33'), + ('h___st____r4', '2001:4860:4860::4444'), + ('h___st____r5', '55.55.55.55'), + ('h___st____r6', '2001:4860:4860::6666'), + ('h___st____r7', '77.77.77.77'), + ('h___st____r8', '2001:4860:4860::8888'), + ('h___st____r9', '99.99.99.99'), - ('h_____cg__01', '111.111.111.111'), - ('h_____cg__02', '3001:5860:5860::3333'), - ('h_____cg__03', '112.112.112.112'), - ('h_____cg__04', '3001:5860:5860::5555'), - ('h_____cg__05', '113.113.113.113'), - ('h_____cg__06', '3001:5860:5860::7777'), - ('h_____cg__07', '114.114.114.114'), - ('h_____cg__08', '3001:5860:5860::9999'), - ('h_____cg__09', '115.115.115.115'); + ('h___st____g1', '111.111.111.111'), + ('h___st____g2', '3001:5860:5860::3333'), + ('h___st____g3', '112.112.112.112'), + ('h___st____g4', '3001:5860:5860::5555'), + ('h___st____g5', '113.113.113.113'), + ('h___st____g6', '3001:5860:5860::7777'), + ('h___st____g7', '114.114.114.114'), + ('h___st____g8', '3001:5860:5860::9999'), + ('h___st____g9', '115.115.115.115'); insert into static_host_set - (catalog_id, public_id, name) + (catalog_id, public_id, name) values - ('c___cb-sthcl', 's___1cb-sths', 'Blue Color Static Set 1'), - ('c___cb-sthcl', 's___2cb-sths', 'Blue Color Static Set 2'), - ('c___cr-sthcl', 's___1cr-sths', 'Red Color Static Set 1'), - ('c___cr-sthcl', 's___2cr-sths', 'Red Color Static Set 2'), - ('c___cg-sthcl', 's___1cg-sths', 'Green Color Static Set 1'), - ('c___cg-sthcl', 's___2cg-sths', 'Green Color Static Set 2'); + ('hc__st_____b', 'hs__st____b1', 'Blue Color Static Set 1'), + ('hc__st_____b', 'hs__st____b2', 'Blue Color Static Set 2'), + ('hc__st_____r', 'hs__st____r1', 'Red Color Static Set 1'), + ('hc__st_____r', 'hs__st____r2', 'Red Color Static Set 2'), + ('hc__st_____g', 'hs__st____g1', 'Green Color Static Set 1'), + ('hc__st_____g', 'hs__st____g2', 'Green Color Static Set 2'); insert into static_host_set_member @@ -280,62 +311,62 @@ begin; where h.catalog_id = s.catalog_id; insert into plugin - (scope_id, public_id, name) + (scope_id, public_id, name) values - ('global', 'plg_____chost', 'Colors Host Plugin'); + ('global', 'plg____chost', 'Colors Host Plugin'); insert into plugin_host_supported (public_id) values - ('plg_____chost'); + ('plg____chost'); insert into host_plugin_catalog - (project_id, plugin_id, public_id, name, attributes) + (project_id, plugin_id, public_id, name, attributes) values - ('p____bcolors', 'plg_____chost', 'c___cb-plghcl', 'Blue Color Plugin Catalog', ''), - ('p____rcolors', 'plg_____chost', 'c___cr-plghcl', 'Red Color Plugin Catalog', ''); + ('p____bcolors', 'plg____chost', 'hc__plg____b', 'Blue Color Plugin Catalog', ''), + ('p____rcolors', 'plg____chost', 'hc__plg____r', 'Red Color Plugin Catalog', ''); insert into host_plugin_host - (catalog_id, public_id, external_id) + (catalog_id, public_id, external_id) values - ('c___cb-plghcl', 'h_____cb__01-plgh', '1 blue color'), - ('c___cb-plghcl', 'h_____cb__02-plgh', '2 blue color'), - ('c___cb-plghcl', 'h_____cb__03-plgh', '3 blue color'), + ('hc__plg____b', 'h___plg___b1', '1 blue color'), + ('hc__plg____b', 'h___plg___b2', '2 blue color'), + ('hc__plg____b', 'h___plg___b3', '3 blue color'), - ('c___cr-plghcl', 'h_____cr__01-plgh', '1 red color'), - ('c___cr-plghcl', 'h_____cr__02-plgh', '2 red color'), - ('c___cr-plghcl', 'h_____cr__03-plgh', '3 red color'); + ('hc__plg____r', 'h___plg___r1', '1 red color'), + ('hc__plg____r', 'h___plg___r2', '2 red color'), + ('hc__plg____r', 'h___plg___r3', '3 red color'); insert into host_dns_name - (host_id, name) + (host_id, name) values - ('h_____cb__01-plgh', '1.blue.color'), - ('h_____cb__02-plgh', '2.blue.color'), - ('h_____cb__03-plgh', '3.blue.color'), + ('h___plg___b1', '1.blue.color'), + ('h___plg___b2', '2.blue.color'), + ('h___plg___b3', '3.blue.color'), - ('h_____cr__01-plgh', '1.red.color'), - ('h_____cr__02-plgh', '2.red.color'), - ('h_____cr__03-plgh', '3.red.color'); + ('h___plg___r1', '1.red.color'), + ('h___plg___r2', '2.red.color'), + ('h___plg___r3', '3.red.color'); insert into host_ip_address - (host_id, address) + (host_id, address) values - ('h_____cb__01-plgh', '1.1.1.1'), - ('h_____cb__02-plgh', 'fe80::2222:2222:2222:2222'), + ('h___plg___b1', '1.1.1.1'), + ('h___plg___b2', 'fe80::2222:2222:2222:2222'), -- host 3 only has a dns name so the set of addresses are the same -- between the static and plugin based host - ('h_____cr__01-plgh', '11.11.11.11'), - ('h_____cr__02-plgh', '2001:4860:4860::2222'), - ('h_____cr__03-plgh', '33.33.33.33'); + ('h___plg___r1', '11.11.11.11'), + ('h___plg___r2', '2001:4860:4860::2222'), + ('h___plg___r3', '33.33.33.33'); insert into host_plugin_set - (catalog_id, public_id, name, attributes, need_sync) + (catalog_id, public_id, name, attributes, need_sync) values - ('c___cb-plghcl', 's___1cb-plghs', 'Blue Color Plugin Set 1', '', false), - ('c___cb-plghcl', 's___2cb-plghs', 'Blue Color Plugin Set 2', '', false), - ('c___cr-plghcl', 's___1cr-plghs', 'Red Color Plugin Set 1', '', false), - ('c___cr-plghcl', 's___2cr-plghs', 'Red Color Plugin Set 2', '', false); + ('hc__plg____b', 'hs__plg___b1', 'Blue Color Plugin Set 1', '', false), + ('hc__plg____b', 'hs__plg___b2', 'Blue Color Plugin Set 2', '', false), + ('hc__plg____r', 'hs__plg___r1', 'Red Color Plugin Set 1', '', false), + ('hc__plg____r', 'hs__plg___r2', 'Red Color Plugin Set 2', '', false); insert into host_plugin_set_member @@ -347,20 +378,20 @@ begin; and h.external_id like '%color'; insert into plugin - (scope_id, public_id, name) + (scope_id, public_id, name) values - ('global', 'plg____sb-plg', 'Storage Bucket Plugin'); + ('global', 'pl__plg___sb', 'Storage Bucket Plugin'); insert into plugin_storage_supported (public_id) values - ('plg____sb-plg'); + ('pl__plg___sb'); insert into storage_plugin_storage_bucket - (plugin_id, scope_id, public_id, bucket_name, worker_filter, secrets_hmac) + (plugin_id, scope_id, public_id, bucket_name, worker_filter, secrets_hmac) values - ('plg____sb-plg', 'global', 'sb____global', 'Global Storage Bucket', 'test worker filter', '\xdeadbeef'), - ('plg____sb-plg', 'o_____colors', 'sb____colors', 'Colors Storage Bucket', 'test worker filter', '\xdeadbeef'); + ('pl__plg___sb', 'global', 'sb____global', 'Global Storage Bucket', 'test worker filter', '\xdeadbeef'), + ('pl__plg___sb', 'o_____colors', 'sb____colors', 'Colors Storage Bucket', 'test worker filter', '\xdeadbeef'); insert into target_tcp (project_id, public_id, name) @@ -379,15 +410,15 @@ begin; insert into target_host_set (project_id, target_id, host_set_id) values - ('p____bcolors', 't_________cb', 's___1cb-sths'), - ('p____bcolors', 't_________cb', 's___2cb-sths'), - ('p____rcolors', 't_________cr', 's___1cr-sths'), - ('p____rcolors', 't_________cr', 's___2cr-sths'), - ('p____bcolors', 'tssh______cb', 's___1cb-sths'), - ('p____bcolors', 'tssh______cb', 's___2cb-sths'), - ('p____bcolors', 'tssh______cb', 's___1cb-plghs'), - ('p____rcolors', 'tssh______cr', 's___1cr-sths'), - ('p____rcolors', 'tssh______cr', 's___2cr-sths'); + ('p____bcolors', 't_________cb', 'hs__st____b1'), + ('p____bcolors', 't_________cb', 'hs__st____b2'), + ('p____rcolors', 't_________cr', 'hs__st____r1'), + ('p____rcolors', 't_________cr', 'hs__st____r2'), + ('p____bcolors', 'tssh______cb', 'hs__st____b1'), + ('p____bcolors', 'tssh______cb', 'hs__st____b2'), + ('p____bcolors', 'tssh______cb', 'hs__plg___b1'), + ('p____rcolors', 'tssh______cr', 'hs__st____r1'), + ('p____rcolors', 'tssh______cr', 'hs__st____r2'); insert into target_address (target_id, address) @@ -396,16 +427,18 @@ begin; ('tssh______cg', '8.8.8.8'); insert into credential_vault_store - (project_id, public_id, name, description, vault_address, namespace) + (project_id, public_id, name, description, vault_address, namespace) values - ('p____bcolors', 'vs_______cvs1', 'color vault store 1', 'None', 'https://vault.color', 'blue'), - ('p____bcolors', 'vs_______cvs2', 'color vault store 2', 'Some', 'https://vault.color', 'blue'), - ('p____bcolors', 'vs_______cvs3', 'color vault store 3', 'Maybe', 'https://vault.color', 'blue'); + ('p____bcolors', 'cvs__bcolors', 'blue vault store', 'None', 'https://blue.vault.color', 'blue'), + ('p____rcolors', 'cvs__rcolors', 'red vault store', 'Some', 'https://red.vault.color', 'red'), + ('p____gcolors', 'cvs__gcolors', 'green vault store', 'Maybe', 'https://green.vault.color', 'green'); insert into credential_vault_library - (store_id, public_id, name, description, vault_path, http_method) + (store_id, public_id, name, description, vault_path, http_method) values - ('vs_______cvs1', 'vl______cvl', 'color vault library', 'None', '/secrets', 'GET'); + ('cvs__bcolors', 'cvl_______b1', 'blue vault library', 'None', '/secrets', 'GET'), + ('cvs__rcolors', 'cvl_______r1', 'red vault library', 'None', '/secrets', 'GET'), + ('cvs__gcolors', 'cvl_______g1', 'green vault library', 'None', '/secrets', 'GET'); insert into credential_static_store (project_id, public_id, name, description) @@ -447,8 +480,8 @@ begin; insert into target_credential_library (project_id, target_id, credential_library_id, credential_purpose) values - ('p____bcolors', 't_________cb', 'vl______cvl', 'brokered'), - ('p____bcolors', 'tssh______cb', 'vl______cvl', 'brokered'); + ('p____bcolors', 't_________cb', 'cvl_______b1', 'brokered'), + ('p____bcolors', 'tssh______cb', 'cvl_______b1', 'brokered'); insert into session (project_id, target_id, public_id, user_id, auth_token_id, certificate, endpoint) @@ -481,12 +514,12 @@ begin; insert into session_host_set_host (session_id, host_set_id, host_id) values - ('s1_____clare', 's___1cb-sths', 'h_____cb__01'), - ('s2_____clare', 's___1cb-sths', 'h_____cb__01'), - ('s1_____cindy', 's___1cb-sths', 'h_____cb__01'), - ('s1_____ciara', 's___1cb-sths', 'h_____cb__01'), - ('s1_____carly', 's___1cb-sths', 'h_____cb__01'), - ('s2_____carly', 's___1cb-plghs', 'h_____cb__01-plgh'); + ('s1_____clare', 'hs__st____b1', 'h___st____b1'), + ('s2_____clare', 'hs__st____b1', 'h___st____b1'), + ('s1_____cindy', 'hs__st____b1', 'h___st____b1'), + ('s1_____ciara', 'hs__st____b1', 'h___st____b1'), + ('s1_____carly', 'hs__st____b1', 'h___st____b1'), + ('s2_____carly', 'hs__plg___b1', 'h___plg___b1'); insert into session_target_address (session_id, target_id) @@ -497,8 +530,8 @@ begin; insert into session_connection (session_id, public_id) values - ('s1_____clare', 'sc1_____clare'), - ('s2_____clare', 'sc2_____clare'); + ('s1_____clare', 's1c1___clare'), + ('s2_____clare', 's2c1___clare'); insert into recording_session (session_id, storage_bucket_id, public_id) diff --git a/internal/db/sqltest/tests/credential/vault/credential_vault_store.sql b/internal/db/sqltest/tests/credential/vault/credential_vault_store.sql index 150dadf44..def449db1 100644 --- a/internal/db/sqltest/tests/credential/vault/credential_vault_store.sql +++ b/internal/db/sqltest/tests/credential/vault/credential_vault_store.sql @@ -9,12 +9,12 @@ begin; select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'credentials'); -- validate the setup data - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs1'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__bcolors'; prepare soft_delete_credential_vault_store as update credential_vault_store set delete_time = clock_timestamp() -- Can't use now() or current_timestamp since constant within transaction - where public_id = 'vs_______cvs1'; + where public_id = 'cvs__bcolors'; -- First delete succeeds select lives_ok('soft_delete_credential_vault_store'); diff --git a/internal/db/sqltest/tests/credential/vault/credential_vault_store_client.sql b/internal/db/sqltest/tests/credential/vault/credential_vault_store_client.sql index a7d2c4102..eac1afdb6 100644 --- a/internal/db/sqltest/tests/credential/vault/credential_vault_store_client.sql +++ b/internal/db/sqltest/tests/credential/vault/credential_vault_store_client.sql @@ -10,35 +10,35 @@ begin; -- validate the setup data select has_view('credential_vault_store_client', 'view for client Vault stores does not exist'); - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs1'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs2'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs3'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__bcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__rcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__gcolors'; -- create test vault tokens insert into credential_vault_token - (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) + (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) values - ('cvs_token2', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token1', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), - ('cvs_token5', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), - ('cvs_token4', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token3', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token8', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token7', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token6', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); + ('cvs_token2', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token1', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), + ('cvs_token5', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), + ('cvs_token4', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token3', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token8', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token7', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token6', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); prepare select_stores as select public_id::text, token_hmac, token_status::text from credential_vault_store_client - where public_id in ('vs_______cvs1', 'vs_______cvs2', 'vs_______cvs3') + where public_id in ('cvs__bcolors', 'cvs__rcolors', 'cvs__gcolors') order by public_id, token_hmac; select results_eq( 'select_stores', $$VALUES - ('vs_______cvs1', 'cvs_token1'::bytea, 'current'), - ('vs_______cvs2', null, 'expired'), - ('vs_______cvs3', null, 'expired')$$ + ('cvs__bcolors', 'cvs_token1'::bytea, 'current'), + ('cvs__gcolors', null, 'expired'), + ('cvs__rcolors', null, 'expired')$$ ); select * from finish(); diff --git a/internal/db/sqltest/tests/credential/vault/credential_vault_store_list_lookup.sql b/internal/db/sqltest/tests/credential/vault/credential_vault_store_list_lookup.sql index d703c1e0e..491d5022b 100644 --- a/internal/db/sqltest/tests/credential/vault/credential_vault_store_list_lookup.sql +++ b/internal/db/sqltest/tests/credential/vault/credential_vault_store_list_lookup.sql @@ -10,35 +10,35 @@ begin; -- validate the setup data select has_view('credential_vault_store_list_lookup', 'view for list and lookup Vault stores does not exist'); - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs1'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs2'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs3'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__bcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__rcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__gcolors'; -- create test vault tokens insert into credential_vault_token - (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) + (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) values - ('cvs_token2', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token1', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), - ('cvs_token5', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), - ('cvs_token4', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token3', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token8', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token7', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token6', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); + ('cvs_token2', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token1', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), + ('cvs_token5', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), + ('cvs_token4', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token3', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token8', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token7', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token6', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); prepare select_stores as select public_id::text, token_hmac, token_status::text from credential_vault_store_list_lookup - where public_id in ('vs_______cvs1', 'vs_______cvs2', 'vs_______cvs3') + where public_id in ('cvs__bcolors', 'cvs__rcolors', 'cvs__gcolors') order by public_id; select results_eq( 'select_stores', $$VALUES - ('vs_______cvs1', 'cvs_token1'::bytea, 'current'), - ('vs_______cvs2', null, 'expired'), - ('vs_______cvs3', null, 'expired')$$ + ('cvs__bcolors', 'cvs_token1'::bytea, 'current'), + ('cvs__gcolors', null, 'expired'), + ('cvs__rcolors', null, 'expired')$$ ); select * from finish(); diff --git a/internal/db/sqltest/tests/credential/vault/credential_vault_token_renewal_revocation.sql b/internal/db/sqltest/tests/credential/vault/credential_vault_token_renewal_revocation.sql index 8a0946d94..79aad3360 100644 --- a/internal/db/sqltest/tests/credential/vault/credential_vault_token_renewal_revocation.sql +++ b/internal/db/sqltest/tests/credential/vault/credential_vault_token_renewal_revocation.sql @@ -10,36 +10,36 @@ begin; -- validate the setup data select has_view('credential_vault_token_renewal_revocation', 'view for renewal/revocation Vault stores does not exist'); - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs1'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs2'; - select is(count(*), 1::bigint) from credential_vault_store where public_id = 'vs_______cvs3'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__bcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__rcolors'; + select is(count(*), 1::bigint) from credential_vault_store where public_id = 'cvs__gcolors'; -- create test vault tokens insert into credential_vault_token - (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) + (token_hmac, token, store_id, last_renewal_time, expiration_time, key_id, status) values - ('cvs_token2', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token1', 'token', 'vs_______cvs1', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), - ('cvs_token5', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), - ('cvs_token4', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), - ('cvs_token3', 'token', 'vs_______cvs2', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token8', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token7', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), - ('cvs_token6', 'token', 'vs_______cvs3', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); + ('cvs_token2', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token1', 'token', 'cvs__bcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'current'), + ('cvs_token5', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'revoke'), + ('cvs_token4', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'maintaining'), + ('cvs_token3', 'token', 'cvs__rcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token8', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token7', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'), + ('cvs_token6', 'token', 'cvs__gcolors', now(), wt_add_seconds_to_now(1), 'kdkv___widget', 'expired'); prepare select_stores as select public_id::text, token_hmac, token_status::text from credential_vault_token_renewal_revocation - where public_id in ('vs_______cvs1', 'vs_______cvs2', 'vs_______cvs3') + where public_id in ('cvs__bcolors', 'cvs__rcolors', 'cvs__gcolors') order by public_id, token_hmac; select results_eq( 'select_stores', $$VALUES - ('vs_______cvs1', 'cvs_token1'::bytea, 'current'), - ('vs_______cvs1', 'cvs_token2'::bytea, 'maintaining'), - ('vs_______cvs2', 'cvs_token4'::bytea, 'maintaining'), - ('vs_______cvs2', 'cvs_token5'::bytea, 'revoke')$$ + ('cvs__bcolors', 'cvs_token1'::bytea, 'current'), + ('cvs__bcolors', 'cvs_token2'::bytea, 'maintaining'), + ('cvs__rcolors', 'cvs_token4'::bytea, 'maintaining'), + ('cvs__rcolors', 'cvs_token5'::bytea, 'revoke')$$ ); select * from finish(); diff --git a/internal/db/sqltest/tests/recording/recording_channel_ssh_validation_functions.sql b/internal/db/sqltest/tests/recording/recording_channel_ssh_validation_functions.sql index ef8162406..8ba67846f 100644 --- a/internal/db/sqltest/tests/recording/recording_channel_ssh_validation_functions.sql +++ b/internal/db/sqltest/tests/recording/recording_channel_ssh_validation_functions.sql @@ -14,7 +14,7 @@ begin; insert into recording_connection (public_id, session_id, session_connection_id, recording_session_id) values - ('cr_123456789', 's1_____clare', 'sc1_____clare', 'sr1____clare'); + ('cr_123456789', 's1_____clare', 's1c1___clare', 'sr1____clare'); insert into recording_channel_ssh (public_id, recording_connection_id, start_time, end_time, bytes_up, bytes_down, channel_type) values diff --git a/internal/db/sqltest/tests/recording/recording_session.sql b/internal/db/sqltest/tests/recording/recording_session.sql index 61d600bc4..eae82265f 100644 --- a/internal/db/sqltest/tests/recording/recording_session.sql +++ b/internal/db/sqltest/tests/recording/recording_session.sql @@ -196,7 +196,7 @@ begin; ('sr_________1', 'sb____global', 'global', 's2_____clare', 'u______clare', 'Clare', 'o_____colors', 'org', 'tssh______cb', 'Blue Color SSH Target', 'p____bcolors', - 'c___cb-sthcl', 'h_____cb__01', null, null, + 'hc__st_____b', 'h___st____b1', null, null, null), ('sr_________2', 'sb____global', 'global', 's2______cora', 'u_______cora', 'Cora', 'o_____colors', 'org', @@ -206,8 +206,8 @@ begin; ('sr_________3', 'sb____global', 'global', 's2_____carly', 'u______carly', 'Carly', 'o_____colors', 'org', 'tssh______cb', 'Blue Color SSH Target', 'p____bcolors', - null, null, 'c___cb-plghcl', 'h_____cb__01-plgh', - 'plg_____chost')$$ + null, null, 'hc__plg____b', 'h___plg___b1', + 'plg____chost')$$ ); -- Closing a second time should error diff --git a/internal/db/sqltest/tests/session/delete_session_host.sql b/internal/db/sqltest/tests/session/delete_session_host.sql index c3a43f951..8f127c361 100644 --- a/internal/db/sqltest/tests/session/delete_session_host.sql +++ b/internal/db/sqltest/tests/session/delete_session_host.sql @@ -11,14 +11,14 @@ begin; select is(count(*), 1::bigint) from session_state where session_id = 's1_____carly' and state='active'; -- Check that we have 5 sessions using this host - select is(count(*), 5::bigint) from session_host_set_host where host_id = 'h_____cb__01'; + select is(count(*), 5::bigint) from session_host_set_host where host_id = 'h___st____b1'; -- Delete host, expect no errors - delete from host where public_id = 'h_____cb__01'; - select is(count(*), 0::bigint) from host where public_id = 'h_____cb__01'; + delete from host where public_id = 'h___st____b1'; + select is(count(*), 0::bigint) from host where public_id = 'h___st____b1'; -- Ensure we no longer have sessions associated with this host - select is(count(*), 0::bigint) from session_host_set_host where host_id = 'h_____cb__01'; + select is(count(*), 0::bigint) from session_host_set_host where host_id = 'h___st____b1'; -- 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'; diff --git a/internal/db/sqltest/tests/session/delete_session_host_set.sql b/internal/db/sqltest/tests/session/delete_session_host_set.sql index 843446ff0..84bf96b66 100644 --- a/internal/db/sqltest/tests/session/delete_session_host_set.sql +++ b/internal/db/sqltest/tests/session/delete_session_host_set.sql @@ -11,14 +11,14 @@ begin; select is(count(*), 1::bigint) from session_state where session_id = 's1_____carly' and state='active'; -- Check that we have 5 sessions using this host set - select is(count(*), 5::bigint) from session_host_set_host where host_set_id = 's___1cb-sths'; + select is(count(*), 5::bigint) from session_host_set_host where host_set_id = 'hs__st____b1'; -- Delete host set, expect no errors - delete from host_set where public_id = 's___1cb-sths'; - select is(count(*), 0::bigint) from host_set where public_id = 's___1cb-sths'; + delete from host_set where public_id = 'hs__st____b1'; + select is(count(*), 0::bigint) from host_set where public_id = 'hs__st____b1'; -- Ensure we no longer have sessions associated with this host set - select is(count(*), 0::bigint) from session_host_set_host where host_set_id = 's___1cb-sths'; + select is(count(*), 0::bigint) from session_host_set_host where host_set_id = 'hs__st____b1'; -- 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'; diff --git a/internal/db/sqltest/tests/storage/valid_storage_bucket_added.sql b/internal/db/sqltest/tests/storage/valid_storage_bucket_added.sql index 112258bcf..23ea8300a 100644 --- a/internal/db/sqltest/tests/storage/valid_storage_bucket_added.sql +++ b/internal/db/sqltest/tests/storage/valid_storage_bucket_added.sql @@ -9,26 +9,26 @@ begin; -- insert global storage bucket insert into storage_plugin_storage_bucket - (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) + (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) values - ('sb_________1','global', 'plg____sb-plg', 'test bucket name', 'test worker filter', '\xdeadbeef'); + ('sb_________1', 'global', 'pl__plg___sb', 'test bucket name', 'test worker filter', '\xdeadbeef'); select is(count(*), 1::bigint) from storage_plugin_storage_bucket where public_id = 'sb_________1'; -- insert org storage bucket insert into storage_plugin_storage_bucket - (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) + (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) values - ('sb_________2','o_____colors', 'plg____sb-plg', 'test bucket name', 'test worker filter', '\xdeadbeef'); + ('sb_________2', 'o_____colors', 'pl__plg___sb', 'test bucket name', 'test worker filter', '\xdeadbeef'); select is(count(*), 1::bigint) from storage_plugin_storage_bucket where public_id = 'sb_________2'; -- Try to insert row with a project scope id prepare invalid_storage_bucket as insert into storage_plugin_storage_bucket - (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) + (public_id, scope_id, plugin_id, bucket_name, worker_filter, secrets_hmac) values - ('sb_________3','p____bcolors', 'plg____sb-plg', 'test bucket name', 'test worker filter', '\xdeadbeef'); + ('sb_________3', 'p____bcolors', 'pl__plg___sb', 'test bucket name', 'test worker filter', '\xdeadbeef'); select throws_ok('invalid_storage_bucket', null, null, 'insert invalid storage_bucket succeeded'); select * from finish(); diff --git a/internal/db/sqltest/tests/wh/session/update_state.sql b/internal/db/sqltest/tests/wh/session/update_state.sql index 64cead6a1..e7780d4e7 100644 --- a/internal/db/sqltest/tests/wh/session/update_state.sql +++ b/internal/db/sqltest/tests/wh/session/update_state.sql @@ -13,7 +13,7 @@ begin; bytes_up = 10, bytes_down = 5, closed_reason = 'closed by end-user' - where public_id = 'sc1_____clare'; + where public_id = 's1c1___clare'; update session set termination_reason = 'closed by end-user' where public_id = 's1_____clare'; diff --git a/internal/db/sqltest/tests/wh/session_connection/update.sql b/internal/db/sqltest/tests/wh/session_connection/update.sql index fdd4a92f2..379f2a82c 100644 --- a/internal/db/sqltest/tests/wh/session_connection/update.sql +++ b/internal/db/sqltest/tests/wh/session_connection/update.sql @@ -4,21 +4,21 @@ 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'; + select is(count(*), 1::bigint) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; + select is(bytes_up, null) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; + select is(bytes_down, null) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; + select is(connection_closed_time, 'infinity'::wh_timestamp) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; update session_connection set bytes_up = 10, bytes_down = 5, closed_reason = 'closed by end-user' - where public_id = 'sc1_____clare'; + where public_id = 's1c1___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 is(bytes_up, 10::wh_bytes_transmitted) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; + select is(bytes_down, 5::wh_bytes_transmitted) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; + select is(connection_closed_time, now()::wh_timestamp) from wh_session_connection_accumulating_fact where connection_id = 's1c1___clare'; select * from finish(); rollback;