2023-06-20 11:20:59 +05:30
|
|
|
from os import walk
|
2023-08-10 07:32:58 +02:00
|
|
|
from pathlib import Path
|
2023-06-20 11:20:59 +05:30
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
import yaml
|
|
|
|
|
|
|
|
from metadata.ingestion.api.parser import parse_workflow_config_gracefully
|
|
|
|
|
|
|
|
|
|
|
|
class TestWorkflowParse(TestCase):
|
|
|
|
"""
|
|
|
|
Test parsing scenarios of JSON Schemas
|
|
|
|
"""
|
|
|
|
|
|
|
|
def test_parse_workflow_config(self):
|
2023-09-06 11:30:33 +02:00
|
|
|
package_path = (
|
|
|
|
f"{Path(__file__).parent.parent.parent}/src/metadata/examples/workflows"
|
|
|
|
)
|
2023-06-20 11:20:59 +05:30
|
|
|
workflow_files = [files for _, _, files in walk(package_path)]
|
|
|
|
for yaml_file in workflow_files[0]:
|
|
|
|
with self.subTest(file_name=yaml_file):
|
|
|
|
with open(f"{package_path}/{yaml_file}", "r") as file:
|
|
|
|
file_content = file.read()
|
|
|
|
self.assertTrue(
|
|
|
|
parse_workflow_config_gracefully(yaml.safe_load(file_content))
|
|
|
|
)
|
|
|
|
file.close()
|