Search in sources :

Example 1 with CheckSamWorkspaceAuthzStep

use of bio.terra.workspace.service.workspace.flight.CheckSamWorkspaceAuthzStep in project terra-workspace-manager by DataBiosphere.

the class WorkspaceServiceTest method createRawlsWorkspaceDoSteps.

@Test
void createRawlsWorkspaceDoSteps() throws InterruptedException {
    Workspace request = defaultRequestBuilder(UUID.randomUUID()).workspaceStage(WorkspaceStage.RAWLS_WORKSPACE).build();
    // Ensure the auth check in CheckSamWorkspaceAuthzStep always succeeds.
    doReturn(true).when(mockSamService).isAuthorized(any(), any(), any(), any());
    Map<String, StepStatus> retrySteps = new HashMap<>();
    retrySteps.put(CheckSamWorkspaceAuthzStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
    retrySteps.put(CreateWorkspaceStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
    FlightDebugInfo debugInfo = FlightDebugInfo.newBuilder().doStepFailures(retrySteps).build();
    jobService.setFlightDebugInfoForTest(debugInfo);
    UUID createdId = workspaceService.createWorkspace(request, USER_REQUEST);
    assertEquals(createdId, request.getWorkspaceId());
}
Also used : FlightDebugInfo(bio.terra.stairway.FlightDebugInfo) HashMap(java.util.HashMap) CreateWorkspaceStep(bio.terra.workspace.service.workspace.flight.CreateWorkspaceStep) StepStatus(bio.terra.stairway.StepStatus) UUID(java.util.UUID) CheckSamWorkspaceAuthzStep(bio.terra.workspace.service.workspace.flight.CheckSamWorkspaceAuthzStep) Workspace(bio.terra.workspace.service.workspace.model.Workspace) Test(org.junit.jupiter.api.Test) BaseConnectedTest(bio.terra.workspace.common.BaseConnectedTest)

Aggregations

FlightDebugInfo (bio.terra.stairway.FlightDebugInfo)1 StepStatus (bio.terra.stairway.StepStatus)1 BaseConnectedTest (bio.terra.workspace.common.BaseConnectedTest)1 CheckSamWorkspaceAuthzStep (bio.terra.workspace.service.workspace.flight.CheckSamWorkspaceAuthzStep)1 CreateWorkspaceStep (bio.terra.workspace.service.workspace.flight.CreateWorkspaceStep)1 Workspace (bio.terra.workspace.service.workspace.model.Workspace)1 HashMap (java.util.HashMap)1 UUID (java.util.UUID)1 Test (org.junit.jupiter.api.Test)1