Skip to content
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

Bug fix for DatasetAccountableOwnership ingestion #424

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added unit test
  • Loading branch information
Rakhi Agrawal committed Sep 12, 2024
commit b629379f5a06ab5c10dd6376e20bf99f63fcc1e9
Original file line number Diff line number Diff line change
Expand Up @@ -612,4 +612,31 @@ public void testPreUpdateRoutingWithSkipIngestion() throws NoSuchFieldException,
verifyNoMoreInteractions(_mockLocalDAO);
}

//Testing the case when aspect has no pre lambda but skipIngestion contains the aspect, so it should not skip ingestion
@Test
public void testPreUpdateRoutingWithSkipIngestionNoPreLambda() throws NoSuchFieldException, IllegalAccessException {

Field skipIngestionField = BaseAspectRoutingResource.class.getDeclaredField("SKIP_INGESTION_FOR_ASPECTS");
skipIngestionField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(skipIngestionField, skipIngestionField.getModifiers() & ~Modifier.FINAL);
List<String> newSkipIngestionList = Arrays.asList("com.linkedin.testing.AspectFoo");
skipIngestionField.set(null, newSkipIngestionList);

FooUrn urn = makeFooUrn(1);
AspectFoo foo = new AspectFoo().setValue("foo");
List<EntityAspectUnion> aspects = Arrays.asList(ModelUtils.newAspectUnion(EntityAspectUnion.class, foo));
EntitySnapshot snapshot = ModelUtils.newSnapshot(EntitySnapshot.class, urn, aspects);

runAndWait(_resource.ingest(snapshot));
// Should not skip ingestion
verify(_mockAspectFooGmsClient, times(1)).ingest(any(), any());
rakhiagr marked this conversation as resolved.
Show resolved Hide resolved
// Should check for pre lambda
verify(_mockLocalDAO, times(1)).getRestliPreUpdateAspectRegistry();
// Should not add to localDAO
verify(_mockLocalDAO, times(0)).add(any(), any(), any(), any(), any());
verifyNoMoreInteractions(_mockLocalDAO);
}

}
Loading