mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-20 23:18:01 +00:00
* fix: allow incident to be set to new from any points * fix: added test back
This commit is contained in:
parent
a6c96611fd
commit
0028ae0cd2
@ -155,32 +155,6 @@ public class TestCaseResolutionStatusRepository
|
||||
return JsonUtils.readValue(jsonThread, Thread.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure we are following the correct status flow
|
||||
*/
|
||||
private void validateStatus(
|
||||
TestCaseResolutionStatusTypes lastStatus, TestCaseResolutionStatusTypes newStatus) {
|
||||
switch (lastStatus) {
|
||||
case New -> {
|
||||
/* New can go to any status */
|
||||
}
|
||||
case Ack -> {
|
||||
if (newStatus.equals(TestCaseResolutionStatusTypes.New)) {
|
||||
throw IncidentManagerException.invalidStatus(lastStatus, newStatus);
|
||||
}
|
||||
}
|
||||
case Assigned -> {
|
||||
if (List.of(TestCaseResolutionStatusTypes.New, TestCaseResolutionStatusTypes.Ack)
|
||||
.contains(newStatus)) {
|
||||
throw IncidentManagerException.invalidStatus(lastStatus, newStatus);
|
||||
}
|
||||
}
|
||||
// We only validate status if the last one is unresolved, so we should
|
||||
// never land here
|
||||
default -> throw IncidentManagerException.invalidStatus(lastStatus, newStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transaction
|
||||
public void storeInternal(
|
||||
@ -195,9 +169,6 @@ public class TestCaseResolutionStatusRepository
|
||||
// if we have an ongoing incident, set the stateId if the new record to be created
|
||||
// and validate the flow
|
||||
if (Boolean.TRUE.equals(unresolvedIncident(lastIncident))) {
|
||||
validateStatus(
|
||||
lastIncident.getTestCaseResolutionStatusType(),
|
||||
recordEntity.getTestCaseResolutionStatusType());
|
||||
// If there is an unresolved incident update the state ID
|
||||
recordEntity.setStateId(lastIncident.getStateId());
|
||||
// If the last incident had a severity assigned and the incoming incident does not, inherit
|
||||
|
@ -1820,7 +1820,7 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
|
||||
}
|
||||
|
||||
@Test
|
||||
void unauthorizedTestCaseResolutionFlow(TestInfo test)
|
||||
void authorizedTestCaseResolutionFlow(TestInfo test)
|
||||
throws HttpResponseException, ParseException {
|
||||
TestCase testCaseEntity = createEntity(createRequest(getEntityName(test)), ADMIN_AUTH_HEADERS);
|
||||
// Add failed test case, which will create a NEW incident
|
||||
@ -1840,13 +1840,8 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
|
||||
.withTestCaseResolutionStatusDetails(new Assigned().withAssignee(USER1_REF));
|
||||
createTestCaseFailureStatus(createAssignedIncident);
|
||||
|
||||
assertResponseContains(
|
||||
() ->
|
||||
createTestCaseFailureStatus(
|
||||
createAssignedIncident.withTestCaseResolutionStatusType(
|
||||
TestCaseResolutionStatusTypes.Ack)),
|
||||
BAD_REQUEST,
|
||||
"Incident with status [Assigned] cannot be moved to [Ack]");
|
||||
createAssignedIncident.withTestCaseResolutionStatusType(TestCaseResolutionStatusTypes.Ack));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user