Skip to content

Commit 52cb9b9

Browse files
Fixed lint issue
1 parent 0da2d72 commit 52cb9b9

File tree

1 file changed

+2
-19
lines changed
  • compute/cloud-client/src/test/java/compute

1 file changed

+2
-19
lines changed

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

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import compute.deleteprotection.SetDeleteProtection;
3838
import compute.disks.DeleteDisk;
3939
import compute.disks.DeleteSnapshot;
40-
import compute.disks.RegionalDelete;
4140
import compute.reservation.DeleteReservation;
4241
import java.io.IOException;
4342
import java.nio.charset.StandardCharsets;
@@ -58,7 +57,7 @@ public abstract class Util {
5857
// resources
5958
// and delete the listed resources based on the timestamp.
6059

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

128127
public static boolean isCreatedBeforeThresholdTime(String timestamp) {
129128
return OffsetDateTime.parse(timestamp).toInstant()
130-
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.HOURS));
129+
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_MINUTES, ChronoUnit.MINUTES));
131130
}
132131

133132
public static String getBase64EncodedKey() {
@@ -218,22 +217,6 @@ && isCreatedBeforeThresholdTime(disk.getCreationTimestamp())) {
218217
}
219218
}
220219

221-
// Delete disks which starts with the given prefixToDelete and
222-
// has creation timestamp >24 hours.
223-
public static void cleanUpExistingRegionalDisks(
224-
String prefixToDelete, String projectId, String region)
225-
throws IOException, ExecutionException, InterruptedException, TimeoutException {
226-
try (RegionDisksClient disksClient = RegionDisksClient.create()) {
227-
for (Disk disk : disksClient.list(projectId, region).iterateAll()) {
228-
if (disk.getName().contains(prefixToDelete)
229-
&& disk.getRegion().equals(region)
230-
&& isCreatedBeforeThresholdTime(disk.getCreationTimestamp())) {
231-
RegionalDelete.deleteRegionalDisk(projectId, region, disk.getName());
232-
}
233-
}
234-
}
235-
}
236-
237220
// Delete snapshots which starts with the given prefixToDelete and
238221
// has creation timestamp >24 hours.
239222
public static void cleanUpExistingSnapshots(String prefixToDelete, String projectId)

0 commit comments

Comments
 (0)