Skip to content

Commit

Permalink
Use existing status when no breaking change (#20253)
Browse files Browse the repository at this point in the history
* Use existing status when no breaking change

* Fix tests

* Format
  • Loading branch information
benmoriceau authored Dec 8, 2022
1 parent 023cb3d commit c975dff
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 @@ -401,7 +401,7 @@ private void discoveredSchemaWithCatalogDiff(final SourceDiscoverSchemaRead disc
if (shouldDisableConnection(containsBreakingChange, connectionRead.getNonBreakingChangesPreference(), diff)) {
connectionStatus = ConnectionStatus.INACTIVE;
} else {
connectionStatus = ConnectionStatus.ACTIVE;
connectionStatus = connectionRead.getStatus();
}
updateObject.status(connectionStatus);
connectionsHandler.updateConnection(updateObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void testDiscoverSchemaFromSourceIdWithConnectionIdNonBreakingDisableConnectionP

final ConnectionRead connectionRead =
new ConnectionRead().syncCatalog(CatalogConverter.toApi(airbyteCatalogCurrent)).nonBreakingChangesPreference(
NonBreakingChangesPreference.DISABLE);
NonBreakingChangesPreference.DISABLE).status(ConnectionStatus.ACTIVE);
when(connectionsHandler.getConnection(request.getConnectionId())).thenReturn(connectionRead);
when(connectionsHandler.getDiff(any(), any(), any())).thenReturn(catalogDiff);

Expand Down Expand Up @@ -729,7 +729,8 @@ void testDiscoverSchemaFromSourceIdWithConnectionIdBreaking() throws IOException
CatalogHelpers.createAirbyteStream(SHOES, Field.of(SKU, JsonSchemaType.STRING)),
CatalogHelpers.createAirbyteStream(DOGS, Field.of(NAME, JsonSchemaType.STRING))));

final ConnectionRead connectionRead = new ConnectionRead().syncCatalog(CatalogConverter.toApi(airbyteCatalogCurrent));
final ConnectionRead connectionRead =
new ConnectionRead().syncCatalog(CatalogConverter.toApi(airbyteCatalogCurrent)).status(ConnectionStatus.ACTIVE);
when(connectionsHandler.getConnection(request.getConnectionId())).thenReturn(connectionRead);
when(connectionsHandler.getDiff(any(), any(), any())).thenReturn(catalogDiff);

Expand Down Expand Up @@ -837,7 +838,7 @@ void testDiscoverSchemaFromSourceIdWithConnectionIdNonBreakingDisableConnectionP

final ConnectionRead connectionRead =
new ConnectionRead().syncCatalog(CatalogConverter.toApi(airbyteCatalogCurrent)).nonBreakingChangesPreference(
NonBreakingChangesPreference.DISABLE);
NonBreakingChangesPreference.DISABLE).status(ConnectionStatus.INACTIVE);
when(connectionsHandler.getConnection(request.getConnectionId())).thenReturn(connectionRead);
when(connectionsHandler.getDiff(any(), any(), any())).thenReturn(catalogDiff);

Expand All @@ -854,7 +855,7 @@ void testDiscoverSchemaFromSourceIdWithConnectionIdNonBreakingDisableConnectionP
final SourceDiscoverSchemaRead actual = schedulerHandler.discoverSchemaForSourceFromSourceId(request);
assertEquals(actual.getCatalogDiff(), catalogDiff);
assertEquals(actual.getCatalog(), expectedActorCatalog);
assertEquals(actual.getConnectionStatus(), ConnectionStatus.ACTIVE);
assertEquals(actual.getConnectionStatus(), ConnectionStatus.INACTIVE);
}

@Test
Expand Down

0 comments on commit c975dff

Please sign in to comment.