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

Add missing "is" assertions to various tests #15254

Merged
merged 6 commits into from Mar 31, 2021

Conversation

jeff303
Copy link
Contributor

@jeff303 jeff303 commented Mar 19, 2021

Many tests were missing the actual assertion, and only had an = invocation.

Copy link
Member

@tsmacdonald tsmacdonald left a comment

Choose a reason for hiding this comment

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

Good catch! LGTM if green

@jeff303 jeff303 requested a review from camsaul March 19, 2021 20:54
@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #15254 (0911de0) into master (3099c35) will increase coverage by 0.00%.
The diff coverage is 88.61%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #15254   +/-   ##
=======================================
  Coverage   84.42%   84.42%           
=======================================
  Files         390      394    +4     
  Lines       30903    31001   +98     
  Branches     2213     2229   +16     
=======================================
+ Hits        26089    26173   +84     
+ Misses       2601     2599    -2     
- Partials     2213     2229   +16     
Impacted Files Coverage Δ
src/metabase/models.clj 100.00% <ø> (ø)
src/metabase/server/handler.clj 66.66% <ø> (ø)
src/metabase/server/middleware/util.clj 100.00% <ø> (+21.42%) ⬆️
...tabase/query_processor/middleware/large_int_id.clj 87.50% <50.00%> (-8.16%) ⬇️
src/metabase/server/middleware/session.clj 91.86% <50.00%> (+0.07%) ⬆️
src/metabase/util/files.clj 51.61% <50.00%> (+2.40%) ⬆️
src/metabase/models/login_history.clj 78.57% <78.57%> (ø)
.../src/metabase_enterprise/sso/integrations/saml.clj 72.89% <80.00%> (+2.60%) ⬆️
src/metabase/server/middleware/browser_cookie.clj 82.35% <82.35%> (ø)
src/metabase/server/request/util.clj 86.36% <86.36%> (ø)
... and 26 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 ba495bd...0911de0. Read the comment docs.

@jeff303 jeff303 force-pushed the add-missing-test-assertions branch from 4430cda to ce64e07 Compare March 22, 2021 14:24
@jeff303
Copy link
Contributor Author

jeff303 commented Mar 22, 2021

It seems that row-type-agnostic-test is an interesting failure, here. The failing assertion uses strings for the expected values, but the behavior is inconsistent. Some drivers are actually returning numeric values instead, causing the test to fail, like

:oracle All QP middleware should work regardless of the type of each row (#13475) rows = ^clojure.lang.PersistentVector [[1] [2147483647]] Should work with the middleware options used by API requests as well
expected: [["1"] ["2147483647"]]
  actual: [[1] [2147483647]]
    diff: - [["1"] ["2147483647"]]
          + [[1] [2147483647]]

Oracle and Snowflake are failing in this way. But switching the expected values to numeric instead makes them pass, but obviously then the others fail (ex: H2, Postgres, etc.)

I can obviously fix the assertion by converting these values to numerics before asserting, but would that possibly be masking some type of driver or middleware level issue? Any thoughts, @camsaul ?

@jeff303 jeff303 requested a review from camsaul March 23, 2021 14:39
@camsaul
Copy link
Member

camsaul commented Mar 24, 2021

metabase.query-processor.reducible-test/row-type-agnostic-test is failing for Oracle and Snowflake now, doesn't look like a flake.

@jeff303
Copy link
Contributor Author

jeff303 commented Mar 24, 2021

metabase.query-processor.reducible-test/row-type-agnostic-test is failing for Oracle and Snowflake now, doesn't look like a flake.

It's not. Please refer to my other comment just before.

@jeff303 jeff303 requested a review from camsaul March 24, 2021 15:14
…e_type is :type/Number, in addition to :type/Integer
@jeff303
Copy link
Contributor Author

jeff303 commented Mar 26, 2021

Tracked down the problem, which was in the convert-id-to-string middleware. Apparently, Oracle and Snowflake sync the primary key columns for our sample datasets (and, presumably, all datasets), as :type/Number instead of :type/Integer or :type/BigInteger, which was the only thing that middleware fn was considering before.

Copy link
Member

@camsaul camsaul left a comment

Choose a reason for hiding this comment

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

LGTM

@jeff303 jeff303 merged commit 74cd7dd into master Mar 31, 2021
@jeff303 jeff303 deleted the add-missing-test-assertions branch March 31, 2021 15:07
@jeff303 jeff303 added this to the 0.39 milestone Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants