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
5460e4b9
Unverified
Commit
5460e4b9
authored
3 years ago
by
Noah Moss
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ensure dashcard order is deterministic in dashboard subscription tests (#19199)
parent
1d900799
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/dashboard_subscription_test.clj
+19
-11
19 additions, 11 deletions
test/metabase/dashboard_subscription_test.clj
with
19 additions
and
11 deletions
test/metabase/dashboard_subscription_test.clj
+
19
−
11
View file @
5460e4b9
...
...
@@ -14,19 +14,20 @@
specified), then invokes
(f pulse)"
[{
:keys
[
dashboard
pulse
pulse-card
channel
card
]
[{
:keys
[
dashboard
pulse
pulse-card
channel
card
dashcard
]
:or
{
channel
:email
}}
f
]
(
mt/with-temp*
[
Pulse
[{
pulse-id
:id,
:as
pulse
}
(
->>
pulse
(
merge
{
:name
"Aviary KPIs"
:dashboard_id
(
u/the-id
dashboard
)})
)]
(
merge
{
:name
"Aviary KPIs"
:dashboard_id
(
u/the-id
dashboard
)}
pulse
)]
PulseCard
[
_
(
merge
{
:pulse_id
pulse-id
:card_id
(
u/the-id
card
)
:position
0
}
pulse-card
)]
DashboardCard
[{
dashcard-id
:id
}
{
:dashboard_id
(
u/the-id
dashboard
)
:card_id
(
u/the-id
card
)}]
DashboardCard
[
_
(
merge
{
:dashboard_id
(
u/the-id
dashboard
)
:card_id
(
u/the-id
card
)}
dashcard
)]
PulseChannel
[{
pc-id
:id
}
(
case
channel
:email
{
:pulse_id
pulse-id
}
...
...
@@ -64,7 +65,7 @@
:assert {:slack (fn [{:keys [pulse-id]} response]
(is (= {:sent pulse-id}
response)))}})"
[{
:keys
[
card
dashboard
pulse
pulse-card
fixture
]
,
assertions
:assert
}]
[{
:keys
[
card
dashboard
dashcard
pulse
pulse-card
fixture
]
,
assertions
:assert
}]
{
:pre
[(
map?
assertions
)
((
some-fn
:email
:slack
)
assertions
)]}
(
doseq
[
channel-type
[
:email
:slack
]
:let
[
f
(
get
assertions
channel-type
)]
...
...
@@ -79,6 +80,7 @@
{
:card
card-id
:creator_id
(
mt/user->id
:rasta
)
:dashboard
dashboard-id
:dashcard
dashcard
:pulse
pulse
:pulse-card
pulse-card
:channel
channel-type
}]
...
...
@@ -239,13 +241,16 @@
(
output
@#
'render.body/attached-results-text
))))))}}))
(
deftest
virtual-card-test
(
tests
{
:pulse
{
:skip_if_empty
false
}}
(
tests
{
:pulse
{
:skip_if_empty
false
}
,
:dashcard
{
:row
0
,
:col
0
}
}
"Dashboard subscription that includes a virtual (markdown) card"
{
:card
(
checkins-query-card
{})
:fixture
(
fn
[{
dashboard-id
:dashboard-id
}
thunk
]
(
mt/with-temp
DashboardCard
[
_
{
:dashboard_id
dashboard-id,
:visualization_settings
{
:text
"# header"
}}]
(
mt/with-temp
DashboardCard
[
_
{
:dashboard_id
dashboard-id
:row
1
:col
1
:visualization_settings
{
:text
"# header"
}}]
(
mt/with-temporary-setting-values
[
site-name
"Metabase Test"
]
(
thunk
))))
...
...
@@ -329,13 +334,16 @@
(
thunk->boolean
pulse-results
)))))}}))
(
deftest
mrkdwn-length-limit-test
(
tests
{
:pulse
{
:skip_if_empty
false
}}
(
tests
{
:pulse
{
:skip_if_empty
false
}
,
:dashcard
{
:row
0
,
:col
0
}
}
"Dashboard subscription that includes a Markdown card that exceeds Slack's length limit when converted to mrkdwn"
{
:card
(
checkins-query-card
{})
:fixture
(
fn
[{
dashboard-id
:dashboard-id
}
thunk
]
(
mt/with-temp
DashboardCard
[
_
{
:dashboard_id
dashboard-id,
:visualization_settings
{
:text
"abcdefghijklmnopqrstuvwxyz"
}}]
(
mt/with-temp
DashboardCard
[
_
{
:dashboard_id
dashboard-id
:row
1
:col
1
:visualization_settings
{
:text
"abcdefghijklmnopqrstuvwxyz"
}}]
(
binding
[
pulse/*slack-mrkdwn-length-limit*
10
]
(
thunk
))))
...
...
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