priyeshkaratha commented on code in PR #12170:
URL: https://github.com/apache/ozone/pull/12170#discussion_r4779188754
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOmLifeCycleConfiguration.java:
##########
@@ -307,4 +311,53 @@ private OmLifecycleConfiguration.Builder
configurationWithFilter(OmLCFilter filt
.build();
return getOmLifecycleConfiguration("volume", "bucket",
Collections.singletonList(rule));
}
+
+ @Test
+ public void testGetExpiration() throws OMException {
+ long modificationTime =
Instant.parse("2026-11-25T10:30:00Z").toEpochMilli();
+ OmLifecycleConfiguration lcc = getOmLifecycleConfiguration("volume",
"bucket", Arrays.asList(
+ getOmLCRuleBuilder("late", "", true, 10, null).build(),
+ getOmLCRuleBuilder("logs", "logs/", true, 2, null).build(),
+ getOmLCRuleBuilder("disabled", "", false, 1, null).build(),
+ getOmLCRuleBuilder("tag", null, true, 5,
+ getOmLCFilterBuilder(null, new Tag("k", "v"),
null).build()).build(),
+ getOmLCRuleBuilder("and", null, true, 3, getOmLCFilterBuilder(null,
null,
+ getOmLCAndOperatorBuilder("data/", ImmutableMap.of("k",
"v")).build()).build()).build()))
+ .build();
+
+ // Earliest matching enabled rule wins; the disabled rule is ignored.
+ assertExpiration("logs", "2026-11-28T00:00:00Z", lcc, "logs/a",
Collections.emptyMap(), modificationTime);
+ assertExpiration("late", "2026-12-06T00:00:00Z", lcc, "other/a",
Collections.emptyMap(), modificationTime);
+ assertExpiration("tag", "2026-12-01T00:00:00Z", lcc, "other/a",
ImmutableMap.of("k", "v"), modificationTime);
+ assertExpiration("and", "2026-11-29T00:00:00Z", lcc, "data/a",
ImmutableMap.of("k", "v"), modificationTime);
+ assertExpiration("late", "2026-12-06T00:00:00Z", lcc, "data/a",
ImmutableMap.of("k", "x"), modificationTime);
+
+ OmLifecycleConfiguration noMatch = getOmLifecycleConfiguration("volume",
"bucket", Arrays.asList(
Review Comment:
Added an enabled abort-mpu rule with an empty prefix and only
AbortIncompleteMultipartUpload to the no-match configuration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]