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
e12e3604
Unverified
Commit
e12e3604
authored
5 months ago
by
Noah Moss
Committed by
GitHub
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix non-bool value in CSV upload availability check for stats ping (#48167)
parent
e8deecc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/analytics/stats.clj
+6
-6
6 additions, 6 deletions
src/metabase/analytics/stats.clj
test/metabase/analytics/stats_test.clj
+29
-0
29 additions, 0 deletions
test/metabase/analytics/stats_test.clj
with
35 additions
and
6 deletions
src/metabase/analytics/stats.clj
+
6
−
6
View file @
e12e3604
...
...
@@ -588,12 +588,12 @@
(
defn-
csv-upload-available?
"Is CSV upload currently available to be used on this instance?"
[]
(
let
[
major-version
(
config/current-major-version
)
min
or-version
(
config/current-m
in
or-version
)
engines
(
t2/select-fn-set
:engine
:model/Database
{
:where
[
:in
:engine
(
map
name
(
keys
csv-upload-version-availability
))]})]
(
when
(
and
major-version
minor-version
)
(
boolean
(
boolean
(
let
[
maj
or-version
(
config/current-m
aj
or-version
)
minor-version
(
config/current-minor-version
)
engines
(
t2/select-fn-set
:engine
:model/Database
{
:where
[
:in
:engine
(
map
name
(
keys
csv-upload-version-availability
))]})]
(
when
(
and
major-version
minor-version
)
(
some
(
fn
[
engine
]
(
when-let
[[
required-major
required-minor
]
(
csv-upload-version-availability
engine
)]
...
...
This diff is collapsed.
Click to expand it.
test/metabase/analytics/stats_test.clj
+
29
−
0
View file @
e12e3604
...
...
@@ -4,6 +4,7 @@
[
clojure.test
:refer
:all
]
[
java-time.api
:as
t
]
[
metabase.analytics.stats
:as
stats
:refer
[
legacy-anonymous-usage-stats
]]
[
metabase.config
:as
config
]
[
metabase.core
:as
mbc
]
[
metabase.db
:as
mdb
]
[
metabase.email
:as
email
]
...
...
@@ -392,6 +393,34 @@
(
mt/with-temp
[
:model/QueryExecution
_
query-execution-defaults
]
(
is
(
true?
(
@#
'stats/sufficient-queries?
1
)))))))
(
deftest
csv-upload-available-test
(
mt/with-temp-empty-app-db
[
_conn
:h2
]
(
mdb/setup-db!
:create-sample-content?
true
)
(
testing
"csv-upload-available? currently detects upload availability based on the current MB version"
(
mt/with-temp
[
:model/Database
_
{
:engine
:postgres
}]
(
with-redefs
[
config/current-major-version
(
constantly
46
)
config/current-minor-version
(
constantly
0
)]
(
is
false?
(
@#
'stats/csv-upload-available?
)))
(
with-redefs
[
config/current-major-version
(
constantly
47
)
config/current-minor-version
(
constantly
1
)]
(
is
true?
(
@#
'stats/csv-upload-available?
))))
(
mt/with-temp
[
:model/Database
_
{
:engine
:redshift
}]
(
with-redefs
[
config/current-major-version
(
constantly
49
)
config/current-minor-version
(
constantly
5
)]
(
is
false?
(
@#
'stats/csv-upload-available?
)))
(
with-redefs
[
config/current-major-version
(
constantly
49
)
config/current-minor-version
(
constantly
6
)]
(
is
true?
(
@#
'stats/csv-upload-available?
))))
;; If we can't detect the MB version, return nil
(
with-redefs
[
config/current-major-version
(
constantly
nil
)
config/current-minor-version
(
constantly
nil
)]
(
is
false?
(
@#
'stats/csv-upload-available?
))))))
(
def
^
:private
excluded-features
"Set of features intentionally excluded from the daily stats ping. If you add a new feature, either add it to the stats ping
or to this set, so that [[every-feature-is-accounted-for-test]] passes."
...
...
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