Skip to content

Commit 8982ff0

Browse files
Fixed test
1 parent b14809c commit 8982ff0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

compute/cloud-client/src/test/java/compute/Util.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public abstract class Util {
5858
// resources
5959
// and delete the listed resources based on the timestamp.
6060

61-
private static final int DELETION_THRESHOLD_TIME_HOURS = 24;
61+
private static final int DELETION_THRESHOLD_TIME_MINUTES = 30;
6262
// comma separate list of zone names
6363
private static final String TEST_ZONES_NAME = "JAVA_DOCS_COMPUTE_TEST_ZONES";
6464
private static final String DEFAULT_ZONES = "us-central1-a,us-west1-a,asia-south1-a";
@@ -127,7 +127,7 @@ && isCreatedBeforeThresholdTime(instance.getCreationTimestamp())) {
127127

128128
public static boolean isCreatedBeforeThresholdTime(String timestamp) {
129129
return OffsetDateTime.parse(timestamp).toInstant()
130-
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.MINUTES));
130+
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_MINUTES, ChronoUnit.MINUTES));
131131
}
132132

133133
public static String getBase64EncodedKey() {

compute/cloud-client/src/test/java/compute/disks/HyperdisksIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public static void setUp()
6262
throws IOException, ExecutionException, InterruptedException, TimeoutException {
6363
requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
6464
requireEnvVar("GOOGLE_CLOUD_PROJECT");
65-
Util.cleanUpExistingDisks("test-hyperdisk-enc-", PROJECT_ID, ZONE);
66-
Util.cleanUpExistingStoragePool("test-storage-pool-enc-", PROJECT_ID, ZONE);
6765
}
6866

6967
@AfterAll
@@ -74,6 +72,9 @@ public static void cleanup()
7472
DeleteDisk.deleteDisk(PROJECT_ID, ZONE, HYPERDISK_IN_POOL_NAME);
7573

7674
Util.deleteStoragePool(PROJECT_ID, ZONE, STORAGE_POOL_NAME);
75+
// Clean up stale resources
76+
Util.cleanUpExistingDisks("test-hyperdisk-enc-", PROJECT_ID, ZONE);
77+
Util.cleanUpExistingStoragePool("test-storage-pool-enc-", PROJECT_ID, ZONE);
7778
}
7879

7980
@Test

0 commit comments

Comments
 (0)