Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Actions] Add emitter and action tests #24199

Merged
merged 5 commits into from Jul 25, 2022
Merged

Conversation

snoe
Copy link
Contributor

@snoe snoe commented Jul 21, 2022

Fixes #24079

Adding tests for emitters and actions

Test hydration of :emitters

Test hydration of :action

Test http emitter execution

Test emitter crud

Test failure cases around emitter execution

Small consistency changes made to non-test code that shouldn't affect happy path FE code, largely 404 checking and keyword/string consistency.

snoe added 3 commits July 20, 2022 11:05
`with-temp*` allows for unpaired bindings if you just want the default
model. This would break the `let` that the hook was binding if you had
an unpaired temp model followed by others.
Test hydration of :emitters

Test hydration of :action

Test http emitter execution

Test emitter crud

Test failure cases around emitter execution

Small consistency changes made to non-test code that shouldn't affect happy path FE code, largely 404 checking and keyword/string consistency.
@@ -2,7 +2,7 @@
:show-docs-arity-on-same-line? true
:project-specs [{:project-path "deps.edn"
:classpath-cmd ["clojure" "-A:dev:ee:ee-dev:drivers:drivers-dev" "-Spath"]}]

:clean {:ns-inner-blocks-indentation :keep}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this prevent namespaces from changing

(:require [...])
to

(:require
 [...])

part (:children binding+opts)]
;; if children is size 1 then ensure nil is on the right side of the let
:let [[binding-part opts] (:children binding+opts)]
part [binding-part opts]]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes bad analysis when with-temp* doesn't use a pair of values for the model.

(mt/with-temp [Action [a] HttpAction [b {}]] ...)

This was expanding into [[Action HttpAction] (let [a b {}] ...)] but should now turn into [[Action HttpAction] (let [a nil b {}] ...)]

@codecov
Copy link

codecov bot commented Jul 21, 2022

Codecov Report

Merging #24199 (1b40272) into pod-writeback (ed44ec0) will increase coverage by 0.22%.
The diff coverage is 89.65%.

@@                Coverage Diff                @@
##           pod-writeback   #24199      +/-   ##
=================================================
+ Coverage          64.34%   64.57%   +0.22%     
=================================================
  Files               2773     2783      +10     
  Lines              85443    86477    +1034     
  Branches           10631    10687      +56     
=================================================
+ Hits               54978    55841     +863     
- Misses             26157    26272     +115     
- Partials            4308     4364      +56     
Flag Coverage Δ
back-end 85.49% <89.65%> (-0.06%) ⬇️
front-end 45.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/metabase/actions/http_action.clj 83.14% <84.61%> (ø)
src/metabase/models/action.clj 92.23% <90.47%> (ø)
src/metabase/api/action.clj 82.22% <100.00%> (ø)
src/metabase/api/emitter.clj 86.11% <100.00%> (ø)
src/metabase/api/testing.clj 100.00% <100.00%> (ø)
src/metabase/models/card.clj 86.93% <100.00%> (+0.23%) ⬆️
src/metabase/task/persist_refresh.clj 84.08% <0.00%> (-2.05%) ⬇️
src/metabase/driver/h2.clj 91.83% <0.00%> (-0.53%) ⬇️
src/metabase/api/alert.clj 87.27% <0.00%> (-0.39%) ⬇️
src/metabase/models/secret.clj 73.15% <0.00%> (-0.18%) ⬇️
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed44ec0...1b40272. Read the comment docs.

@snoe snoe merged commit e6aded3 into pod-writeback Jul 25, 2022
@snoe snoe deleted the writeback-add-emitter-tests branch July 25, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants