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

[ALT] Ensure unit test models can depend on external nodes #9367

Conversation

QMalcolm
Copy link
Contributor

@QMalcolm QMalcolm commented Jan 12, 2024

resolves #8944

Problem

Solution

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

@QMalcolm QMalcolm added the Skip Changelog Skips GHA to check for changelog file label Jan 12, 2024
@cla-bot cla-bot bot added the cla:yes label Jan 12, 2024
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0da5dfe) 86.93% compared to head (020a9ec) 86.94%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9367   +/-   ##
=======================================
  Coverage   86.93%   86.94%           
=======================================
  Files         187      187           
  Lines       24954    24954           
=======================================
+ Hits        21695    21696    +1     
+ Misses       3259     3258    -1     
Flag Coverage Δ
integration 84.32% <100.00%> (+<0.01%) ⬆️
unit 63.24% <0.00%> (ø)

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.

@QMalcolm QMalcolm force-pushed the qmalcolm--8944-unit-test-models-dependent-on-external-nodes-alt branch 2 times, most recently from 1935d03 to 55611b1 Compare January 16, 2024 18:33
Base automatically changed from unit_testing_feature_branch to main January 16, 2024 22:37
… postgres max

Was getting test failures due to resulting lengthy model names being created
by unit test task in the functional test
…package of unit test

This is necessary because when we create the shadow manifest for the running
the unit test node, the included models whether direct or external, get rewritten
as being in the unit test's package.
…external node point to it

Previously I was getting an error about the columns for the external model
not being fetchable from the database via the macro `get_columns_in_relation`.
By creating a seed for the tests, which creates a table in postgres, we can then
tell the external model that it's database schema and identifier (the relation)
is that table from the seed without make the seed an actual dependency of the
external model in the dag.
External nodes generally don't have paths, but in unit tests we write out
all models to sql files (as this allows us to test them). Thus external
nodes need to have their paths set.
This is necessary because when executing a unit tests, the columns
associated with a model in the database are retrieved. For this to
be possible, the model must exist in the database, thus we must
run the associated models at least once first.
@QMalcolm QMalcolm force-pushed the qmalcolm--8944-unit-test-models-dependent-on-external-nodes-alt branch from 55611b1 to 020a9ec Compare January 18, 2024 18:35
@QMalcolm QMalcolm changed the title Qmalcolm 8944 unit test models dependent on external nodes alt [ALT] Ensure unit test models can depend on external nodes Jan 18, 2024
@QMalcolm
Copy link
Contributor Author

Closed in favor of #9343

@QMalcolm QMalcolm closed this Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3291] [Feature] unit test models that depend on external nodes
1 participant