Skip to content

Commit

Permalink
Fixed failed test, changed debian version to 11 (#9423)
Browse files Browse the repository at this point in the history
  • Loading branch information
TetyanaYahodska authored Jul 31, 2024
1 parent 7c5bf8d commit 2790431
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args)
* https://cloud.google.com/sdk/gcloud/reference/compute/machine-types/list
* newDiskSourceImage - Path the the disk image you want to use for your new
* disk. This can be one of the public images
* (like "projects/debian-cloud/global/images/family/debian-10")
* (like "projects/debian-cloud/global/images/family/debian-11")
* or a private image you have access to.
* You can check the list of available public images using the doc:
* http://cloud.google.com/compute/docs/images
Expand All @@ -72,7 +72,7 @@ public static void createInstanceFromTemplateWithOverrides(String projectId, Str
InstanceTemplatesClient instanceTemplatesClient = InstanceTemplatesClient.create()) {

String machineType = "n1-standard-1";
String newDiskSourceImage = "projects/debian-cloud/global/images/family/debian-10";
String newDiskSourceImage = "projects/debian-cloud/global/images/family/debian-11";

// Retrieve an instance template.
InstanceTemplate instanceTemplate = instanceTemplatesClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void createInstanceTemplateWithDiskType(String projectId, String t
.setInitializeParams(AttachedDiskInitializeParams.newBuilder()
.setDiskSizeGb(10)
.setDiskType("pd-balanced")
.setSourceImage("projects/debian-cloud/global/images/family/debian-10").build())
.setSourceImage("projects/debian-cloud/global/images/family/debian-11").build())
.setAutoDelete(true)
.setBoot(true)
.setType(AttachedDisk.Type.PERSISTENT.toString()).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private static Instance createWithDisks(String project, String zone, String inst
// [START compute_instances_create_from_image]

/**
* Create a new VM instance with Debian 10 operating system.
* Create a new VM instance with Debian 11 operating system.
*
* @param project project ID or project number of the Cloud project you want to use.
* @param zone name of the zone to create the instance in. For example: "us-west3-b"
Expand All @@ -265,7 +265,7 @@ public static Instance createFromPublicImage(String project, String zone, String
throws IOException, InterruptedException, ExecutionException, TimeoutException {
try (ImagesClient imagesClient = ImagesClient.create()) {
// List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details
Image image = imagesClient.getFromFamily("debian-cloud", "debian-10");
Image image = imagesClient.getFromFamily("debian-cloud", "debian-11");
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
Vector<AttachedDisk> disks = new Vector<>();
disks.add(diskFromImage(diskType, 10, true, image.getSelfLink()));
Expand Down Expand Up @@ -301,7 +301,7 @@ public static Instance createFromCustomImage(String project, String zone, String
// [START compute_instances_create_from_image_plus_empty_disk]

/**
* Create a new VM instance with Debian 10 operating system and a 11 GB additional empty disk.
* Create a new VM instance with Debian 11 operating system and a 11 GB additional empty disk.
*
* @param project project ID or project number of the Cloud project you want to use.
* @param zone name of the zone to create the instance in. For example: "us-west3-b"
Expand All @@ -312,7 +312,7 @@ public static Instance createWithAdditionalDisk(String project, String zone, Str
throws IOException, InterruptedException, ExecutionException, TimeoutException {
try (ImagesClient imagesClient = ImagesClient.create()) {
// List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details
Image image = imagesClient.getFromFamily("debian-cloud", "debian-10");
Image image = imagesClient.getFromFamily("debian-cloud", "debian-11");
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
Vector<AttachedDisk> disks = new Vector<>();
disks.add(diskFromImage(diskType, 10, true, image.getSelfLink()));
Expand Down Expand Up @@ -349,7 +349,7 @@ public static Instance createFromSnapshot(String project, String zone, String in
// [START compute_instances_create_from_image_plus_snapshot_disk]

/**
* Create a new VM instance with Debian 10 operating system and data disk created from snapshot.
* Create a new VM instance with Debian 11 operating system and data disk created from snapshot.
*
* @param project project ID or project number of the Cloud project you want to use.
* @param zone name of the zone to create the instance in. For example: "us-west3-b"
Expand All @@ -363,7 +363,7 @@ public static Instance createWithSnapshottedDataDisk(String project, String zone
throws IOException, InterruptedException, ExecutionException, TimeoutException {
try (ImagesClient imagesClient = ImagesClient.create()) {
// List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details
Image image = imagesClient.getFromFamily("debian-cloud", "debian-10");
Image image = imagesClient.getFromFamily("debian-cloud", "debian-11");
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
Vector<AttachedDisk> disks = new Vector<>();
disks.add(diskFromImage(diskType, 10, true, image.getSelfLink()));
Expand All @@ -377,7 +377,7 @@ public static Instance createWithSnapshottedDataDisk(String project, String zone
// [START compute_instances_create_from_image]

/**
* Create a new VM instance with Debian 10 operating system in specified network and subnetwork.
* Create a new VM instance with Debian 11 operating system in specified network and subnetwork.
*
* @param project project ID or project number of the Cloud project you want to use.
* @param zone name of the zone to create the instance in. For example: "us-west3-b"
Expand All @@ -394,7 +394,7 @@ public static Instance createWithSubnetwork(String project, String zone, String
throws IOException, InterruptedException, ExecutionException, TimeoutException {
try (ImagesClient imagesClient = ImagesClient.create()) {
// List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details
Image image = imagesClient.getFromFamily("debian-cloud", "debian-10");
Image image = imagesClient.getFromFamily("debian-cloud", "debian-11");
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
Vector<AttachedDisk> disks = new Vector<>();
disks.add(diskFromImage(diskType, 10, true, image.getSelfLink()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void main(String[] args)
createWithLocalSsd(projectId, zone, instanceName);
}

// Create a new VM instance with Debian 10 operating system and SSD local disk.
// Create a new VM instance with Debian 11 operating system and SSD local disk.
public static void createWithLocalSsd(String projectId, String zone, String instanceName)
throws IOException, ExecutionException, InterruptedException, TimeoutException {

Expand All @@ -57,7 +57,7 @@ public static void createWithLocalSsd(String projectId, String zone, String inst
boolean autoDelete = true;
String diskType = String.format("zones/%s/diskTypes/pd-standard", zone);
// Get the latest debian image.
Image newestDebian = getImageFromFamily("debian-cloud", "debian-10");
Image newestDebian = getImageFromFamily("debian-cloud", "debian-11");
List<AttachedDisk> disks = new ArrayList<>();

// Create the disks to be included in the instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class InstanceOperationsIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class InstanceTemplatesIT {
Expand Down
2 changes: 0 additions & 2 deletions compute/cloud-client/src/test/java/compute/SnippetsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class SnippetsIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class CustomHostnameInstanceIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class CustomMachineTypeIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class DeleteProtectionIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public static void setup()
}

// Create KMS Encrypted disk.
// The service account needs to have the cloudkms.cryptoKeyVersions.useToEncrypt
// The service account service-{PROJECT_ID}@compute-system.iam.gserviceaccount.com
// needs to have the cloudkms.cryptoKeyVersions.useToEncrypt
// permission to execute this test.
CRYPTO_KEY = createKmsKey();
CreateKmsEncryptedDisk.createKmsEncryptedDisk(PROJECT_ID, ZONE, KMS_ENCRYPTED_DISK_NAME,
Expand Down
2 changes: 0 additions & 2 deletions compute/cloud-client/src/test/java/compute/disks/DisksIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class DisksIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class PreemptibleIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Disabled("TODO: fix https://github.com/GoogleCloudPlatform/java-docs-samples/issues/9373")
@RunWith(JUnit4.class)
@Timeout(value = 10, unit = TimeUnit.MINUTES)
public class WindowsOsImageIT {
Expand Down

0 comments on commit 2790431

Please sign in to comment.