forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cache): Fix cache key serialization in search service (datahub-pr…
…oject#7858) Co-authored-by: RyanHolstien <[email protected]> Co-authored-by: Ryan Holstien <[email protected]>
- Loading branch information
1 parent
b588946
commit 9199c89
Showing
5 changed files
with
100 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 12 additions & 5 deletions
17
metadata-io/src/test/java/com/linkedin/metadata/search/LineageSearchResultCacheKeyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
package com.linkedin.metadata.search; | ||
|
||
import java.time.temporal.ChronoUnit; | ||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.AssertJUnit.assertEquals; | ||
import static org.testng.AssertJUnit.assertNotSame; | ||
|
||
|
||
public class LineageSearchResultCacheKeyTest extends AbstractTestNGSpringContextTests { | ||
|
||
@Test | ||
public void testNulls() { | ||
// ensure no NPE | ||
assertEquals(new EntityLineageResultCacheKey(null, null, null, null, null), | ||
EntityLineageResultCacheKey.from(null, null, null, null, null)); | ||
assertEquals(new EntityLineageResultCacheKey(null, null, null, null, null, ChronoUnit.DAYS), | ||
new EntityLineageResultCacheKey(null, null, null, null, null, ChronoUnit.DAYS)); | ||
} | ||
|
||
@Test | ||
public void testDateTruncation() { | ||
// expect start of day milli | ||
assertEquals(new EntityLineageResultCacheKey(null, null, 1679529600000L, 1679616000000L, null), | ||
EntityLineageResultCacheKey.from(null, null, 1679530293000L, 1679530293001L, | ||
null)); | ||
assertEquals(new EntityLineageResultCacheKey(null, null, 1679529600000L, | ||
1679615999999L, null, ChronoUnit.DAYS), | ||
new EntityLineageResultCacheKey(null, null, 1679530293000L, | ||
1679530293001L, null, ChronoUnit.DAYS)); | ||
assertNotSame(new EntityLineageResultCacheKey(null, null, 1679529600000L, | ||
1679616000000L, null, ChronoUnit.DAYS), | ||
new EntityLineageResultCacheKey(null, null, 1679530293000L, | ||
1679530293001L, null, ChronoUnit.DAYS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters