Skip to content

[Regression] unit test materialization #1333

@Thrasi

Description

@Thrasi

Is this a regression?

  • I believe this is a regression in functionality
  • I have searched the existing issues, and I could not find an existing issue for this regression

Which packages are affected?

  • dbt-adapters
  • dbt-tests-adapter
  • dbt-athena
  • dbt-athena-community
  • dbt-bigquery
  • dbt-postgres
  • dbt-redshift
  • dbt-snowflake
  • dbt-spark

Current Behavior

After upgrading to dbt-adapters==1.16.7
running unit tests fails:

$ dbt test --profiles-dir=profile --resource-type unit_test --select analytics_model
11:26:37  Running with dbt=1.10.11
11:26:38  Registered adapter: bigquery=1.10.2
...
11:26:20    Runtime Error in unit_test analytics_model (models/.../analytics_model.yml)
  An error occurred during execution of unit test 'analytics_model'. There may be an error in the unit test definition: check the data types.
   Compilation Error
    macro 'dbt_macro__get_expected_sql' takes not more than 2 argument(s)
    
    > in macro materialization_unit_default (macros/materializations/tests/unit.sql)
    > called by <Unknown>
11:26:20  
11:26:20  Done. PASS=1 WARN=0 ERROR=1 SKIP=0 NO-OP=0 TOTAL=2

Expected/Previous Behavior

It should pass, like it does when we use 1.16.6

Steps To Reproduce

  1. Use dbt-adapters==1.16.7
  2. Setup a model with a unit test:

analytics_model:

SELECT columnName AS columnName FROM {{ ref('analytics_source_model') }}

analytics_source_model:

SELECT 1 AS columnName
models:
- name: analytics_model
  config:
    materialized: table
  columns:
  - name: columnName
    description: name
    data_type: integer
unit_tests:
  - name: analytics_model
    model: analytics_model
    given:
      - input: ref("analytics_source_model")
        format: dict
        rows: 
          - {columnName: 1}
    expect:
      rows:
        - {columnName: 1}
  1. run the models and then unit tests:
$ dbt run -s 1+analytics_model
...
$ dbt test --resource-type unit_test --select analytics_model

Relevant log output

11:25:59  Running with dbt=1.10.11
11:26:00  Registered adapter: bigquery=1.10.2
11:26:01  Found 568 models, 11 analyses, 275 data tests, 16 seeds, 1 operation, 278 sources, 1771 macros, 47 groups, 14 unit tests
11:26:01  
11:26:01  Concurrency: 16 threads (target='dev')
11:26:01  
11:26:18  1 of 1 START unit_test analytics_model::analytics_model ........................ [RUN]
11:26:20  1 of 1 ERROR analytics_model::analytics_model .................................. [ERROR in 2.14s]
11:26:20  
11:26:20  Completed with 1 error, 0 partial successes, and 0 warnings:
11:26:20  
11:26:20  Failure in unit_test analytics_model (models/.../analytics_model.yml)
11:26:20    Runtime Error in unit_test analytics_model (models/.../analytics_model.yml)
  An error occurred during execution of unit test 'analytics_model'. There may be an error in the unit test definition: check the data types.
   Compilation Error
    macro 'dbt_macro__get_expected_sql' takes not more than 2 argument(s)
    
    > in macro materialization_unit_default (macros/materializations/tests/unit.sql)
    > called by <Unknown>

Environment

- OS: MacOS
- Python: 3.13.1
- dbt-adapters (working version): 1.16.6
- dbt-adapters (regression version): 1.16.7
- dbt-core (working version): 1.10.11
- dbt-core (regression version): 1.10.11
- dbt-bigquery (working version): 1.10.2
- dbt-bigquery (regression version): 1.10.2

Additional Context

The unit.sql file has been updated to take care of this on the main branch
However, on the stable branch it isn't up to date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage:productIn Product's queuetype:regressionSomething used to work and is no longer working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions