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

Docs site does not support unit tests #506

Closed
Tracked by #8283
dave-connors-3 opened this issue Apr 15, 2024 · 3 comments · Fixed by #508
Closed
Tracked by #8283

Docs site does not support unit tests #506

dave-connors-3 opened this issue Apr 15, 2024 · 3 comments · Fixed by #508
Assignees
Labels
bug Something isn't working pre-release regression unit tests Issues related to built-in dbt unit testing functionality
Milestone

Comments

@dave-connors-3
Copy link

Describe the bug

Adding a unit test to a project and running the docs site

  • does not show a page for the unit test
  • breaks the dag

Steps To Reproduce

  1. install dbt-core + adapter >= 1.8.0
  2. add a valid unit test to your project
  3. dbt docs generate && dbt docs serve

Expected behavior

  1. i see details about the unit test
  2. i see a working DAG

Screenshots and log output

No unit test:

image

Broken DAG:

image

The output of dbt --version:
image

@dave-connors-3 dave-connors-3 added bug Something isn't working triage labels Apr 15, 2024
@dbeatty10
Copy link
Contributor

Thanks for reporting this @dave-connors-3 !

This looks similar to #486. If you use Chrome, can you see errors in the Console similar to this?

TypeError: Cannot read properties of undefined (reading 'resource_type')
TypeError: Cannot read properties of undefined (reading 'length')
image

@dbeatty10 dbeatty10 self-assigned this Apr 15, 2024
@dbeatty10 dbeatty10 removed the triage label Apr 15, 2024
@dbeatty10 dbeatty10 removed their assignment Apr 15, 2024
@dbeatty10
Copy link
Contributor

dbeatty10 commented Apr 15, 2024

Reprex

models/my_test_model.sql

select 1 as id

models/_unit.yml

unit_tests:

  - name: my_unit_test
    given: []
    model: my_test_model
    expect:
      rows:
        - {id: 1}
dbt docs generate
dbt docs serve

Here's the error messages I got:

(index):79 Can not create edge `c18ac92f-a89a-4bc6-8138-8d53a8dc65e1` with nonexistant target `unit_test.my_project.my_test_model.my_unit_test`
error @ (index):79


(index):79 console.trace
error       @ (index):79
u.restore   @ (index):84
c           @ (index):84
add         @ (index):91
(anonymous) @ (index):79
$digest     @ (index):73
$apply      @ (index):73
(anonymous) @ (index):73
A           @ (index):73
b.onload    @ (index):73

(index):73 TypeError: Cannot read properties of undefined (reading 'data')
    at (index):93:333453
    at Module.$t ((index):27:73384)
    at Object.selectNodes ((index):93:333420)
    at Object.selectNodes ((index):93:331596)
    at h ((index):93:324578)
    at p.showFullGraph ((index):93:326710)
    at t.showExpanded ((index):79:27600)
    at t.onLauncherClick ((index):79:28516)
    at fn (eval at compile ((index):47:106042), <anonymous>:4:165)
    at i ((index):73:151833)
(anonymous) @ (index):73
image

@graciegoheen
Copy link

graciegoheen commented Apr 24, 2024

Based on the error, it's possible that we're not populating the catalog or manifest appropriately. We had a fix awhile back around re-parsing when a fixture is changed, that could have affected this. It can't find the key and attempts to access an attribute on undefined following that.

This may actually be a fix in dbt-core, not in dbt-docs.

aranke added a commit that referenced this issue May 1, 2024
aranke added a commit that referenced this issue May 1, 2024
@dbeatty10 dbeatty10 added the unit tests Issues related to built-in dbt unit testing functionality label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pre-release regression unit tests Issues related to built-in dbt unit testing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants