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
3e11322e
Commit
3e11322e
authored
10 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
test fix
parent
b8597edb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/models/database.clj
+3
-2
3 additions, 2 deletions
src/metabase/models/database.clj
test/metabase/api/qs_test.clj
+13
-6
13 additions, 6 deletions
test/metabase/api/qs_test.clj
with
16 additions
and
8 deletions
src/metabase/models/database.clj
+
3
−
2
View file @
3e11322e
...
...
@@ -25,9 +25,10 @@
:details
(
json/write-str
details
)
:engine
(
name
engine
)))
(
defmethod
pre-update
Database
[
_
{
:keys
[
details
]
:as
database
}]
(
defmethod
pre-update
Database
[
_
{
:keys
[
details
engine
]
:as
database
}]
(
cond->
(
assoc
database
:updated_at
(
util/new-sql-timestamp
))
details
(
assoc
:details
(
json/write-str
details
))))
details
(
assoc
:details
(
json/write-str
details
))
engine
(
assoc
:engine
(
name
engine
))))
(
defmethod
pre-cascade-delete
Database
[
_
{
:keys
[
id
]}]
(
cascade-delete
'metabase.models.table/Table
:db_id
id
)
...
...
This diff is collapsed.
Click to expand it.
test/metabase/api/qs_test.clj
+
13
−
6
View file @
3e11322e
...
...
@@ -5,15 +5,24 @@
[
metabase.db
:refer
:all
]
(
metabase.models
[
query-execution
:refer
[
QueryExecution
]])
[
metabase.test.util
:refer
[
match-$
random-name
expect-eval-actual-first
]]
[
metabase.test-data
:refer
:all
]))
[
metabase.test-data
:refer
:all
]
metabase.test-setup
))
;; ## Helper Fns
(
defn
create-query
[]
((
user->client
:rasta
)
:post
200
"qs"
{
:database
(
:id
@
test-db
)
:sql
"SELECT COUNT(*) FROM CATEGORIES;"
}))
(
defn
fetch-query
[
uuid
]
((
user->client
:rasta
)
:get
(
format
"qs/%s"
uuid
)))
(
defn
fetch-query
([
uuid
]
(
fetch-query
uuid
500
))
([
uuid
maxwait-ms
]
(
let
[{
:keys
[
status
]
:as
result
}
((
user->client
:rasta
)
:get
(
format
"qs/%s"
uuid
))]
(
if
(
or
(
not=
status
"starting"
)
(
<=
maxwait-ms
0
))
result
(
do
(
Thread/sleep
50
)
(
recur
uuid
(
-
maxwait-ms
50
)))))))
;; ## POST /api/qs
...
...
@@ -28,7 +37,6 @@
(
->
(
create-query
)
(
dissoc
:status
)))
; status is a race condition and can be either 'running' or 'completed'
;; ## GET /api/qs/:uuid
;; Can we fetch the results of a Query ?
(
expect-eval-actual-first
...
...
@@ -42,8 +50,7 @@
:rows
[[
75
]]}
:row_count
1
})
(
let
[{
uuid
:uuid
}
(
create-query
)]
(
Thread/sleep
100
)
; this query is simple as f**k. Give it 100ms to complete
(
fetch-query
uuid
)))
; if it doesn't by then our QP might be brokesies
(
fetch-query
uuid
)))
;; ## GET /api/qs/:uuid/csv
...
...
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