Skip to content

Commit

Permalink
Update type annotation for deserialized pipeline (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored Jan 22, 2024
1 parent 2f18b30 commit af978b5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions tests/pipeline/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_word_count(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "word-count-pipeline")

@pytest.mark.usefixtures("test_submodule")
Expand All @@ -60,5 +60,5 @@ def test_atm_fraud(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "atm-fraud-pipeline")
46 changes: 23 additions & 23 deletions tests/pipeline/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_load_pipeline(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)

snapshot.assert_match(enriched_pipeline, "test-pipeline")

Expand All @@ -56,7 +56,7 @@ def test_name_equal_prefix_name_concatenation(self):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)

assert enriched_pipeline[0]["prefix"] == "my-fake-prefix-"
assert enriched_pipeline[0]["name"] == "my-streams-app"
Expand All @@ -77,7 +77,7 @@ def test_pipelines_with_env_values(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_inflate_pipeline(self, snapshot: SnapshotTest):
Expand All @@ -94,7 +94,7 @@ def test_inflate_pipeline(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_substitute_in_component(self, snapshot: SnapshotTest):
Expand All @@ -111,7 +111,7 @@ def test_substitute_in_component(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[0]["prefix"] == "resources-component-type-substitution-"
)
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_kafka_connector_config_parsing(self):
],
catch_exceptions=False,
)
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
sink_connector = enriched_pipeline[0]
assert (
sink_connector["app"]["errors.deadletterqueue.topic.name"]
Expand All @@ -191,7 +191,7 @@ def test_no_input_topic(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_no_user_defined_components(self, snapshot: SnapshotTest):
Expand All @@ -208,7 +208,7 @@ def test_no_user_defined_components(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_kafka_connect_sink_weave_from_topics(self, snapshot: SnapshotTest):
Expand All @@ -226,7 +226,7 @@ def test_kafka_connect_sink_weave_from_topics(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_read_from_component(self, snapshot: SnapshotTest):
Expand All @@ -243,7 +243,7 @@ def test_read_from_component(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_with_env_defaults(self, snapshot: SnapshotTest):
Expand All @@ -262,7 +262,7 @@ def test_with_env_defaults(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_prefix_pipeline_component(self, snapshot: SnapshotTest):
Expand All @@ -282,7 +282,7 @@ def test_prefix_pipeline_component(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_with_custom_config_with_relative_defaults_path(
Expand All @@ -304,7 +304,7 @@ def test_with_custom_config_with_relative_defaults_path(

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
producer_details = enriched_pipeline[0]
output_topic = producer_details["app"]["streams"]["outputTopic"]
assert output_topic == "app1-test-topic"
Expand Down Expand Up @@ -347,7 +347,7 @@ def test_with_custom_config_with_absolute_defaults_path(

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
producer_details = enriched_pipeline[0]
output_topic = producer_details["app"]["streams"]["outputTopic"]
assert output_topic == "app1-test-topic"
Expand Down Expand Up @@ -378,7 +378,7 @@ def test_default_config(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
producer_details = enriched_pipeline[0]
output_topic = producer_details["app"]["streams"]["outputTopic"]
assert output_topic == "resources-custom-config-app1"
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_env_vars_precedence_over_config(self, monkeypatch: pytest.MonkeyPatch):
catch_exceptions=False,
)
assert result.exit_code == 0, result.stdout
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert enriched_pipeline[0]["app"]["streams"]["brokers"] == "env_broker"

def test_nested_config_env_vars(self, monkeypatch: pytest.MonkeyPatch):
Expand All @@ -428,7 +428,7 @@ def test_nested_config_env_vars(self, monkeypatch: pytest.MonkeyPatch):
catch_exceptions=False,
)
assert result.exit_code == 0, result.stdout
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[0]["app"]["streams"]["schemaRegistryUrl"]
== "http://somename:1234/"
Expand All @@ -452,7 +452,7 @@ def test_env_specific_config_env_def_in_env_var(
catch_exceptions=False,
)
assert result.exit_code == 0, result.stdout
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[0]["app"]["streams"]["schemaRegistryUrl"]
== "http://production:8081/"
Expand Down Expand Up @@ -488,7 +488,7 @@ def test_env_specific_config_env_def_in_cli(
catch_exceptions=False,
)
assert result.exit_code == 0, result.stdout
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[0]["app"]["streams"]["schemaRegistryUrl"] == expected_url
)
Expand Down Expand Up @@ -525,7 +525,7 @@ def test_model_serialization(self, snapshot: SnapshotTest):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
snapshot.assert_match(enriched_pipeline, "test-pipeline")

def test_dotenv_support(self):
Expand All @@ -547,7 +547,7 @@ def test_dotenv_support(self):
)
assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[1]["app"]["streams"]["schemaRegistryUrl"]
== "http://notlocalhost:8081/"
Expand All @@ -567,7 +567,7 @@ def test_short_topic_definition(self):

assert result.exit_code == 0, result.stdout

enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)

output_topics = enriched_pipeline[4]["to"]["topics"]
input_topics = enriched_pipeline[4]["from"]["topics"]
Expand Down Expand Up @@ -641,7 +641,7 @@ def test_temp_trim_release_name(self):
catch_exceptions=False,
)
assert result.exit_code == 0, result.stdout
enriched_pipeline: dict = yaml.safe_load(result.stdout)
enriched_pipeline: list = yaml.safe_load(result.stdout)
assert (
enriched_pipeline[0]["name"]
== "in-order-to-have-len-fifty-two-name-should-end--here"
Expand Down

0 comments on commit af978b5

Please sign in to comment.