Skip to content

Commit

Permalink
router service to route sync to expanded dataplane (#7476)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohansong committed Jun 23, 2023
1 parent fe230ce commit f3b717b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public String getTaskQueue(final UUID connectionId, final TemporalJobType jobTyp
final Geography geography = configRepository.getGeographyForConnection(connectionId);
final UUID workspaceId = configRepository.getStandardWorkspaceFromConnection(connectionId, false).getWorkspaceId();
if (featureFlagClient.boolVariation(ShouldRunOnGkeDataplane.INSTANCE, new Workspace(workspaceId))) {
return taskQueueMapper.getTaskQueueFlagged(geography, jobType);
if (featureFlagClient.boolVariation(ShouldRunOnExpandedGkeDataplane.INSTANCE, new Workspace(workspaceId))) {
return taskQueueMapper.getTaskQueueExpanded(geography, jobType);
} else {
return taskQueueMapper.getTaskQueueFlagged(geography, jobType);
}
} else {
return taskQueueMapper.getTaskQueue(geography, jobType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ void testGetTaskQueueBehindFlag() throws IOException, ConfigNotFoundException {
assertEquals(EU_FLAGGED_TASK_QUEUE, routerService.getTaskQueue(CONNECTION_ID, TemporalJobType.SYNC));
}

@Test
void testGetTaskQueueBehindExpandedFlag() throws IOException, ConfigNotFoundException {
Mockito.when(mockFeatureFlagClient.boolVariation(ShouldRunOnGkeDataplane.INSTANCE, new Workspace(WORKSPACE_ID))).thenReturn(true);
Mockito.when(mockFeatureFlagClient.boolVariation(ShouldRunOnExpandedGkeDataplane.INSTANCE, new Workspace(WORKSPACE_ID))).thenReturn(true);

Mockito.when(mConfigRepository.getGeographyForConnection(CONNECTION_ID)).thenReturn(Geography.AUTO);
assertEquals(US_EXPANDED_TASK_QUEUE, routerService.getTaskQueue(CONNECTION_ID, TemporalJobType.SYNC));

Mockito.when(mConfigRepository.getGeographyForConnection(CONNECTION_ID)).thenReturn(Geography.US);
assertEquals(US_EXPANDED_TASK_QUEUE, routerService.getTaskQueue(CONNECTION_ID, TemporalJobType.SYNC));

Mockito.when(mConfigRepository.getGeographyForConnection(CONNECTION_ID)).thenReturn(Geography.EU);
assertEquals(EU_EXPANDED_TASK_QUEUE, routerService.getTaskQueue(CONNECTION_ID, TemporalJobType.SYNC));
}

@Test
void testGetWorkspaceTaskQueue() throws IOException, ConfigNotFoundException {
Mockito.when(mockFeatureFlagClient.boolVariation(ShouldRunOnGkeDataplane.INSTANCE, new Workspace(WORKSPACE_ID))).thenReturn(false);
Expand Down

0 comments on commit f3b717b

Please sign in to comment.