-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: circular dependency between activities in pipeline
- Loading branch information
Showing
3 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ata_factory_testing_framework/exceptions/pipeline_activities_circular_dependency_error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class PipelineActivitiesCircularDependencyError(Exception): | ||
def __init__(self) -> None: | ||
"""Exception for circular dependencies in pipeline activities.""" | ||
super().__init__("Circular dependency detected in pipeline activities") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import pytest | ||
|
||
from data_factory_testing_framework import TestFramework | ||
from data_factory_testing_framework.exceptions.pipeline_activities_circular_dependency_error import ( | ||
PipelineActivitiesCircularDependencyError, | ||
) | ||
from data_factory_testing_framework.generated.data_factory_element import DataFactoryElement | ||
from data_factory_testing_framework.generated.models import ActivityDependency, PipelineResource, SetVariableActivity | ||
|
||
|
||
def test_circular_dependency_between_activities_should_throw_error() -> None: | ||
# Arrange | ||
test_framework = TestFramework() | ||
pipeline = PipelineResource( | ||
name="main", | ||
parameters={}, | ||
activities=[ | ||
SetVariableActivity( | ||
name="setVariable1", | ||
variable_name="variable", | ||
value=DataFactoryElement[str]("'1'"), | ||
depends_on=[ | ||
ActivityDependency( | ||
activity="setVariable2", | ||
dependency_conditions=["Succeeded"]), | ||
], | ||
), | ||
SetVariableActivity( | ||
name="setVariable2", | ||
variable_name="variable", | ||
value=DataFactoryElement[str]("'1'"), | ||
depends_on=[ | ||
ActivityDependency( | ||
activity="setVariable1", | ||
dependency_conditions=["Succeeded"]), | ||
], | ||
), | ||
], | ||
) | ||
test_framework.repository.pipelines.append(pipeline) | ||
|
||
# Act & Assert | ||
with pytest.raises(PipelineActivitiesCircularDependencyError): | ||
next(test_framework.evaluate_pipeline(pipeline, [])) |