Skip to content

Commit f0d90de

Browse files
bugfix-windows-casting-test (#520)
Summary: - Cater for windows `real` number implementation. - Skipping robot test `AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exemplifies Cast and Multiple Functions on Materialized Views` for windows only. - Added robot test `Contains Check AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exemplifies Cast and Multiple Functions on Materialized Views`.
1 parent d575983 commit f0d90de

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

test/robot/functional/stackql_mocked_from_cmd_line.robot

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7523,6 +7523,7 @@ AWS Materialized View And Multiple Function Query on Resource Costs Exemplifies
75237523

75247524
AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exemplifies Cast and Multiple Functions on Materialized Views
75257525
[Tags] registry tls_proxied
7526+
Pass Execution If "${IS_WINDOWS}" == "1" Windows real casting on the input is indeterminant so will use a similarity check below.
75267527
${sqliteInputStr} = Catenate
75277528
... create or replace materialized view e1 as select json_extract(json_each.value, '$.TimePeriod.Start') as beginning, json_extract(json_each.value, '$.TimePeriod.End') as ending, json_extract(json_each.value, '$.Groups') as rez from aws.ce_native.cost_and_usage, json_each(ResultsByTime) where data__Granularity = 'MONTHLY' and data__Metrics = '["UnblendedCost"]' and data__TimePeriod = '{"Start": "2024-08-01", "End": "2024-11-30"}' and data__GroupBy = '[{"Type":"DIMENSION","Key":"SERVICE"}]' and region = 'us-east-1';
75287529
... select beginning, ending, json_extract(json_each.value, '$.Keys') as keyz, cast(json_extract(json_each.value, '$.Metrics.UnblendedCost.Amount') as real) as amount, json_extract(json_each.value, '$.Metrics.UnblendedCost.Unit') as unit from e1, json_each(e1.rez) order by amount, keyz, ending;
@@ -7532,7 +7533,9 @@ AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exe
75327533
${inputStr} = Set Variable If "${SQL_BACKEND}" == "postgres_tcp" ${postgresInputStr} ${sqliteInputStr}
75337534
${outputStrSQLite} = Get File ${REPOSITORY_ROOT}${/}test${/}assets${/}expected${/}aws${/}ce${/}ce-cast-real.txt
75347535
${outputStrPostgres} = Get File ${REPOSITORY_ROOT}${/}test${/}assets${/}expected${/}aws${/}ce${/}ce-cast-real-postgres.txt
7535-
${outputStr} = Set Variable If "${SQL_BACKEND}" == "postgres_tcp" ${outputStrPostgres} ${outputStrSQLite}
7536+
${outputStr} = Set Variable If
7537+
... "${SQL_BACKEND}" == "postgres_tcp" ${outputStrPostgres}
7538+
... ${outputStrSQLite}
75367539
Should Stackql Exec Inline Equal Both Streams
75377540
... ${STACKQL_EXE}
75387541
... ${OKTA_SECRET_STR}
@@ -7546,3 +7549,27 @@ AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exe
75467549
... DDL Execution Completed
75477550
... stdout=${CURDIR}/tmp/AWS-Materialized-View-And-Cast-and-Multiple-Function-Query-on-Resource-Costs-Exemplifies-Cast-and-Multiple-Functions-on-Materialized-Views.tmp
75487551
... stderr=${CURDIR}/tmp/AWS-Materialized-View-And-Cast-and-Multiple-Function-Query-on-Resource-Costs-Exemplifies-Cast-and-Multiple-Functions-on-Materialized-Views-stderr.tmp
7552+
7553+
Contains Check AWS Materialized View and Cast and Multiple Function Query on Resource Costs Exemplifies Cast and Multiple Functions on Materialized Views
7554+
[Tags] registry tls_proxied
7555+
[Documentation] This test exists only because windows real casting is intereminant and we want to check the query is not erroeaous on windows.
7556+
${sqliteInputStr} = Catenate
7557+
... create or replace materialized view e1 as select json_extract(json_each.value, '$.TimePeriod.Start') as beginning, json_extract(json_each.value, '$.TimePeriod.End') as ending, json_extract(json_each.value, '$.Groups') as rez from aws.ce_native.cost_and_usage, json_each(ResultsByTime) where data__Granularity = 'MONTHLY' and data__Metrics = '["UnblendedCost"]' and data__TimePeriod = '{"Start": "2024-08-01", "End": "2024-11-30"}' and data__GroupBy = '[{"Type":"DIMENSION","Key":"SERVICE"}]' and region = 'us-east-1';
7558+
... select beginning, ending, json_extract(json_each.value, '$.Keys') as keyz, cast(json_extract(json_each.value, '$.Metrics.UnblendedCost.Amount') as real) as amount, json_extract(json_each.value, '$.Metrics.UnblendedCost.Unit') as unit from e1, json_each(e1.rez) order by amount, keyz, ending;
7559+
${postgresInputStr} = Catenate
7560+
... create or replace materialized view e1 as select json_extract_path_text(rd.value, 'TimePeriod', 'Start') as beginning, json_extract_path_text(rd.value, 'TimePeriod', 'End') as ending, json_extract_path_text(rd.value, 'Groups') as rez from aws.ce_native.cost_and_usage, json_array_elements_text(ResultsByTime) as rd where data__Granularity = 'MONTHLY' and data__Metrics = '["UnblendedCost"]' and data__TimePeriod = '{"Start": "2024-08-01", "End": "2024-11-30"}' and data__GroupBy = '[{"Type":"DIMENSION","Key":"SERVICE"}]' and region = 'us-east-1';
7561+
... select beginning, ending, json_extract_path_text(rd.value, 'Keys') as keyz, cast(json_extract_path_text(rd.value, 'Metrics', 'UnblendedCost', 'Amount') as real) as amount, json_extract_path_text(rd.value, 'Metrics', 'UnblendedCost', 'Unit') as unit from e1, json_array_elements_text(e1.rez) as rd order by amount, keyz, ending;
7562+
${inputStr} = Set Variable If "${SQL_BACKEND}" == "postgres_tcp" ${postgresInputStr} ${sqliteInputStr}
7563+
Should Stackql Exec Inline Contain Both Streams
7564+
... ${STACKQL_EXE}
7565+
... ${OKTA_SECRET_STR}
7566+
... ${GITHUB_SECRET_STR}
7567+
... ${K8S_SECRET_STR}
7568+
... ${REGISTRY_NO_VERIFY_CFG_STR}
7569+
... ${AUTH_CFG_STR}
7570+
... ${SQL_BACKEND_CFG_STR_CANONICAL}
7571+
... ${inputStr}
7572+
... "AWS CloudFormation"
7573+
... DDL Execution Completed
7574+
... stdout=${CURDIR}/tmp/Contains-Check-AWS-Materialized-View-And-Cast-and-Multiple-Function-Query-on-Resource-Costs-Exemplifies-Cast-and-Multiple-Functions-on-Materialized-Views.tmp
7575+
... stderr=${CURDIR}/tmp/Contains-Check-AWS-Materialized-View-And-Cast-and-Multiple-Function-Query-on-Resource-Costs-Exemplifies-Cast-and-Multiple-Functions-on-Materialized-Views-stderr.tmp

0 commit comments

Comments
 (0)