Skip to content

Commit

Permalink
Feature/functional tests 1.3.0 (#61)
Browse files Browse the repository at this point in the history
* inherited more tests for v1.3

* tests naming fix, xFail to some tests added

* version bump & poetry update

---------

Co-authored-by: ilikutle <ilija.kutle@alligator-company.com>
Co-authored-by: Torsten Glunde <torsten.glunde@alligator-company.com>
  • Loading branch information
3 people authored Apr 3, 2023
1 parent 95d986d commit 670fa33
Show file tree
Hide file tree
Showing 7 changed files with 956 additions and 923 deletions.
1,727 changes: 855 additions & 872 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbt-exasol"
version = "1.2.2"
version = "1.3.0"
description = "Adapter to dbt-core for warehouse Exasol"
authors = ["Torsten Glunde <torsten.glunde@alligator-company.com>", "Ilija Kutle <ilija.kutle@alligator-company.com>"]
homepage = "https://alligatorcompany.gitlab.io/dbt-exasol"
Expand All @@ -15,9 +15,9 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.7.2, <4"
dbt-core = "^1.2, <1.3"
dbt-core = "^1.3, <1.4"
pyexasol = "^0.25.0"
dbt-tests-adapter = "^1.2, <1.3"
dbt-tests-adapter = "^1.3, <1.4"

[tool.poetry.dev-dependencies]
black = "^22.8.0"
Expand All @@ -26,7 +26,7 @@ pytest-dotenv = "^0.5.2"
tox = "^3.26.0"

[tool.poetry.group.dev.dependencies]
dbt-tests-adapter = "^1.2.1"
dbt-tests-adapter = "^1.3.2"
pylint = "^2.15.8"

[build-system]
Expand Down
9 changes: 6 additions & 3 deletions tests/functional/adapter/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dbt.tests.adapter.basic.test_empty import BaseEmpty
from dbt.tests.adapter.basic.test_ephemeral import BaseEphemeral
from dbt.tests.adapter.basic.test_generic_tests import BaseGenericTests
from dbt.tests.adapter.basic.test_incremental import BaseIncremental
from dbt.tests.adapter.basic.test_incremental import BaseIncremental, BaseIncrementalNotSchemaChange
from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests
from dbt.tests.adapter.basic.test_singular_tests_ephemeral import (
BaseSingularTestsEphemeral,
Expand Down Expand Up @@ -52,7 +52,7 @@ class TestSnapshotTimestampExasol(BaseSnapshotTimestamp):
pass


class TestBaseAdapterMethod(BaseAdapterMethod):
class TestBaseAdapterMethodExasol(BaseAdapterMethod):
pass


Expand Down Expand Up @@ -88,4 +88,7 @@ def dbt_profile_target(self):
"pass": os.getenv('DBT_PASS',"exasol"),
"dbname": "DB",
"timestamp_format": "YYYY-MM-DD HH:MI:SS.FF6"
}
}

class TestBaseIncrementalNotSchemaChangeExasol(BaseIncrementalNotSchemaChange):
pass
31 changes: 31 additions & 0 deletions tests/functional/adapter/test_concurrency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest
from pathlib import Path
from dbt.tests.util import (
run_dbt,
check_relations_equal,
rm_file,
write_file
)
from dbt.tests.adapter.concurrency.test_concurrency import (
BaseConcurrency,
seeds__update_csv
)

class TestConcurrencyExasol(BaseConcurrency):
def test_conncurrency_snowflake(self, project):
run_dbt(["seed", "--select", "seed"])
results = run_dbt(["run"], expect_pass=False)
assert len(results) == 7
check_relations_equal(project.adapter, ["SEED", "VIEW_MODEL"])
check_relations_equal(project.adapter, ["SEED", "DEP"])
check_relations_equal(project.adapter, ["SEED", "TABLE_A"])
check_relations_equal(project.adapter, ["SEED", "TABLE_B"])

rm_file(project.project_root, "seeds", "seed.csv")
write_file(seeds__update_csv, project.project_root + '/seeds', "seed.csv")
results = run_dbt(["run"], expect_pass=False)
assert len(results) == 7
check_relations_equal(project.adapter, ["SEED", "VIEW_MODEL"])
check_relations_equal(project.adapter, ["SEED", "DEP"])
check_relations_equal(project.adapter, ["SEED", "TABLE_A"])
check_relations_equal(project.adapter, ["SEED", "TABLE_B"])
11 changes: 11 additions & 0 deletions tests/functional/adapter/test_ephemeral.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pytest
from dbt.tests.adapter.ephemeral.test_ephemeral import BaseEphemeralMulti
from dbt.tests.util import run_dbt, check_relations_equal

class TestEphemeralMultiExasol(BaseEphemeralMulti):

def test_ephemeral_multi_snowflake(self, project):
run_dbt(["seed"])
results = run_dbt(["run"])
assert len(results) == 3
check_relations_equal(project.adapter, ["SEED", "DEPENDENT", "DOUBLE_DEPENDENT", "SUPER_DEPENDENT"])
19 changes: 10 additions & 9 deletions tests/functional/adapter/utils/data_types/test_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,31 @@
from dbt.tests.adapter.utils.data_types.test_type_string import BaseTypeString
from dbt.tests.adapter.utils.data_types.test_type_timestamp import BaseTypeTimestamp
from test_type_bigint import BaseTypeBigInt
#from dbt.tests.adapter.utils.data_types.test_type_boolean import BaseTypeBoolean
from dbt.tests.adapter.utils.data_types.test_type_boolean import BaseTypeBoolean


class TestTypeBigInt(BaseTypeBigInt):

class TestTypeBigIntExasol(BaseTypeBigInt):
pass


class TestTypeFloat(BaseTypeFloat):
class TestTypeFloatExasol(BaseTypeFloat):
pass


class TestTypeInt(BaseTypeInt):
class TestTypeIntExasol(BaseTypeInt):
pass


class TestTypeNumeric(BaseTypeNumeric):
class TestTypeNumericExasol(BaseTypeNumeric):
pass


class TestTypeString(BaseTypeString):
class TestTypeStringExasol(BaseTypeString):
pass


class TestTypeTimestamp(BaseTypeTimestamp):
class TestTypeTimestampExasol(BaseTypeTimestamp):
@pytest.fixture(scope="class")
def dbt_profile_target(self):
return {
Expand All @@ -43,5 +44,5 @@ def dbt_profile_target(self):
}


#class TestTypeBoolean(BaseTypeBoolean):
# pass
class TestTypeBooleanExasol(BaseTypeBoolean):
pass
74 changes: 39 additions & 35 deletions tests/functional/adapter/utils/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import os

import pytest
from utils_fixtures import *
from dbt.exceptions import CompilationException
from dbt.tests.adapter.utils.base_utils import BaseUtils

# from dbt.tests.adapter.utils.test_array_append import BaseArrayAppend
# from dbt.tests.adapter.utils.test_array_concat import BaseArrayConcat
# from dbt.tests.adapter.utils.test_array_construct import BaseArrayConstruct
from dbt.tests.adapter.utils.test_array_append import BaseArrayAppend
from dbt.tests.adapter.utils.test_array_concat import BaseArrayConcat
from dbt.tests.adapter.utils.test_array_construct import BaseArrayConstruct
from dbt.tests.adapter.utils.test_any_value import BaseAnyValue
from dbt.tests.adapter.utils.test_bool_or import BaseBoolOr
from dbt.tests.adapter.utils.test_cast_bool_to_text import BaseCastBoolToText
from dbt.tests.adapter.utils.test_concat import BaseConcat
from dbt.tests.adapter.utils.test_date_trunc import BaseDateTrunc

# from dbt.tests.adapter.utils.test_current_timestamp import BaseCurrentTimestampAware
from dbt.tests.adapter.utils.test_current_timestamp import BaseCurrentTimestampNaive
from dbt.tests.adapter.utils.test_dateadd import BaseDateAdd
from dbt.tests.adapter.utils.test_datediff import BaseDateDiff
from dbt.tests.adapter.utils.test_escape_single_quotes import (
Expand All @@ -33,10 +34,9 @@
from dbt.tests.adapter.utils.test_split_part import BaseSplitPart
from dbt.tests.adapter.utils.test_string_literal import BaseStringLiteral
from dbt.tests.util import run_dbt
from utils_fixtures import *


class TestAnyValue(BaseAnyValue):
class TestAnyValueExasol(BaseAnyValue):
@pytest.fixture(scope="class")
def models(self):
return {
Expand All @@ -46,20 +46,23 @@ def models(self):
),
}

@pytest.mark.xfail
class TestArrayAppendExasol(BaseArrayAppend):
pass

# class TestArrayAppend(BaseArrayAppend):
# pass

@pytest.mark.xfail
class TestArrayConcatExasol(BaseArrayConcat):
pass

# class TestArrayConcat(BaseArrayConcat):
# pass

@pytest.mark.xfail
class TestArrayConstructExasol(BaseArrayConstruct):
pass

# class TestArrayConstruct(BaseArrayConstruct):
# pass


class TestBoolOr(BaseBoolOr):
class TestBoolOrExasol(BaseBoolOr):
@pytest.fixture(scope="class")
def seeds(self):
return {
Expand All @@ -77,7 +80,7 @@ def models(self):
}


class TestCastBoolToText(BaseCastBoolToText):
class TestCastBoolToTextExasol(BaseCastBoolToText):
@pytest.fixture(scope="class")
def models(self):
return {
Expand All @@ -88,7 +91,7 @@ def models(self):
}


class TestConcat(BaseConcat):
class TestConcatExasol(BaseConcat):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_concat.csv": exasol__seeds__data_concat_csv}
Expand All @@ -104,11 +107,12 @@ def models(self):


# Use either BaseCurrentTimestampAware or BaseCurrentTimestampNaive but not both
# class TestCurrentTimestamp(BaseCurrentTimestampAware):
# pass
@pytest.mark.xfail
class TestCurrentTimestampExasol(BaseCurrentTimestampNaive):
pass


class TestDateAdd(BaseDateAdd):
class TestDateAddExasol(BaseDateAdd):
@pytest.fixture(scope="class")
def project_config_update(self):
return {
Expand All @@ -120,7 +124,7 @@ def project_config_update(self):
"data_dateadd": {
"+column_types": {
"from_time": "timestamp",
"result": "timestamp",
"res": "timestamp",
},
},
},
Expand All @@ -141,7 +145,7 @@ def models(self):
}


class TestDateDiff(BaseDateDiff):
class TestDateDiffExasol(BaseDateDiff):
@pytest.fixture(scope="class")
def dbt_profile_target(self):
return {
Expand All @@ -168,7 +172,7 @@ def models(self):
}


class TestDateTrunc(BaseDateTrunc):
class TestDateTruncExasol(BaseDateTrunc):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_date_trunc.csv": exasol__seeds__data_date_trunc_csv}
Expand All @@ -183,7 +187,7 @@ def models(self):
}


class TestEscapeSingleQuotes(BaseEscapeSingleQuotesBackslash):
class TestEscapeSingleQuotesExasol(BaseEscapeSingleQuotesBackslash):
@pytest.fixture(scope="class")
def models(self):
return {
Expand All @@ -195,7 +199,7 @@ def models(self):
}


class BaseEscapeSingleQuotesBackslash(BaseUtils):
class BaseEscapeSingleQuotesBackslashExasol(BaseUtils):
@pytest.fixture(scope="class")
def models(self):
return {
Expand All @@ -207,11 +211,11 @@ def models(self):
}


class TestExcept(BaseExcept):
class TestExceptExasol(BaseExcept):
pass


class TestHash(BaseHash):
class TestHashExasol(BaseHash):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_hash.csv": exasol__seeds__data_hash_csv}
Expand All @@ -226,11 +230,11 @@ def models(self):
}


class TestIntersect(BaseIntersect):
class TestIntersectExasol(BaseIntersect):
pass


class TestLastDay(BaseLastDay):
class TestLastDayExasol(BaseLastDay):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_last_day.csv": exasol__seeds__data_last_day_csv}
Expand All @@ -245,7 +249,7 @@ def models(self):
}


class TestLength(BaseLength):
class TestLengthExasol(BaseLength):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_length.csv": exasol__seeds__data_length_csv}
Expand All @@ -260,7 +264,7 @@ def models(self):
}


class TestListagg(BaseListagg):
class TestListaggExasol(BaseListagg):
@pytest.fixture(scope="class")
def seeds(self):
return {
Expand All @@ -283,7 +287,7 @@ def test_build_assert_equal(self, project):
assert exc_info.value.msg == "`limit_num` parameter is not supported on Exasol!"


class TestPosition(BasePosition):
class TestPositionExasol(BasePosition):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_position.csv": exasol__seeds__data_position_csv}
Expand All @@ -298,7 +302,7 @@ def models(self):
}


class TestReplace(BaseReplace):
class TestReplaceExasol(BaseReplace):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_replace.csv": exasol__seeds__data_replace_csv}
Expand All @@ -313,7 +317,7 @@ def models(self):
}


class TestRight(BaseRight):
class TestRightExasol(BaseRight):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_right.csv": exasol__seeds__data_right_csv}
Expand All @@ -328,7 +332,7 @@ def models(self):
}


class TestSafeCast(BaseSafeCast):
class TestSafeCastExasol(BaseSafeCast):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_safe_cast.csv": exasol__seeds__data_safe_cast_csv}
Expand All @@ -346,7 +350,7 @@ def models(self):
}


class TestSplitPart(BaseSplitPart):
class TestSplitPartExasol(BaseSplitPart):
@pytest.fixture(scope="class")
def seeds(self):
return {"data_split_part.csv": exasol__seeds__data_split_part_csv}
Expand All @@ -366,5 +370,5 @@ def test_build_assert_equal(self, project):
assert exc_info.value.msg == "Unsupported on Exasol! Sorry..."


class TestStringLiteral(BaseStringLiteral):
class TestStringLiteralExasol(BaseStringLiteral):
pass

0 comments on commit 670fa33

Please sign in to comment.