Skip to content

Commit

Permalink
feat: add synapse support
Browse files Browse the repository at this point in the history
  • Loading branch information
jayachithra committed Aug 26, 2024
1 parent 9c3b637 commit 5b73506
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 29 deletions.
4 changes: 1 addition & 3 deletions src/data_factory_testing_framework/_test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ def __init__(
self._repository = FabricRepositoryFactory().parse_from_folder(root_folder_path)
else:
self._repository = DataFactoryRepository([])
elif self._framework_type == TestFrameworkType.DataFactory:
elif self._framework_type == TestFrameworkType.DataFactory or self._framework_type == TestFrameworkType.Synapse:
if root_folder_path is not None:
self._repository = DataFactoryRepositoryFactory().parse_from_folder(root_folder_path)
else:
self._repository = DataFactoryRepository([])
elif self._framework_type == TestFrameworkType.Synapse:
raise NotImplementedError("Synapse test framework is not implemented yet.")

self._should_evaluate_child_pipelines = should_evaluate_child_pipelines

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from data_factory_testing_framework.exceptions import PipelineNotFoundError
from data_factory_testing_framework.state import RunParameter, RunParameterType


def test_execute_pipeline_activity_child_activities_executed(request: pytest.FixtureRequest) -> None:
@pytest.mark.parametrize(
"framework_type", [TestFrameworkType.DataFactory, TestFrameworkType.Synapse]
)
def test_execute_pipeline_activity_child_activities_executed(framework_type: str, request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.DataFactory,
framework_type=framework_type,
root_folder_path=request.fspath.dirname,
should_evaluate_child_pipelines=True,
)
Expand All @@ -32,13 +34,15 @@ def test_execute_pipeline_activity_child_activities_executed(request: pytest.Fix
with pytest.raises(StopIteration):
next(activities)


@pytest.mark.parametrize(
"framework_type", [TestFrameworkType.DataFactory, TestFrameworkType.Synapse]
)
def test_execute_pipeline_activity_evaluate_child_pipelines_child_pipeline_not_known_exception_thrown(
request: pytest.FixtureRequest,
framework_type: str, request: pytest.FixtureRequest,
) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.DataFactory,
framework_type=framework_type,
root_folder_path=request.fspath.dirname,
should_evaluate_child_pipelines=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
([-1, 3, 4], [-1, 3]),
],
)
def test_filter_activity(input_values: [], expected_filtered_values: [], request: pytest.FixtureRequest) -> None:
def test_filter_activity_pipeline_fabric(input_values: [], expected_filtered_values: [], request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.Fabric,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@
from data_factory_testing_framework.state import RunParameter, RunParameterType


@pytest.mark.parametrize(
"framework_type", [TestFrameworkType.DataFactory, TestFrameworkType.Synapse]
)
@pytest.mark.parametrize(
"on_value,expected_outcome",
[
("case_1", "case_1_hit"),
("case_2", "case_2_hit"),
("case_3", "default_hit"),
("case_4", "default_hit"),
("case_anything", "default_hit"),
],
[("case_1", "case_1_hit"), ("case_2", "case_2_hit")],
)
def test_switch_activity(on_value: str, expected_outcome: str, request: pytest.FixtureRequest) -> None:
def test_switch_activity(framework_type: str, on_value: str, expected_outcome: str, request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.Fabric,
framework_type=framework_type,
root_folder_path=request.fspath.dirname,
should_evaluate_child_pipelines=True,
)
pipeline = test_framework.get_pipeline_by_name("switchtest")
pipeline = test_framework.get_pipeline_by_name("switch-empty-default")

# Act
activities = test_framework.evaluate_pipeline(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@

@pytest.mark.parametrize(
"on_value,expected_outcome",
[("case_1", "case_1_hit"), ("case_2", "case_2_hit")],
[
("case_1", "case_1_hit"),
("case_2", "case_2_hit"),
("case_3", "default_hit"),
("case_4", "default_hit"),
("case_anything", "default_hit"),
],
)
def test_switch_activity(on_value: str, expected_outcome: str, request: pytest.FixtureRequest) -> None:
def test_switch_activity_pipeline_fabric(on_value: str, expected_outcome: str, request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.DataFactory,
framework_type=TestFrameworkType.Fabric,
root_folder_path=request.fspath.dirname,
should_evaluate_child_pipelines=True,
)
pipeline = test_framework.get_pipeline_by_name("switch-empty-default")
pipeline = test_framework.get_pipeline_by_name("switchtest")

# Act
activities = test_framework.evaluate_pipeline(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
from data_factory_testing_framework import TestFramework, TestFrameworkType


def test_string_default_variables(request: pytest.FixtureRequest) -> None:
@pytest.mark.parametrize(
"framework_type", [TestFrameworkType.DataFactory, TestFrameworkType.Synapse]
)
def test_string_default_variables(framework_type: str, request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.DataFactory, root_folder_path=request.fspath.dirname
framework_type=framework_type, root_folder_path=request.fspath.dirname
)
pipeline = test_framework.get_pipeline_by_name("default_variables")

Expand Down
8 changes: 5 additions & 3 deletions tests/functional/xml/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import pytest
from data_factory_testing_framework import TestFramework, TestFrameworkType


def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None:
@pytest.mark.parametrize(
"framework_type",[TestFrameworkType.DataFactory, TestFrameworkType.Synapse]
)
def test_batch_job_pipeline(framework_type: str, request: pytest.FixtureRequest) -> None:
# Arrange
test_framework = TestFramework(
framework_type=TestFrameworkType.DataFactory, root_folder_path=request.fspath.dirname
framework_type=framework_type, root_folder_path=request.fspath.dirname
)
pipeline = test_framework.get_pipeline_by_name("xpath_example_08_a")

Expand Down

0 comments on commit 5b73506

Please sign in to comment.