Skip to content

Commit

Permalink
Added missing waits for change completion.
Browse files Browse the repository at this point in the history
  • Loading branch information
mderka committed Mar 3, 2016
1 parent 22153aa commit 8e23226
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.";
Expand Down Expand Up @@ -727,37 +727,43 @@ 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,
Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.ID));
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();
}
Expand Down

0 comments on commit 8e23226

Please sign in to comment.