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
a955419f
Commit
a955419f
authored
4 years ago
by
Cam Saul
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into merge-release-0.36.x
parents
c941660a
c60510b0
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/cmd/dump_to_h2_test.clj
+22
-19
22 additions, 19 deletions
test/metabase/cmd/dump_to_h2_test.clj
with
22 additions
and
19 deletions
test/metabase/cmd/dump_to_h2_test.clj
+
22
−
19
View file @
a955419f
...
...
@@ -38,24 +38,27 @@
cols+vals
)))))
(
deftest
dump-deletes-target-db-files-tests
(
let
[
tmp-h2-db
(
str
(
u.files/get-path
(
System/getProperty
"java.io.tmpdir"
)
"mbtest_dump.h2"
))
tmp-h2-db-mv
(
str
tmp-h2-db
".mv.db"
)
file-contents
{
tmp-h2-db
"Not really an H2 DB"
tmp-h2-db-mv
"Not really another H2 DB"
}]
;; keep setup-db!/setup-db!* from changing connection state
(
with-redefs
[
mdb/setup-db!
(
constantly
nil
)
mdb/setup-db!*
(
constantly
nil
)]
(
try
(
doseq
[[
filename
contents
]
file-contents
]
(
spit
filename
contents
))
(
dump-to-h2/dump-to-h2!
tmp-h2-db
)
;; test fails when the application db is anything but H2 presently
;; TODO: make this test work with postgres / mysql / mariadb
(
when
(
=
:h2
(
mdb/db-type
))
(
let
[
tmp-h2-db
(
str
(
u.files/get-path
(
System/getProperty
"java.io.tmpdir"
)
"mbtest_dump.h2"
))
tmp-h2-db-mv
(
str
tmp-h2-db
".mv.db"
)
file-contents
{
tmp-h2-db
"Not really an H2 DB"
tmp-h2-db-mv
"Not really another H2 DB"
}]
;; keep setup-db!/setup-db!* from changing connection state
(
with-redefs
[
mdb/setup-db!
(
constantly
nil
)
mdb/setup-db!*
(
constantly
nil
)]
(
try
(
doseq
[[
filename
contents
]
file-contents
]
(
spit
filename
contents
))
(
dump-to-h2/dump-to-h2!
tmp-h2-db
)
(
doseq
[
filename
(
keys
file-contents
)]
(
testing
(
str
filename
" was deleted"
)
(
is
(
false?
(
.exists
(
io/file
filename
))))))
(
doseq
[
filename
(
keys
file-contents
)]
(
testing
(
str
filename
" was deleted"
)
(
is
(
false?
(
.exists
(
io/file
filename
))))))
(
finally
(
doseq
[
filename
(
keys
file-contents
)
:let
[
file
(
io/file
filename
)]]
(
when
(
.exists
file
)
(
io/delete-file
file
))))))))
(
finally
(
doseq
[
filename
(
keys
file-contents
)
:let
[
file
(
io/file
filename
)]]
(
when
(
.exists
file
)
(
io/delete-file
file
))))))))
)
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