Skip to content

Commit

Permalink
Implement TestDocsGenerateBigQuery test (#190)
Browse files Browse the repository at this point in the history
* Implement TestDocsGenerateBigQuery test

* Remove legacy docs_generate tests

* Add -vv to get info on failing test
  • Loading branch information
gshank authored May 23, 2022
1 parent 8240522 commit 69d1bf2
Show file tree
Hide file tree
Showing 31 changed files with 85 additions and 2,369 deletions.
62 changes: 62 additions & 0 deletions tests/functional/adapter/expected_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from dbt.tests.util import AnyString, AnyFloat


def bigquery_stats(is_table, partition=None, cluster=None):
stats = {}

if is_table:
stats.update(
{
"num_bytes": {
"id": "num_bytes",
"label": AnyString(),
"value": AnyFloat(),
"description": AnyString(),
"include": True,
},
"num_rows": {
"id": "num_rows",
"label": AnyString(),
"value": AnyFloat(),
"description": AnyString(),
"include": True,
},
}
)

if partition is not None:
stats.update(
{
"partitioning_type": {
"id": "partitioning_type",
"label": AnyString(),
"value": partition,
"description": AnyString(),
"include": True,
}
}
)

if cluster is not None:
stats.update(
{
"clustering_fields": {
"id": "clustering_fields",
"label": AnyString(),
"value": cluster,
"description": AnyString(),
"include": True,
}
}
)

has_stats = {
"id": "has_stats",
"label": "Has Stats?",
"value": bool(stats),
"description": "Indicates whether there are statistics for this table",
"include": False,
}
stats["has_stats"] = has_stats

return stats
23 changes: 22 additions & 1 deletion tests/functional/adapter/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from dbt.tests.adapter.basic.test_snapshot_timestamp import BaseSnapshotTimestamp
from dbt.tests.adapter.basic.test_adapter_methods import BaseAdapterMethod
from dbt.tests.adapter.basic.test_validate_connection import BaseValidateConnection
from dbt.tests.adapter.basic.test_docs_generate import BaseDocsGenerate
from dbt.tests.adapter.basic.expected_catalog import base_expected_catalog
from tests.functional.adapter.expected_stats import bigquery_stats


class TestSimpleMaterializationsBigQuery(BaseSimpleMaterializations):
Expand Down Expand Up @@ -53,8 +56,26 @@ class TestSnapshotCheckColsBigQuery(BaseSnapshotCheckCols):
class TestSnapshotTimestampBigQuery(BaseSnapshotTimestamp):
pass


class TestBaseAdapterMethodBigQuery(BaseAdapterMethod):
pass


class TestBigQueryValidateConnection(BaseValidateConnection):
pass
pass


class TestDocsGenerateBigQuery(BaseDocsGenerate):
@pytest.fixture(scope="class")
def expected_catalog(self, project):
return base_expected_catalog(
project,
role=None,
id_type="INT64",
text_type="STRING",
time_type="DATETIME",
view_type="view",
table_type="table",
model_stats=bigquery_stats(False),
seed_stats=bigquery_stats(True),
)

This file was deleted.

9 changes: 0 additions & 9 deletions tests/integration/docs_generate_tests/bq_models/clustered.sql

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions tests/integration/docs_generate_tests/bq_models/nested_table.sql

This file was deleted.

This file was deleted.

44 changes: 0 additions & 44 deletions tests/integration/docs_generate_tests/bq_models/schema.yml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions tests/integration/docs_generate_tests/cross_db_models/schema.yml

This file was deleted.

3 changes: 0 additions & 3 deletions tests/integration/docs_generate_tests/fail_macros/failure.sql

This file was deleted.

9 changes: 0 additions & 9 deletions tests/integration/docs_generate_tests/macros/dummy_test.sql

This file was deleted.

8 changes: 0 additions & 8 deletions tests/integration/docs_generate_tests/macros/macro.md

This file was deleted.

10 changes: 0 additions & 10 deletions tests/integration/docs_generate_tests/macros/schema.yml

This file was deleted.

8 changes: 0 additions & 8 deletions tests/integration/docs_generate_tests/models/model.sql

This file was deleted.

1 change: 0 additions & 1 deletion tests/integration/docs_generate_tests/models/readme.md

This file was deleted.

82 changes: 0 additions & 82 deletions tests/integration/docs_generate_tests/models/schema.yml

This file was deleted.

8 changes: 0 additions & 8 deletions tests/integration/docs_generate_tests/models/second_model.sql

This file was deleted.

31 changes: 0 additions & 31 deletions tests/integration/docs_generate_tests/ref_models/docs.md

This file was deleted.

Loading

0 comments on commit 69d1bf2

Please sign in to comment.