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
a5eb647e
Unverified
Commit
a5eb647e
authored
9 months ago
by
lbrdnk
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add basic auth params to `dbms-version` call on Druid (#45729)
* Add basic auth to dbms-version * Add test
parent
5bb2a152
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
modules/drivers/druid/src/metabase/driver/druid/sync.clj
+6
-1
6 additions, 1 deletion
modules/drivers/druid/src/metabase/driver/druid/sync.clj
modules/drivers/druid/test/metabase/driver/druid/sync_test.clj
+22
-0
22 additions, 0 deletions
...es/drivers/druid/test/metabase/driver/druid/sync_test.clj
with
28 additions
and
1 deletion
modules/drivers/druid/src/metabase/driver/druid/sync.clj
+
6
−
1
View file @
a5eb647e
...
...
@@ -66,5 +66,10 @@
[
database
]
{
:pre
[(
map?
(
:details
database
))]}
(
ssh/with-ssh-tunnel
[
details-with-tunnel
(
:details
database
)]
(
->
(
druid.client/GET
(
druid.client/details->url
details-with-tunnel
"/status"
))
(
->
(
druid.client/GET
(
druid.client/details->url
details-with-tunnel
"/status"
)
:auth-enabled
(
->
database
:details
:auth-enabled
)
:auth-username
(
->
database
:details
:auth-username
)
:auth-token-value
(
->
(
:details
database
)
(
secret/db-details-prop->secret-map
"auth-token"
)
secret/value->string
))
(
select-keys
[
:version
]))))
This diff is collapsed.
Click to expand it.
modules/drivers/druid/test/metabase/driver/druid/sync_test.clj
+
22
−
0
View file @
a5eb647e
...
...
@@ -4,7 +4,10 @@
[
malli.core
:as
mc
]
[
malli.error
:as
me
]
[
metabase.driver
:as
driver
]
[
metabase.driver.druid.client
:as
druid.client
]
[
metabase.driver.druid.sync
:as
druid.sync
]
[
metabase.models.database
:refer
[
Database
]]
[
metabase.models.secret
:as
secret
]
[
metabase.sync.sync-metadata.dbms-version
:as
sync-dbms-ver
]
[
metabase.test
:as
mt
]
[
metabase.timeseries-query-processor-test.util
:as
tqpt
]
...
...
@@ -60,3 +63,22 @@
(
is
(
nil?
version-after-update
)))
(
testing
"Check that the value was set again after sync"
(
is
(
nil?
(
check-dbms-version
(
db-dbms-version
db
))))))))))
(
deftest
^
:synchronized
auth-dbms-version-test
(
mt/test-driver
:druid
(
testing
"`dbms-version` uses auth parameters (#41579)"
(
tqpt/with-flattened-dbdef
(
let
[
get-args
(
volatile!
nil
)
db-with-auth-details
(
update
(
mt/db
)
:details
assoc
:auth-enabled
true
:auth-username
"admin"
:auth-token-value
"password1"
)]
;; Following ensures that auth parameters are passed to GET during version sync if present.
(
with-redefs
[
secret/value->string
(
constantly
"password1"
)
druid.client/GET
(
fn
[
_url
&
params
]
(
vreset!
get-args
(
apply
hash-map
params
))
nil
)]
;; Just fill in the params with internally modified `dbms-version`.
(
druid.sync/dbms-version
db-with-auth-details
)
(
is
(
=
true
(
:auth-enabled
@
get-args
)))
(
is
(
=
"admin"
(
:auth-username
@
get-args
)))
(
is
(
=
"password1"
(
:auth-token-value
@
get-args
)))))))))
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