Skip to content

Commit d9f2176

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2313 b: refs/heads/update-datastore c: 494511c h: refs/heads/master i: 2311: d44dea5
1 parent 2bab64f commit d9f2176

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: 9b3e6896c48ff1146a36d4c4ee4bcf941b641442
8+
refs/heads/update-datastore: 494511c54dfd9ff09e4748c2847d32fda8483880
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/LocalGcdHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ private static void extractFile(ZipInputStream zipIn, File filePath) throws IOEx
524524
}
525525
}
526526

527-
public static String sendQuitRequest(int port) {
527+
public static boolean sendQuitRequest(int port) {
528528
StringBuilder result = new StringBuilder();
529529
try {
530530
URL url = new URL("http", "localhost", port, "/_ah/admin/quit");
@@ -543,7 +543,7 @@ public static String sendQuitRequest(int port) {
543543
} catch (IOException ignore) {
544544
// ignore
545545
}
546-
return result.toString();
546+
return result.toString().startsWith("Shutting down local server");
547547
}
548548

549549
public void stop() throws IOException, InterruptedException {

branches/update-datastore/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LocalGcdHelperTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,16 @@ public void testFindAvailablePort() {
5050
@Test
5151
public void testSendQuitRequest() throws IOException, InterruptedException {
5252
LocalGcdHelper gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT);
53-
assertTrue(LocalGcdHelper.sendQuitRequest(PORT).startsWith("Shutting down local server"));
53+
assertTrue(LocalGcdHelper.sendQuitRequest(PORT));
54+
long timeoutMillis = 30000;
55+
long startTime = System.currentTimeMillis();
56+
boolean datastoreActive = LocalGcdHelper.isActive(PROJECT_ID, PORT);
57+
while (datastoreActive && System.currentTimeMillis() - startTime < timeoutMillis) {
58+
datastoreActive = LocalGcdHelper.isActive(PROJECT_ID, PORT);
59+
}
60+
assertFalse(datastoreActive);
61+
assertFalse(LocalGcdHelper.sendQuitRequest(PORT));
5462
gcdHelper.stop();
55-
assertTrue(LocalGcdHelper.sendQuitRequest(PORT).isEmpty()); // shouldn't error
5663
}
5764

5865
@Test

0 commit comments

Comments
 (0)