Fix #7000: Delete with recursive=true is not working for testSuite API (#7285)

This commit is contained in:
Sriharsha Chintalapani 2022-09-06 21:59:46 -07:00 committed by GitHub
parent fe575da962
commit da286b7a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -325,13 +325,17 @@ public class TestSuiteResource extends EntityResource<TestSuite, TestSuiteReposi
public Response delete(
@Context UriInfo uriInfo,
@Context SecurityContext securityContext,
@Parameter(description = "Recursively delete this entity and it's children. (Default `false`)")
@DefaultValue("false")
@QueryParam("recursive")
boolean recursive,
@Parameter(description = "Hard delete the entity. (Default = `false`)")
@QueryParam("hardDelete")
@DefaultValue("false")
boolean hardDelete,
@Parameter(description = "Topic Id", schema = @Schema(type = "UUID")) @PathParam("id") UUID id)
@Parameter(description = "TestSuite Id", schema = @Schema(type = "UUID")) @PathParam("id") UUID id)
throws IOException {
return delete(uriInfo, securityContext, id, false, hardDelete, true);
return delete(uriInfo, securityContext, id, recursive, hardDelete, true);
}
private TestSuite getTestSuite(CreateTestSuite create, String user) throws IOException {

View File

@ -1,6 +1,7 @@
package org.openmetadata.catalog.resources.dqtests;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.openmetadata.catalog.util.TestUtils.ADMIN_AUTH_HEADERS;
import static org.openmetadata.catalog.util.TestUtils.assertResponse;
@ -92,6 +93,16 @@ public class TestSuiteResourceTest extends EntityResourceTest<TestSuite, CreateT
verifyTestCases(testSuite.getTests(), testCases1);
}
}
deleteEntity(testSuite1.getId(), true, false, ADMIN_AUTH_HEADERS);
assertResponse(
() -> getEntity(testSuite1.getId(), ADMIN_AUTH_HEADERS),
NOT_FOUND,
"testSuite instance for " + testSuite1.getId() + " not found");
Map<String, String> queryParams = new HashMap<>();
queryParams.put("include", "all");
TestSuite deletedTestSuite = getEntity(testSuite1.getId(), queryParams, null, ADMIN_AUTH_HEADERS);
assertEquals(testSuite1.getId(), deletedTestSuite.getId());
assertEquals(deletedTestSuite.getDeleted(), true);
}
public static ResultList<TestSuite> getTestSuites(Integer limit, String fields, Map<String, String> authHeaders)