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

Support longer unit test names + improve error handling in unit test construction #9396

Merged
merged 6 commits into from
Jan 18, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Jan 17, 2024

resolves #9015

Problem

On Postgres, even modestly long test names (~20 characters) were hitting the "Relation name '{}' is longer than 63 characters" during construction of the 'actual' unit test result.

This is because we were creating model names and unique_ids in the unit test manifest out of the concatenation of the original model name, test name, and model being tested name to prevent key collision in the unit test manifest.

Solution

Now that we are creating a unit test manifest per unit test definition, there is no risk of key collisions if we just use the model name! This PR propagates those changes through and adds tests to ensure expected behaviour when:

  • there are duplicate test names within a model (error)
  • there are duplicate test names across models (pass, selection tested as well)
  • a generally "invalid" test configuration (e.g. wrong data type in given input)
  • right-size (pass) or long (fail, with handled exception) on postgres

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label Jan 17, 2024
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (321031c) 86.98% compared to head (0ca8270) 86.93%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9396      +/-   ##
==========================================
- Coverage   86.98%   86.93%   -0.05%     
==========================================
  Files         187      187              
  Lines       24947    24954       +7     
==========================================
- Hits        21699    21694       -5     
- Misses       3248     3260      +12     
Flag Coverage Δ
integration 84.31% <100.00%> (-0.12%) ⬇️
unit 63.24% <26.66%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichelleArk MichelleArk changed the title Longer unit test names2 Support longer unit test names + improve error handling in unit test construction Jan 17, 2024
@MichelleArk MichelleArk mentioned this pull request Jan 17, 2024
5 tasks
@MichelleArk MichelleArk marked this pull request as ready for review January 17, 2024 16:12
@MichelleArk MichelleArk requested review from a team as code owners January 17, 2024 16:12
@MichelleArk MichelleArk requested a review from emmyoop January 17, 2024 16:12
@MichelleArk MichelleArk requested a review from gshank January 17, 2024 18:47
@MichelleArk MichelleArk merged commit 0da5dfe into main Jan 18, 2024
51 checks passed
@MichelleArk MichelleArk deleted the longer-unit-test-names2 branch January 18, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3329] [Bug] Unit testing errors with long CTE name given reasonable test name length
2 participants