forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No issue: Correct integration tests on MDFParser component (hashicorp…
…#144) * No issue: Correct integration tests on MDFParser component In this commit the integration tests of the MDFParser compoenent were correct. For the tests correction the following was done: * A refactor was done on the code responsible for loading the service configuration. This was done in order to abstract how the config was loading. Needed for testing Co-authored-by: Michael Krebs <michael.krebs@bosch.io>
- Loading branch information
1 parent
07c2595
commit 8fa6f9f
Showing
18 changed files
with
339 additions
and
261 deletions.
There are no files selected for viewing
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,23 @@ | ||
from dataclasses import dataclass, fields | ||
import yaml | ||
|
||
|
||
@dataclass | ||
class MdfParserConfig(): | ||
input_queue: str | ||
metadata_output_queue: str | ||
|
||
@staticmethod | ||
def load_config_from_yaml_file(path) -> 'MdfParserConfig': | ||
"""Loads yaml file into MdfParserConfig object. Extra yaml fields are ignored. | ||
Args: | ||
path (_type_): path of the yaml file containing the | ||
Returns: | ||
MdfParserConfig: MdfParserConfig object containing passed yaml config | ||
""" | ||
with open(path, 'r') as configfile: | ||
# We should ignore extra fields | ||
field_names = set([f.name for f in fields(MdfParserConfig)]) | ||
return MdfParserConfig(**{key: value for key, value in yaml.load(configfile, yaml.SafeLoader).items() if key in field_names}) |
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
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
"bucket": "bucket", | ||
"key": "tenant_recording_1659962815000_1659962819000_signals.json" | ||
} | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
MDFParser/src/tests/test_assets/MdfParserConfigs/config_extra_keys.yml
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,3 @@ | ||
input_queue: dev-terraform-queue-mdf-parser | ||
metadata_output_queue: dev-terraform-queue-metadata | ||
extra_metadata_output_queue: test |
2 changes: 2 additions & 0 deletions
2
MDFParser/src/tests/test_assets/MdfParserConfigs/config_good.yml
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,2 @@ | ||
input_queue: dev-terraform-queue-mdf-parser | ||
metadata_output_queue: dev-terraform-queue-metadata |
1 change: 1 addition & 0 deletions
1
MDFParser/src/tests/test_assets/MdfParserConfigs/config_missing_keys.yml
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 @@ | ||
input_queue: dev-terraform-queue-mdf-parser |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.