mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-04 04:29:13 +00:00 
			
		
		
		
	
		
			
	
	
		
			38 lines
		
	
	
		
			940 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			940 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								import sys
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import pytest
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								from metadata.generated.schema.entity.data.topic import Topic
							 | 
						||
| 
								 | 
							
								from metadata.workflow.metadata import MetadataWorkflow
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if not sys.version_info >= (3, 9):
							 | 
						||
| 
								 | 
							
								    pytest.skip("requires python 3.9+", allow_module_level=True)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def test_ingest_metadata(
							 | 
						||
| 
								 | 
							
								    patch_passwords_for_db_services, run_workflow, ingestion_config, metadata_assertions
							 | 
						||
| 
								 | 
							
								):
							 | 
						||
| 
								 | 
							
								    run_workflow(MetadataWorkflow, ingestion_config)
							 | 
						||
| 
								 | 
							
								    metadata_assertions()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@pytest.fixture(
							 | 
						||
| 
								 | 
							
								    scope="module",
							 | 
						||
| 
								 | 
							
								    params=[
							 | 
						||
| 
								 | 
							
								        "customers-100",
							 | 
						||
| 
								 | 
							
								        "organizations-100",
							 | 
						||
| 
								 | 
							
								        "people-100",
							 | 
						||
| 
								 | 
							
								    ],
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								def metadata_assertions(metadata, db_service, request):
							 | 
						||
| 
								 | 
							
								    def _assertions():
							 | 
						||
| 
								 | 
							
								        topic: Topic = metadata.get_by_name(
							 | 
						||
| 
								 | 
							
								            entity=Topic,
							 | 
						||
| 
								 | 
							
								            fqn=f"{db_service.fullyQualifiedName.root}.{request.param}",
							 | 
						||
| 
								 | 
							
								            fields=["*"],
							 | 
						||
| 
								 | 
							
								            nullable=False,
							 | 
						||
| 
								 | 
							
								        )
							 | 
						||
| 
								 | 
							
								        assert topic.messageSchema is not None
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return _assertions
							 |