-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add detachDisk test to ITComputeTest.java #4420
Conversation
@andreamlin, it looks like there are a bunch of merge conflicts. |
PTAL fixed merge conflicts! test passes locally; hopefully the same can be said on kokoro |
} catch (Exception e) { | ||
if (isNotExceptionType(exceptionTypes, e)) throw e; | ||
} | ||
Thread.sleep(10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add another sleep?
throws Exception { | ||
try { | ||
instanceClient.deleteInstance(INSTANCE_NAME); | ||
Thread.sleep(10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thread.sleep(1000)
isn't great. Perhaps you can use Operation actualResponse = instanceClient.deleteInstance(INSTANCE_NAME);
and poll?
.build(); | ||
Operation op3 = instanceClient.attachDiskInstance(INSTANCE_NAME, false, attachedDisk); | ||
System.out.println(String.format("Disk attached: %s", op3.toString())); | ||
Thread.sleep(10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sleeping again?
Iterable<SubnetworksScopedList> subnetworks = | ||
subNetworkClient.aggregatedListSubnetworks(DEFAULT_PROJECT).iterateAll(); | ||
// TODO(andrealin): Implement futures for Compute methods. | ||
Thread.sleep(10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the sleep? 10 seconds is a lot of time to for a test.
@@ -45,31 +70,200 @@ | |||
|
|||
public class ITComputeTest { | |||
|
|||
private static final String ZONE = "us-central1-a"; | |||
private static final String ZONE = "us-west1-a"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move REGION near here?
|
||
InstanceSettings instanceSettings = | ||
InstanceSettings.newBuilder() | ||
.setCredentialsProvider(FixedCredentialsProvider.create(credentials)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the FixedCredentialsProvider
for all three calls?
@Test | ||
public void testDetachDisk() throws Exception { | ||
long startAt = System.currentTimeMillis(); | ||
System.out.println("Clients created in " + (System.currentTimeMillis() - startAt) + "ms."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this print statement still belong here?
.addDisks(bootDisk) | ||
.build(); | ||
Operation op1 = instanceClient.insertInstance(PROJECT_ZONE_NAME, instanceResource); | ||
System.out.println(String.format("Instance created: %s", op1.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still belong here? If so, then perhaps a log statement would be better.
.setType(diskTypeName.toString()) | ||
.build(); | ||
Operation op2 = diskClient.insertDisk(PROJECT_ZONE_NAME, disk); | ||
System.out.println(String.format("Disk created: %s", op2.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log, and sleep?
Operation op3 = instanceClient.attachDiskInstance(INSTANCE_NAME, false, attachedDisk); | ||
System.out.println(String.format("Disk attached: %s", op3.toString())); | ||
Thread.sleep(10000); | ||
System.out.println("----------------------------------------"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log statement?
System.out.println("----------------------------------------"); | ||
|
||
Operation op4 = instanceClient.detachDiskInstance(INSTANCE_NAME, DISK_NAME.getDisk()); | ||
System.out.println(String.format("Disk detached: %s", op4.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log statement.
Blocked on #4501 (LRO for Compute) |
@andreamlin, it looks like this PR has gone stale. Please reopen once the blockers are removed. |
Tests #3735.
Blocked on
the fix in gax-javaa fix for another bug in gapic-generator to be released to artmanreleasing gax-javabumping the gax-java version in google-cloud-java