Skip to content

Commit 286899b

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 1087 b: refs/heads/master c: 494511c h: refs/heads/master i: 1085: ecf2f25 1083: d8112ed 1079: f9492ef 1071: 36124c8 1055: 28daa1e 1023: 4c88862 v: v3
1 parent d002ace commit 286899b

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
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: 9b3e6896c48ff1146a36d4c4ee4bcf941b641442
2+
refs/heads/master: 494511c54dfd9ff09e4748c2847d32fda8483880
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/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 {

trunk/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)