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 2911 initial unit testing #8288

Closed
wants to merge 12 commits into from
Closed

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Aug 2, 2023

resolves #8287

Problem

First cut of unit testing implementation. This will contain only minimal functionality, and will provide the base for a feature branch. This should include a new functional test directory and a few functional tests.

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

gshank added 2 commits July 25, 2023 14:36
commit 88eb4d6
Author: Gerda Shank <gerda@dbtlabs.com>
Date:   Thu Jul 20 13:25:49 2023 -0400

    add @defer_state to unit-test in core/dbt/cli/main.py

commit 1336104
Author: Gerda Shank <gerda@dbtlabs.com>
Date:   Thu Jul 20 11:24:32 2023 -0400

    kludge to make mypy happy about parse_from_dict

commit 2b264b2
Merge: 4dc6dd3 eeb0570
Author: Gerda Shank <gerda@dbtlabs.com>
Date:   Thu Jul 20 11:04:00 2023 -0400

    Merge branch 'main' into arky/poc-unit-testing

commit 4dc6dd3
Author: Chenyu Li <chenyu.li@dbtlabs.com>
Date:   Sat May 6 13:15:05 2023 -0700

    copy nodes being referenced over

commit e203efa
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Tue May 9 10:11:22 2023 -0400

    postgres fix

commit 05bd06f
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 02:38:26 2023 -0400

    null input values

commit e56538d
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 02:18:17 2023 -0400

    override jinja context properties

commit 43ba24f
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 02:07:35 2023 -0400

    hacky lineage between unit tests

commit 8d586d0
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 01:12:17 2023 -0400

    fix tests

commit 19793eb
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 00:20:17 2023 -0400

    fix --output json

commit 4cf4710
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 00:10:52 2023 -0400

    remove manifest.add_unit_test

commit 58aa0bd
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 00:06:39 2023 -0400

    undo test_type:unit selector

commit f8ce09c
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Mon May 8 00:02:51 2023 -0400

    jinja refactoring

commit 2c30116
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Sun May 7 23:35:07 2023 -0400

    more decoupling of unit test from other parsing/execution + overrides support

commit ccc3ad3
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Fri May 5 23:14:10 2023 -0400

    fix manifest artifact

commit 2c953b2
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Fri May 5 23:12:11 2023 -0400

    move parsing to UnitTestManifestLoader + requires

commit 2184a4d
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Wed May 3 10:33:30 2023 -0400

    better type handling

commit f8bdd8b
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Sun Apr 30 22:00:52 2023 -0400

    dbt.string_literal

commit 8043106
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Sun Apr 30 21:50:57 2023 -0400

    polish up spec, get column schema from relation

commit 0ab9222
Author: Michelle Ark <michelle.ark@dbtlabs.com>
Date:   Sun Apr 30 14:19:50 2023 -0400

    first pass
@gshank gshank requested review from a team as code owners August 2, 2023 18:18
@gshank gshank requested review from ashnm, nathaniel-may and emmyoop and removed request for a team August 2, 2023 18:18
@cla-bot cla-bot bot added the cla:yes label Aug 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #8288 (ed8d9db) into main (b7aee3f) will increase coverage by 0.06%.
The diff coverage is 94.78%.

@@            Coverage Diff             @@
##             main    #8288      +/-   ##
==========================================
+ Coverage   86.29%   86.36%   +0.06%     
==========================================
  Files         174      176       +2     
  Lines       25529    25864     +335     
==========================================
+ Hits        22030    22337     +307     
- Misses       3499     3527      +28     
Flag Coverage Δ
integration 83.16% <94.78%> (+0.04%) ⬆️
unit 64.92% <46.66%> (-0.26%) ⬇️

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

Files Changed Coverage Δ
core/dbt/cli/flags.py 92.10% <ø> (ø)
core/dbt/contracts/graph/model_config.py 93.81% <ø> (ø)
core/dbt/parser/schemas.py 92.53% <66.66%> (-0.22%) ⬇️
core/dbt/contracts/graph/nodes.py 94.45% <83.33%> (-0.05%) ⬇️
core/dbt/parser/unit_tests.py 91.66% <91.66%> (ø)
core/dbt/cli/requires.py 94.19% <92.30%> (-0.18%) ⬇️
core/dbt/task/unit_test.py 94.68% <94.68%> (ø)
...ore/dbt/adapters/relation_configs/config_change.py 94.11% <100.00%> (ø)
core/dbt/cli/main.py 98.76% <100.00%> (+0.07%) ⬆️
core/dbt/cli/types.py 93.75% <100.00%> (+0.20%) ⬆️
... and 8 more

... and 4 files with indirect coverage changes

@gshank gshank requested review from MichelleArk and removed request for ashnm and nathaniel-may August 4, 2023 19:29
@@ -44,6 +44,9 @@
{
"$ref": "#/definitions/SnapshotNode"
},
{
"$ref": "#/definitions/UnitTestNode"
Copy link
Contributor

Choose a reason for hiding this comment

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

let's cut a manifest v11 for these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm updating to v11 manifest in another branch, because there's no point in doing that in multiple places. Will update to create a modified v11 once that's merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the updates to the v9 manifest json schema. I decided to leave the v11 manifest without changes from this branch, because it doesn't look like they're actually needed at this point and we are probably going to not include UnitTestNodes in the current manifest definition, so might not be needed in the end anyway.

@gshank gshank requested a review from MichelleArk August 11, 2023 22:27
@gshank
Copy link
Contributor Author

gshank commented Aug 14, 2023

I've squashed this into "unit_testing_feature_branch", so this pull request will not need to be merged separately.

@gshank gshank closed this Aug 14, 2023
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-2915] Update unit testing POC branch for merging
2 participants