Skip to content

Commit

Permalink
Fix legacy reset behavior (#17270)
Browse files Browse the repository at this point in the history
* Fix how we force an old version of a connector in the tests
* Fix endpoint behavior, State NOT_SET should be same as LEGACY
  • Loading branch information
gosusnp authored Sep 27, 2022
1 parent 7c4980b commit f16b1eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private ConnectionRead resetStreamsIfNeeded(final WebBackendConnectionUpdate web
final ConnectionIdRequestBody connectionIdRequestBody = new ConnectionIdRequestBody().connectionId(connectionId);
final ConnectionStateType stateType = getStateType(connectionIdRequestBody);

if (stateType == ConnectionStateType.LEGACY) {
if (stateType == ConnectionStateType.LEGACY || stateType == ConnectionStateType.NOT_SET) {
streamsToReset = configRepository.getAllStreamsForConnection(connectionId);
}
ManualOperationResult manualOperationResult = eventRunner.synchronousResetConnection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,10 +1023,6 @@ void testResetAllWhenSchemaIsModifiedForLegacySource() throws Exception {
final SourceRead source = testHarness.createPostgresSource(true);
final UUID sourceId = source.getSourceId();
final UUID sourceDefinitionId = source.getSourceDefinitionId();
final AirbyteCatalog catalog = testHarness.discoverSourceSchema(sourceId);
final UUID destinationId = testHarness.createPostgresDestination(true).getDestinationId();
final OperationRead operation = testHarness.createOperation();
final String name = "test_reset_when_schema_is_modified_" + UUID.randomUUID();

// Fetch the current/most recent source definition version
final SourceDefinitionRead sourceDefinitionRead =
Expand All @@ -1039,6 +1035,11 @@ void testResetAllWhenSchemaIsModifiedForLegacySource() throws Exception {
AirbyteAcceptanceTestHarness.POSTGRES_SOURCE_LEGACY_CONNECTOR_VERSION);
testHarness.updateSourceDefinitionVersion(sourceDefinitionId, AirbyteAcceptanceTestHarness.POSTGRES_SOURCE_LEGACY_CONNECTOR_VERSION);

final AirbyteCatalog catalog = testHarness.discoverSourceSchema(sourceId);
final UUID destinationId = testHarness.createPostgresDestination(true).getDestinationId();
final OperationRead operation = testHarness.createOperation();
final String name = "test_reset_when_schema_is_modified_" + UUID.randomUUID();

LOGGER.info("Discovered catalog: {}", catalog);

final ConnectionRead connection =
Expand Down

0 comments on commit f16b1eb

Please sign in to comment.