From 8e23226606ab3819647be9087e586e52fa9101ff Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Thu, 3 Mar 2016 09:48:50 -0800 Subject: [PATCH] Added missing waits for change completion. --- .../java/com/google/gcloud/dns/it/ITDnsTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java index ae721e742ae8..c57713665bc8 100644 --- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java +++ b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java @@ -40,6 +40,7 @@ import org.junit.Test; import org.junit.rules.Timeout; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -49,14 +50,13 @@ public class ITDnsTest { // todo(mderka) Implement test for creating invalid change when DnsException is finished. #673 - + public static final String PREFIX = "gcldjvit-"; public static final Dns DNS = DnsOptions.builder().build().service(); - public static final String PROJECT_ID = DNS.options().projectId(); public static final String ZONE_NAME1 = (PREFIX + UUID.randomUUID()).substring(0, 32); public static final String ZONE_NAME_EMPTY_DESCRIPTION = - ("gcldjvit-" + UUID.randomUUID()).substring(0, 32); - public static final String ZONE_NAME_TOO_LONG = (PREFIX + UUID.randomUUID()); + (PREFIX + UUID.randomUUID()).substring(0, 32); + public static final String ZONE_NAME_TOO_LONG = PREFIX + UUID.randomUUID(); public static final String ZONE_DESCRIPTION1 = "first zone"; public static final String ZONE_DNS_NAME1 = ZONE_NAME1 + ".com."; public static final String ZONE_DNS_EMPTY_DESCRIPTION = ZONE_NAME_EMPTY_DESCRIPTION + ".com."; @@ -727,6 +727,7 @@ public void testGetChange() { ChangeRequest created = zone.applyChangeRequest(CHANGE_ADD_ZONE1); ChangeRequest retrieved = DNS.getChangeRequest(zone.name(), created.id()); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); zone.applyChangeRequest(CHANGE_DELETE_ZONE1); // with options created = zone.applyChangeRequest(CHANGE_ADD_ZONE1, @@ -734,30 +735,35 @@ public void testGetChange() { retrieved = DNS.getChangeRequest(zone.name(), created.id(), Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.ID)); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); zone.applyChangeRequest(CHANGE_DELETE_ZONE1); created = zone.applyChangeRequest(CHANGE_ADD_ZONE1, Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.STATUS)); retrieved = DNS.getChangeRequest(zone.name(), created.id(), Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.STATUS)); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); zone.applyChangeRequest(CHANGE_DELETE_ZONE1); created = zone.applyChangeRequest(CHANGE_ADD_ZONE1, Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.START_TIME)); retrieved = DNS.getChangeRequest(zone.name(), created.id(), Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.START_TIME)); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); zone.applyChangeRequest(CHANGE_DELETE_ZONE1); created = zone.applyChangeRequest(CHANGE_ADD_ZONE1, Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.ADDITIONS)); retrieved = DNS.getChangeRequest(zone.name(), created.id(), Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.ADDITIONS)); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); // finishes with delete otherwise we cannot delete the zone created = zone.applyChangeRequest(CHANGE_DELETE_ZONE1, Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.DELETIONS)); retrieved = DNS.getChangeRequest(zone.name(), created.id(), Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.DELETIONS)); assertEqChangesIgnoreStatus(created, retrieved); + waitUntilComplete(zone.name(), created.id()); } finally { clear(); }