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
64eaa263
Commit
64eaa263
authored
10 years ago
by
Cam Saül
Browse files
Options
Downloads
Plain Diff
Merge pull request #349 from metabase/additional_fk_sync_tests
add a couple of additional tests for FK syncing
parents
1211462b
89d3bfa8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/driver/generic_sql/sync_test.clj
+11
-1
11 additions, 1 deletion
test/metabase/driver/generic_sql/sync_test.clj
with
11 additions
and
1 deletion
test/metabase/driver/generic_sql/sync_test.clj
+
11
−
1
View file @
64eaa263
...
...
@@ -11,7 +11,7 @@
[
metabase.test.util
:refer
[
resolve-private-fns
]]))
(
resolve-private-fns
metabase.driver.generic-sql.sync
field-avg-length
field-percent-urls
set-table-pks-if-needed!
)
(
resolve-private-fns
metabase.driver.generic-sql.sync
determine-fk-type
field-avg-length
field-percent-urls
set-table-pks-if-needed!
)
(
def
users-table
(
delay
(
sel
:one
Table
:name
"USERS"
)))
...
...
@@ -107,6 +107,16 @@
(
sync-table
table
)
(
get-special-type-and-fk-exists?
))]))
;; ## Tests for DETERMINE-FK-TYPE
;; Since COUNT(category_id) > COUNT(DISTINCT(category_id)) the FK relationship should be Mt1
(
expect
:Mt1
(
determine-fk-type
(
korma-entity
(
sel
:one
Table
:id
(
table->id
:venues
)))
"CATEGORY_ID"
))
;; Since COUNT(id) == COUNT(DISTINCT(id)) the FK relationship should be 1t1
;; (yes, ID isn't really a FK field, but determine-fk-type doesn't need to know that)
(
expect
:1t1
(
determine-fk-type
(
korma-entity
(
sel
:one
Table
:id
(
table->id
:venues
)))
"ID"
))
;; ## TEST FIELD-AVG-LENGTH
;; Test that this works if *sql-string-length-fn* is bound as exected
...
...
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