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

feat: Unit tests for dbt models #112

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

saraburns1
Copy link
Contributor

@saraburns1 saraburns1 commented Jul 25, 2024

Add unit tests for all models using a known good data set

Closes #102

notes:

  • default selector cannot exclude tests or else it excludes any models that have a test associated with them
  • default schema macro needed to be updated to use custom schema for seeds in order for our sources to work

@saraburns1 saraburns1 force-pushed the saraburns1_dbt_unittests branch 3 times, most recently from 3bcccf9 to fcc4d60 Compare July 26, 2024 15:16
@@ -3,6 +3,6 @@
-- or is followed by '/answer' or '/hint'
{% macro get_problem_id(object_id) %}
regexpExtract(
object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1
object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This regexp was not removing '/answer' from the end of the string which caused data to be excluded in subsequent queries

@saraburns1 saraburns1 force-pushed the saraburns1_dbt_unittests branch 2 times, most recently from 5fcb938 to decb470 Compare August 5, 2024 17:29
rows: |
select * from section_video_engagement_expected

# - name: test_subsection_video_engagement
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are having an issue I can't figure out right now but I wanted to get the rest of this code up for review

@saraburns1 saraburns1 marked this pull request as ready for review August 5, 2024 17:38
@saraburns1 saraburns1 changed the title WIP unit tests feat: Unit tests for dbt models Aug 5, 2024
.DS_Store Outdated Show resolved Hide resolved
models/base/sources.yml Outdated Show resolved Hide resolved
macros/source_for_test.sql Outdated Show resolved Hide resolved
models/courses/sources.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@Ian2012 Ian2012 left a comment

Choose a reason for hiding this comment

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

Just a couple of comments with the new sources and macros

Copy link
Contributor

@bmtcril bmtcril left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for all of the work on this!

@bmtcril bmtcril merged commit e231fab into openedx:main Aug 7, 2024
4 checks passed
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.

Add accuracy tests against a known-good dataset
3 participants