-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix #27107: soft-deleted users still appear in Experts/Reviewers across all entities #27120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
89122f6
f56057c
3264fb3
841775b
d4743a1
05b41cb
1a1888a
0c45006
639c950
97f328a
d9aa379
00e7896
37a014a
47def38
4af35c3
b3d7482
d5446b1
736b773
007976e
21c8e64
f4a875e
5e77478
8b443b1
85911a3
6807212
70a4b67
344bc44
7217773
135be1c
607743b
9e31dbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,9 @@ | |
| import org.openmetadata.it.util.TestNamespace; | ||
| import org.openmetadata.schema.api.domains.CreateDomain; | ||
| import org.openmetadata.schema.api.domains.CreateDomain.DomainType; | ||
| import org.openmetadata.schema.api.teams.CreateUser; | ||
| import org.openmetadata.schema.entity.domains.Domain; | ||
| import org.openmetadata.schema.entity.teams.User; | ||
| import org.openmetadata.schema.type.EntityHistory; | ||
| import org.openmetadata.schema.type.EntityReference; | ||
| import org.openmetadata.sdk.client.OpenMetadataClient; | ||
|
|
@@ -1153,4 +1155,75 @@ | |
| // Verify old child FQN no longer works | ||
| assertThrows(Exception.class, () -> getEntityByName(oldChildFqn)); | ||
| } | ||
|
|
||
| @Test | ||
| void softDeletedExpert_notReturnedInSingleGet(TestNamespace ns) { | ||
| OpenMetadataClient client = SdkClients.adminClient(); | ||
|
|
||
| String userName = ns.prefix("domain_expert"); | ||
| User expert = | ||
| client | ||
| .users() | ||
| .create( | ||
|
Check failure on line 1167 in openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DomainResourceIT.java
|
||
| new CreateUser() | ||
| .withName(userName) | ||
| .withEmail(userName.replaceAll("[^a-zA-Z0-9]", "") + "@test.openmetadata.org") | ||
| .withDescription("Expert user for domain soft-delete test")); | ||
|
|
||
| CreateDomain create = | ||
| new CreateDomain() | ||
| .withName(ns.prefix("domain_softdel")) | ||
| .withDomainType(DomainType.AGGREGATE) | ||
| .withExperts(List.of(expert.getFullyQualifiedName())) | ||
| .withDescription("Domain for soft-delete expert test"); | ||
| Domain domain = createEntity(create); | ||
|
|
||
| client.users().delete(expert.getId().toString()); | ||
|
|
||
| Domain byId = client.domains().get(domain.getId().toString(), "experts"); | ||
| assertTrue( | ||
| byId.getExperts() == null || byId.getExperts().isEmpty(), | ||
| "Soft-deleted expert must not appear in single GET by ID"); | ||
|
|
||
| Domain byName = client.domains().getByName(domain.getFullyQualifiedName(), "experts"); | ||
| assertTrue( | ||
| byName.getExperts() == null || byName.getExperts().isEmpty(), | ||
| "Soft-deleted expert must not appear in single GET by name"); | ||
| } | ||
|
|
||
| @Test | ||
| void softDeletedExpert_notReturnedInListEndpoint(TestNamespace ns) { | ||
| OpenMetadataClient client = SdkClients.adminClient(); | ||
|
|
||
| String userName = ns.prefix("domain_expert_list"); | ||
| User expert = | ||
| client | ||
| .users() | ||
| .create( | ||
|
Check failure on line 1202 in openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DomainResourceIT.java
|
||
| new CreateUser() | ||
| .withName(userName) | ||
| .withEmail(userName.replaceAll("[^a-zA-Z0-9]", "") + "@test.openmetadata.org") | ||
| .withDescription("Expert user for domain list soft-delete test")); | ||
|
|
||
| CreateDomain create = | ||
| new CreateDomain() | ||
| .withName(ns.prefix("domain_softdel_list")) | ||
| .withDomainType(DomainType.AGGREGATE) | ||
| .withExperts(List.of(expert.getFullyQualifiedName())) | ||
| .withDescription("Domain for soft-delete expert list test"); | ||
| Domain domain = createEntity(create); | ||
|
|
||
| client.users().delete(expert.getId().toString()); | ||
|
|
||
| ListParams params = new ListParams().setFields("experts").withLimit(100); | ||
| ListResponse<Domain> list = listEntities(params); | ||
|
Comment on lines
+1313
to
+1314
|
||
| Domain listed = | ||
| list.getData().stream() | ||
| .filter(d -> d.getId().equals(domain.getId())) | ||
| .findFirst() | ||
| .orElseThrow(() -> new AssertionError("Domain not found in list")); | ||
| assertTrue( | ||
| listed.getExperts() == null || listed.getExperts().isEmpty(), | ||
| "Soft-deleted expert must not appear in list endpoint"); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.