Skip to content

Commit a6e9a8a

Browse files
author
ci bot
committed
Merge branch 'qa-fixes' into 'enterprise'
fix: misc qa fixes See merge request dkinternal/testgen/dataops-testgen!260
2 parents 79b1981 + c914376 commit a6e9a8a

11 files changed

Lines changed: 41 additions & 31 deletions

File tree

testgen/template/profiling/project_update_profile_results_to_estimates.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ set sample_ratio = {PROFILE_SAMPLE_RATIO},
2222
within_1yr_date_ct = ROUND(within_1yr_date_ct * {PROFILE_SAMPLE_RATIO}, 0),
2323
within_1mo_date_ct = ROUND(within_1mo_date_ct * {PROFILE_SAMPLE_RATIO}, 0),
2424
future_date_ct = ROUND(future_date_ct * {PROFILE_SAMPLE_RATIO}, 0),
25-
boolean_true_ct = ROUND(boolean_true_ct * {PROFILE_SAMPLE_RATIO}, 0),
26-
date_days_present = ROUND(date_days_present * {PROFILE_SAMPLE_RATIO}, 0)
25+
boolean_true_ct = ROUND(boolean_true_ct * {PROFILE_SAMPLE_RATIO}, 0)
2726
where profile_run_id = '{PROFILE_RUN_ID}'
2827
and schema_name = split_part('{SAMPLING_TABLE}', '.', 1)
2928
and table_name = split_part('{SAMPLING_TABLE}', '.', 2)

testgen/ui/components/frontend/js/components/connection_form.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ const ConnectionForm = (props, saveButton) => {
119119
privateKeyPhrase.val = '';
120120
}
121121

122-
const flavor = getValue(props.flavors).find(f => f.value === connectionFlavor.val);
122+
const flavor = getValue(props.flavors).find(f => f.value === connectionFlavor.rawVal);
123123
const originalURLTemplate = van.state(flavor.connection_string);
124-
const [prefixPart, sufixPart] = originalURLTemplate.val.split('@');
124+
const [prefixPart, sufixPart] = originalURLTemplate.rawVal.split('@');
125125

126126
const connectionStringPrefix = van.state(prefixPart);
127127
const connectionStringSuffix = van.state(connection?.url ?? '');
128-
if (!connectionStringSuffix.val) {
129-
connectionStringSuffix.val = formatURL(sufixPart ?? '', connectionHost.val, connectionPort.val, connectionDatabase.val);
128+
if (!connectionStringSuffix.rawVal) {
129+
connectionStringSuffix.val = formatURL(sufixPart ?? '', connectionHost.rawVal, connectionPort.rawVal, connectionDatabase.rawVal);
130130
}
131131

132132
const updatedConnection = van.derive(() => {

testgen/ui/components/frontend/js/pages/table_group_list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const TableGroupList = (props) => {
123123
div(
124124
{ class: 'flex-column fx-flex' },
125125
Caption({content: 'Uses Record Sampling', style: 'margin-bottom: 4px;'}),
126-
span(tableGroup.profile_use_sampling || '--'),
126+
span(tableGroup.profile_use_sampling ? 'Yes' : 'No'),
127127
),
128128
),
129129
div(

testgen/ui/queries/table_group_queries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def _get_select_statement(schema):
2020
profile_id_column_mask, profile_sk_column_mask,
2121
description, data_source, source_system, source_process, data_location,
2222
business_domain, stakeholder_group, transform_level, data_product,
23-
profile_use_sampling, profile_sample_percent, profile_sample_min_count,
23+
CASE WHEN profile_use_sampling = 'Y' THEN true ELSE false END AS profile_use_sampling,
24+
profile_sample_percent, profile_sample_min_count,
2425
profiling_delay_days, profile_flag_cdes
2526
FROM table_groups
2627
"""
@@ -176,7 +177,7 @@ def add(schema, table_group) -> str:
176177
'{table_group["profiling_exclude_mask"]}',
177178
'{table_group["profile_id_column_mask"]}'::character varying(2000),
178179
'{table_group["profile_sk_column_mask"]}'::character varying,
179-
'{'Y' if table_group["profile_use_sampling"]=='True' else 'N' }'::character varying,
180+
'{'Y' if table_group["profile_use_sampling"] else 'N' }'::character varying,
180181
'{table_group["profile_sample_percent"]}'::character varying,
181182
{table_group["profile_sample_min_count"]},
182183
'{table_group["profiling_delay_days"]}'::character varying,

testgen/ui/views/dialogs/run_profiling_dialog.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@ def run_profiling_dialog(project_code: str, table_group: pd.Series | None = None
2626
display_column="table_groups_name",
2727
default_value=default_table_group_id,
2828
required=True,
29+
placeholder="Select table group to profile",
2930
)
30-
table_group_name: str = table_groups_df.loc[table_groups_df["id"] == table_group_id, "table_groups_name"].iloc[0]
31+
if table_group_id:
32+
table_group_name: str = table_groups_df.loc[table_groups_df["id"] == table_group_id, "table_groups_name"].iloc[0]
3133
testgen.whitespace(1)
3234

33-
with st.container():
34-
st.markdown(f"Execute profiling for the table group **{table_group_name}**?")
35-
st.markdown(":material/info: _Profiling will be performed in a background process._")
35+
if table_group_id:
36+
with st.container():
37+
st.markdown(f"Execute profiling for the table group **{table_group_name}**?")
38+
st.markdown(":material/info: _Profiling will be performed in a background process._")
3639

37-
if testgen.expander_toggle(expand_label="Show CLI command", key="test_suite:keys:run-tests-show-cli"):
38-
st.code(f"testgen run-profile --table-group-id {table_group_id}", language="shellSession")
40+
if testgen.expander_toggle(expand_label="Show CLI command", key="test_suite:keys:run-tests-show-cli"):
41+
st.code(f"testgen run-profile --table-group-id {table_group_id}", language="shellSession")
3942

4043
button_container = st.empty()
4144
status_container = st.empty()

testgen/ui/views/dialogs/run_tests_dialog.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ def run_tests_dialog(project_code: str, test_suite: pd.Series | None = None, def
2626
display_column="test_suite",
2727
default_value=default_test_suite_id,
2828
required=True,
29+
placeholder="Select test suite to run",
2930
)
30-
test_suite_name: str = test_suites_df.loc[test_suites_df["id"] == test_suite_id, "test_suite"].iloc[0]
31+
if test_suite_id:
32+
test_suite_name: str = test_suites_df.loc[test_suites_df["id"] == test_suite_id, "test_suite"].iloc[0]
3133
testgen.whitespace(1)
3234

33-
with st.container():
34-
st.markdown(f"Run tests for the test suite **{test_suite_name}**?")
35-
st.markdown(":material/info: _Test execution will be performed in a background process._")
35+
if test_suite_id:
36+
with st.container():
37+
st.markdown(f"Run tests for the test suite **{test_suite_name}**?")
38+
st.markdown(":material/info: _Test execution will be performed in a background process._")
3639

37-
if testgen.expander_toggle(expand_label="Show CLI command", key="run_tests_dialog:keys:show-cli"):
38-
st.code(
39-
f"testgen run-tests --project-key {project_code} --test-suite-key {test_suite_name}",
40-
language="shellSession"
41-
)
40+
if testgen.expander_toggle(expand_label="Show CLI command", key="run_tests_dialog:keys:show-cli"):
41+
st.code(
42+
f"testgen run-tests --project-key {project_code} --test-suite-key {test_suite_name}",
43+
language="shellSession"
44+
)
4245

4346
button_container = st.empty()
4447
status_container = st.empty()
@@ -47,7 +50,7 @@ def run_tests_dialog(project_code: str, test_suite: pd.Series | None = None, def
4750
with button_container:
4851
_, button_column = st.columns([.8, .2])
4952
with button_column:
50-
run_test_button = st.button("Run Tests", use_container_width=True)
53+
run_test_button = st.button("Run Tests", use_container_width=True, disabled=not test_suite_id)
5154

5255
if run_test_button:
5356
button_container.empty()

testgen/ui/views/hygiene_issues.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def render(
7979
issue_class = testgen.select(
8080
options=["Definite", "Likely", "Possible", "Potential PII"],
8181
default_value=issue_class,
82-
required=False,
8382
bind_to_query="issue_class",
8483
label="Issue Class",
8584
)
@@ -91,7 +90,6 @@ def render(
9190
default_value=None if issue_class == "Potential PII" else issue_type,
9291
value_column="id",
9392
display_column="anomaly_name",
94-
required=False,
9593
bind_to_query="issue_type",
9694
label="Issue Type",
9795
disabled=issue_class == "Potential PII",

testgen/ui/views/profiling_runs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def render(self, project_code: str, table_group_id: str | None = None, **_kwargs
6464
default_value=table_group_id,
6565
bind_to_query="table_group_id",
6666
label="Table Group",
67+
placeholder="---",
6768
)
6869

6970
with actions_column:
@@ -132,6 +133,7 @@ def arg_value_input(self) -> tuple[bool, list[typing.Any], dict[str, typing.Any]
132133
value_column="id",
133134
display_column="table_groups_name",
134135
required=True,
136+
placeholder="Select table group",
135137
)
136138
return bool(tg_id), [], {"table_group_id": tg_id}
137139

testgen/ui/views/test_definitions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ def render(self, test_suite_id: str, table_name: str | None = None, column_name:
7373

7474
with table_filter_column:
7575
columns_df = get_test_suite_columns(test_suite_id)
76+
table_options = list(columns_df["table_name"].unique())
7677
table_name = testgen.select(
77-
options=list(columns_df["table_name"].unique()),
78+
options=table_options,
7879
value_column="table_name",
79-
default_value=table_name,
80+
default_value=table_name or (table_options[0] if table_options else None),
8081
bind_to_query="table_name",
8182
required=True,
8283
label="Table Name",
@@ -691,6 +692,7 @@ def copy_move_test_dialog(project_code, origin_table_group, origin_test_suite, s
691692
value_column="id",
692693
display_column="table_groups_name",
693694
default_value=origin_table_group["id"],
695+
required=True,
694696
label="Target Table Group",
695697
)
696698

@@ -701,6 +703,7 @@ def copy_move_test_dialog(project_code, origin_table_group, origin_test_suite, s
701703
value_column="id",
702704
display_column="test_suite",
703705
default_value=None,
706+
required=True,
704707
label="Target Test Suite",
705708
)
706709

testgen/ui/views/test_results.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def render(
101101
status = testgen.select(
102102
options=status_options,
103103
default_value=status or "Failed + Warning",
104-
required=False,
105104
bind_to_query="status",
106105
bind_empty_value=True,
107106
label="Result Status",
@@ -113,7 +112,6 @@ def render(
113112
value_column="test_type",
114113
display_column="test_name_short",
115114
default_value=test_type,
116-
required=False,
117115
bind_to_query="test_type",
118116
label="Test Type",
119117
)

0 commit comments

Comments
 (0)