Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 34535a7

Browse files
committed
chore: Use local date time instead of time
1 parent a9c8fc0 commit 34535a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

google-cloud-logging/src/main/java/com/google/cloud/logging/testing/RemoteLoggingHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static RemoteLoggingHelper create() {
101101
* <p>Format: {Instant}_{name}_{UUID}
102102
*/
103103
public static String formatForTest(String name) {
104-
String now = DateTimeFormatter.ISO_INSTANT.format(Instant.now());
104+
String now = DateTimeFormatter.ISO_LOCAL_DATE.format(Instant.now());
105105
return now + "_" + name + "_" + UUID.randomUUID().toString().substring(0, 8);
106106
}
107107

google-cloud-logging/src/test/java/com/google/cloud/logging/BaseSystemTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ static void beforeClass() {
5050

5151
@AfterAll
5252
static void afterClass() throws Exception {
53-
// Use a cutoff of ~6 hours based on the log name. Any logs that were created before the cutoff
53+
// Use a cutoff of a day based on the log name. Any logs that were created before the cutoff
5454
// is from a previous invocation of the test and was unable to be properly deleted.
5555
Page<String> logPage = logging.listLogs();
5656
for (String logName : logPage.iterateAll()) {
57-
Instant cutoff = Instant.now().minus(6, ChronoUnit.HOURS);
57+
Instant cutoff = Instant.now().minus(1, ChronoUnit.DAYS);
5858
String logCreateTimeString = logName.split("_")[0];
5959
Instant logCreateTimeInstant =
60-
(Instant) DateTimeFormatter.ISO_INSTANT.parse(logCreateTimeString);
60+
(Instant) DateTimeFormatter.ISO_LOCAL_DATE.parse(logCreateTimeString);
6161
if (logCreateTimeInstant.isBefore(cutoff)) {
6262
logging.deleteLog(logName);
6363
}

0 commit comments

Comments
 (0)