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

[CT-504] Intermittent test failure in 'selected_resource' test. #5088

Closed
gshank opened this issue Apr 18, 2022 · 4 comments
Closed

[CT-504] Intermittent test failure in 'selected_resource' test. #5088

gshank opened this issue Apr 18, 2022 · 4 comments
Labels
repo ci/cd Testing and continuous integration for dbt-core + adapter plugins tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality

Comments

@gshank
Copy link
Contributor

gshank commented Apr 18, 2022

Pull request #5001 added a selected resource feature for the context and a test. We are seeing intermittent failures with the error message:


16:08:01  Completed with 2 errors and 0 warnings:
16:08:01  
16:08:01  Compilation Error in model model2 (models/model2.sql)
16:08:01    dbt was unable to infer all dependencies for the model "model2".
16:08:01    This typically happens when ref() is placed within a conditional block.
16:08:01    
16:08:01    To fix this, add the following hint to the top of the model "model2":
16:08:01    
16:08:01    -- depends_on: {{ ref('model1') }}
16:08:01    
16:08:01    > in model model2 (models/model2.sql)
16:08:01    > called by model model2 (models/model2.sql)
16:08:01  
16:08:01  Compilation Error in snapshot cc_all_snapshot (snapshots/my_snapshot.sql)
16:08:01    dbt was unable to infer all dependencies for the model "cc_all_snapshot".
16:08:01    This typically happens when ref() is placed within a conditional block.
16:08:01    
16:08:01    To fix this, add the following hint to the top of the model "cc_all_snapshot":
16:08:01    
16:08:01    -- depends_on: {{ ref('model2') }}
16:08:01    
16:08:01    > in snapshot cc_all_snapshot (snapshots/my_snapshot.sql)
16:08:01    > called by snapshot cc_all_snapshot (snapshots/my_snapshot.sql)

Also having a whole separate file for it in core/dbt/selected_resource.py is kind of overkill. It should be in some other file. In addition we should try hard to implement it in a way that doesn't use a global file variable, because they are a bad idea in general (despite the fact that we have a number of them) and they all need to be reset for tests to run properly (and quite possibly any persistent server code).

@github-actions github-actions bot changed the title Intermittent test failure in 'selected_resource' test. [CT-504] Intermittent test failure in 'selected_resource' test. Apr 18, 2022
@jtcohen6 jtcohen6 added repo ci/cd Testing and continuous integration for dbt-core + adapter plugins tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality labels Apr 19, 2022
@iknox-fa
Copy link
Contributor

@gshank This came up in BLG today. We're going to point this with an AC of "make the intermittent errors stop" but not to avoid globals or change the code to live in another place. If you still feel strongly about those issues could you please open new tickets for them?

@leahwicz
Copy link
Contributor

Let's create a ticket for the refactor and then when the time comes we can weigh the refactor vs fixing the test

@leahwicz
Copy link
Contributor

@gshank could you close this out and open a new ticket with the work to make this not global anymore

@gshank
Copy link
Contributor Author

gshank commented Oct 5, 2022

Closing in favor of #6009

@gshank gshank closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repo ci/cd Testing and continuous integration for dbt-core + adapter plugins tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality
Projects
None yet
Development

No branches or pull requests

4 participants