Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
c8d42753
Unverified
Commit
c8d42753
authored
10 months ago
by
Cal Herries
Committed by
GitHub
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[backport] Mitigate redshift flakes by not dropping view in test (#42044)
parent
fe0a4e2e
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/drivers/redshift/test/metabase/driver/redshift_test.clj
+17
-21
17 additions, 21 deletions
...s/drivers/redshift/test/metabase/driver/redshift_test.clj
with
17 additions
and
21 deletions
modules/drivers/redshift/test/metabase/driver/redshift_test.clj
+
17
−
21
View file @
c8d42753
...
...
@@ -255,28 +255,24 @@
(
t2.with-temp/with-temp
[
Database
database
{
:engine
:redshift,
:details
db-details
}]
(
let
[
view-nm
(
tx/db-qualified-table-name
(
:name
database
)
"lbv"
)
qual-view-nm
(
format
"\"%s\".\"%s\""
(
redshift.test/unique-session-schema
)
view-nm
)]
(
try
(
execute!
(
str
"CREATE OR REPLACE VIEW %1$s AS ("
"WITH test_data AS (SELECT 'open' AS shop_status UNION ALL SELECT 'closed' AS shop_status) "
"SELECT NULL as raw_null, "
"'hello' as raw_var, "
"CASE WHEN shop_status = 'open' THEN 11387.133 END AS case_when_numeric_inc_nulls "
"FROM test_data) WITH NO SCHEMA BINDING;"
)
qual-view-nm
)
(
sync/sync-database!
database
{
:scan
:schema
})
(
is
(
contains?
(
t2/select-fn-set
:name
Table
:db_id
(
u/the-id
database
))
; the new view should have been synced without errors
view-nm
))
(
let
[
table-id
(
t2/select-one-pk
Table
:db_id
(
u/the-id
database
)
,
:name
view-nm
)]
(
execute!
(
str
"CREATE OR REPLACE VIEW %1$s AS ("
"WITH test_data AS (SELECT 'open' AS shop_status UNION ALL SELECT 'closed' AS shop_status) "
"SELECT NULL as raw_null, "
"'hello' as raw_var, "
"CASE WHEN shop_status = 'open' THEN 11387.133 END AS case_when_numeric_inc_nulls "
"FROM test_data) WITH NO SCHEMA BINDING;"
)
qual-view-nm
)
(
sync/sync-database!
database
{
:scan
:schema
})
(
is
(
contains?
(
t2/select-fn-set
:name
Table
:db_id
(
u/the-id
database
))
; the new view should have been synced without errors
view-nm
))
(
let
[
table-id
(
t2/select-one-pk
Table
:db_id
(
u/the-id
database
)
,
:name
view-nm
)]
;; and its columns' :base_type should have been identified correctly
(
is
(
=
[{
:name
"case_when_numeric_inc_nulls"
,
:database_type
"numeric"
,
:base_type
:type/Decimal
}
{
:name
"raw_null"
,
:database_type
"character varying"
,
:base_type
:type/Text
}
{
:name
"raw_var"
,
:database_type
"character varying"
,
:base_type
:type/Text
}]
(
t2/select
[
Field
:name
:database_type
:base_type
]
:table_id
table-id
{
:order-by
[
:name
]}))))
(
finally
(
execute!
(
str
"DROP VIEW IF EXISTS %s;"
)
qual-view-nm
)))))))))
(
is
(
=
[{
:name
"case_when_numeric_inc_nulls"
,
:database_type
"numeric"
,
:base_type
:type/Decimal
}
{
:name
"raw_null"
,
:database_type
"character varying"
,
:base_type
:type/Text
}
{
:name
"raw_var"
,
:database_type
"character varying"
,
:base_type
:type/Text
}]
(
t2/select
[
Field
:name
:database_type
:base_type
]
:table_id
table-id
{
:order-by
[
:name
]}))))))))))
(
deftest
filtered-syncable-schemas-test
(
mt/test-driver
:redshift
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment