From 83c8143ef8b374071b968fd3c4fbae4976a51808 Mon Sep 17 00:00:00 2001 From: tianj7 Date: Mon, 21 Oct 2024 12:00:14 -0500 Subject: [PATCH] add failure warning --- tests/setup_local_db/ddl_results_and_cdm.sql | 4 ++++ tests/setup_local_db/test_data_results_and_cdm.sql | 2 ++ tests/testutils.go | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/setup_local_db/ddl_results_and_cdm.sql b/tests/setup_local_db/ddl_results_and_cdm.sql index b3cdb19..c4c0064 100644 --- a/tests/setup_local_db/ddl_results_and_cdm.sql +++ b/tests/setup_local_db/ddl_results_and_cdm.sql @@ -135,3 +135,7 @@ CREATE TABLE dbo.VersionInfo( AppliedOn timestamp NULL, Description varchar(1024) NULL ) + +CREATE TABLEE dbo.VersionInfo( + Version bigint NOT NULL, +) diff --git a/tests/setup_local_db/test_data_results_and_cdm.sql b/tests/setup_local_db/test_data_results_and_cdm.sql index 44f5248..adb62ed 100644 --- a/tests/setup_local_db/test_data_results_and_cdm.sql +++ b/tests/setup_local_db/test_data_results_and_cdm.sql @@ -178,6 +178,8 @@ INSERT INTO dbo.VersionInfo Values(0, '20240101 09:30:00 AM', 'Initial Version'), (1, '20240901 09:30:00 AM', 'Table Update'); +DROP Table IF EXISTS misc.DATA_DICTIONARY; + WITH cte_counts AS (SELECT observation_concept_id, COUNT(DISTINCT person_id) AS number_of_people_with_variable, COUNT(DISTINCT CASE WHEN value_as_number IS NOT NULL THEN person_id END) AS number_of_people_where_value_is_filled_number, diff --git a/tests/testutils.go b/tests/testutils.go index 1cb063a..bb958a9 100644 --- a/tests/testutils.go +++ b/tests/testutils.go @@ -46,9 +46,12 @@ func ExecSQLScript(sqlFilePath string, sourceId int) { } fileContents, err2 := os.ReadFile(path) if err2 != nil { - panic(err) + panic(err2) + } + result := ExecSQLString(string(fileContents), sourceId) + if result.Error != nil && len(result.Error.Error()) > 0 { + fmt.Printf("Errors: %s\n", result.Error.Error()) } - ExecSQLString(string(fileContents), sourceId) } func ExecAtlasSQLString(sqlString string) {