Skip to content

Commit

Permalink
supply a source id for schema discovery in connector integration tests (
Browse files Browse the repository at this point in the history
#17662)

* supply a source id for schema discovery in connector integration tests

* fix pmd issues
  • Loading branch information
mfsiega-airbyte committed Oct 6, 2022
1 parent 00d1f0d commit e521fff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public abstract class AbstractSourceConnectorTest {
private static final String JOB_ID = String.valueOf(0L);
private static final int JOB_ATTEMPT = 0;

private static final UUID SOURCE_ID = UUID.randomUUID();

private static final String CPU_REQUEST_FIELD_NAME = "cpuRequest";
private static final String CPU_LIMIT_FIELD_NAME = "cpuLimit";
private static final String MEMORY_REQUEST_FIELD_NAME = "memoryRequest";
Expand Down Expand Up @@ -162,7 +164,8 @@ protected UUID runDiscover() throws Exception {
final UUID toReturn = new DefaultDiscoverCatalogWorker(
mConfigRepository,
new AirbyteIntegrationLauncher(JOB_ID, JOB_ATTEMPT, getImageName(), processFactory, workerConfigs.getResourceRequirements()))
.run(new StandardDiscoverCatalogInput().withConnectionConfiguration(getConfig()), jobRoot).getDiscoverCatalogId();
.run(new StandardDiscoverCatalogInput().withSourceId(SOURCE_ID.toString()).withConnectionConfiguration(getConfig()), jobRoot)
.getDiscoverCatalogId();
verify(mConfigRepository).writeActorCatalogFetchEvent(lastPersistedCatalog.capture(), any(), any(), any());
return toReturn;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ public ConnectorJobOutput run(final StandardDiscoverCatalogInput discoverSchemaI
}

final UUID catalogId =
configRepository.writeActorCatalogFetchEvent(catalog.get(), UUID.fromString(discoverSchemaInput.getSourceId()),
configRepository.writeActorCatalogFetchEvent(catalog.get(),
// NOTE: sourceId is marked required in the OpenAPI config but the code generator doesn't enforce
// it, so we check again here.
discoverSchemaInput.getSourceId() == null ? null : UUID.fromString(discoverSchemaInput.getSourceId()),
discoverSchemaInput.getConnectorVersion(),
discoverSchemaInput.getConfigHash());
return new ConnectorJobOutput().withOutputType(OutputType.DISCOVER_CATALOG_ID).withDiscoverCatalogId(catalogId);
Expand Down

0 comments on commit e521fff

Please sign in to comment.