Skip to content

Commit 46937a0

Browse files
author
ssambasu
committed
Fixing the tests, increasing timeouts
1 parent de4afbe commit 46937a0

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

test-complete/src/test/java/com/marklogic/client/datamovement/functionaltests/QBFailover.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private static void createForest(String forestName, String hostname, String data
212212

213213
query += "let $save := admin:save-configuration($forest-create)" + "return ()";
214214
System.out.println("Query is " + query);
215-
dbClient.newServerEval().xquery(query).eval();
215+
evalClient.newServerEval().xquery(query).eval();
216216
}
217217

218218
@AfterClass
@@ -234,18 +234,18 @@ public void setUp() throws Exception {
234234
}
235235
Assert.assertTrue(isRunning(hostNames[i]));
236236
}
237-
if (!(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0)) {
237+
if (!(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0)) {
238238
clearDB(port);
239239
}
240-
Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
240+
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
241241
ForestConfiguration fc = dmManager.readForestConfig();
242242
Forest[] f = fc.listForests();
243243
f = (Forest[]) Arrays.stream(f).filter(x -> x.getDatabaseName().equals(dbName)).collect(Collectors.toList())
244244
.toArray(new Forest[hostNames.length]);
245245
Assert.assertEquals(f.length, hostNames.length);
246246
Assert.assertEquals(f.length, 3L);
247247
addDocs();
248-
Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 20000);
248+
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 20000);
249249
}
250250

251251
@After
@@ -260,7 +260,11 @@ public void tearDown() throws Exception {
260260
changeProperty(props, "/manage/v2/forests/" + dbName + "-" + (i + 1) + "/properties");
261261
Thread.currentThread().sleep(1000L);
262262
System.out.println("Restarting server: " + hostNames[i]);
263-
serverStartStop(hostNames[i], "start");
263+
try {
264+
serverStartStop(hostNames[i], "start");
265+
} catch (Exception e) {
266+
e.printStackTrace();
267+
}
264268
Thread.currentThread().sleep(1000L);
265269
System.out.println(new SimpleDateFormat("yyyy.MM.dd.HH.mm:ss").format(new Date()));
266270
System.out.println("Enabling " + dbName + "-" + (i + 1));
@@ -273,7 +277,7 @@ public void tearDown() throws Exception {
273277
clearDB(port);
274278
}
275279

276-
@Test(timeout = 400000)
280+
@Test(timeout = 450000)
277281
public void testStopOneNode() throws Exception {
278282
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
279283
AtomicInteger success = new AtomicInteger(0);
@@ -308,7 +312,7 @@ public void testStopOneNode() throws Exception {
308312
assertEquals("document count", 0, failure.intValue());
309313
}
310314

311-
@Test(timeout = 400000)
315+
@Test(timeout = 450000)
312316
public void testRestart() throws Exception {
313317
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
314318
AtomicInteger success = new AtomicInteger(0);
@@ -345,7 +349,7 @@ public void testRestart() throws Exception {
345349
assertEquals("document count", 0, failure.intValue());
346350
}
347351

348-
@Test(timeout = 400000)
352+
@Test(timeout = 450000)
349353
public void testRepeatedStopOneNode() throws Exception {
350354
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
351355
AtomicInteger success = new AtomicInteger(0);
@@ -389,7 +393,7 @@ public void testRepeatedStopOneNode() throws Exception {
389393
assertEquals("document count", 0, failure.intValue());
390394
}
391395

392-
@Test(timeout = 400000)
396+
@Test(timeout = 450000)
393397
public void testMinNodes() throws Exception {
394398
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
395399
AtomicInteger success = new AtomicInteger(0);
@@ -433,7 +437,7 @@ public void testMinNodes() throws Exception {
433437
Assert.assertTrue(success.intValue() < 20000);
434438
}
435439

436-
@Test(timeout = 400000)
440+
@Test(timeout = 450000)
437441
public void testStopTwoNodes() throws Exception {
438442
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
439443
try {
@@ -476,7 +480,7 @@ public void testStopTwoNodes() throws Exception {
476480
}
477481
}
478482

479-
@Test(timeout = 400000)
483+
@Test(timeout = 450000)
480484
public void xQueryMasstransformReplace() throws Exception {
481485
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
482486
ServerTransform transform = new ServerTransform("add-attr-xquery-transform");
@@ -546,7 +550,7 @@ public void xQueryMasstransformReplace() throws Exception {
546550

547551
}
548552

549-
@Test(timeout = 400000)
553+
@Test(timeout = 450000)
550554
public void xQueryMasstransformReplaceTwoNodes() throws Exception {
551555
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
552556
ServerTransform transform = new ServerTransform("add-attr-xquery-transform");
@@ -618,7 +622,7 @@ public void xQueryMasstransformReplaceTwoNodes() throws Exception {
618622
assertEquals("document count", 0, skipped.intValue());
619623
}
620624

621-
@Test(timeout = 400000)
625+
@Test(timeout = 450000)
622626
public void xQueryMasstransformReplaceRepeated() throws Exception {
623627
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
624628
ServerTransform transform = new ServerTransform("add-attr-xquery-transform");
@@ -696,7 +700,7 @@ public void xQueryMasstransformReplaceRepeated() throws Exception {
696700
assertEquals("document count", 0, failure.intValue());
697701
}
698702

699-
@Test(timeout = 400000)
703+
@Test(timeout = 450000)
700704
public void massDeleteConsistentSnapShot() throws Exception {
701705
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
702706
AtomicBoolean isRunning = new AtomicBoolean(true);

test-complete/src/test/java/com/marklogic/client/datamovement/functionaltests/WBFailover.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ public void setUp() throws Exception {
195195
}
196196
Assert.assertTrue(isRunning(hostNames[i]));
197197
}
198-
if (!(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0)) {
198+
if (!(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0)) {
199199
clearDB(port);
200200
}
201+
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
201202
ForestConfiguration fc = dmManager.readForestConfig();
202203
Forest[] f = fc.listForests();
203204
f = (Forest[]) Arrays.stream(f).filter(x -> x.getDatabaseName().equals(dbName)).collect(Collectors.toList())
@@ -218,7 +219,11 @@ public void tearDown() throws Exception {
218219
changeProperty(props, "/manage/v2/forests/" + dbName + "-" + (i + 1) + "/properties");
219220
Thread.currentThread().sleep(1000L);
220221
System.out.println("Restarting server " + hostNames[i]);
221-
serverStartStop(hostNames[i], "start");
222+
try {
223+
serverStartStop(hostNames[i], "start");
224+
} catch (Exception e) {
225+
e.printStackTrace();
226+
}
222227
Thread.currentThread().sleep(1000L);
223228
System.out.println(new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date()));
224229
System.out.println("Enabling " + dbName + "-" + (i + 1));
@@ -231,7 +236,7 @@ public void tearDown() throws Exception {
231236
clearDB(port);
232237
}
233238

234-
@Test(timeout = 300000)
239+
@Test(timeout = 350000)
235240
public void testBlackListHost() throws Exception {
236241
try {
237242
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -276,7 +281,7 @@ public void testBlackListHost() throws Exception {
276281
}
277282
}
278283

279-
@Test(timeout = 300000)
284+
@Test(timeout = 350000)
280285
public void testStopOneNode() throws Exception {
281286
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
282287
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
@@ -321,7 +326,7 @@ public void testStopOneNode() throws Exception {
321326
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 50000);
322327
}
323328

324-
@Test(timeout = 300000)
329+
@Test(timeout = 350000)
325330
public void testRestart() throws Exception {
326331
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
327332
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
@@ -369,7 +374,7 @@ public void testRestart() throws Exception {
369374
Assert.assertTrue(evalClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 20000);
370375
}
371376

372-
@Test(timeout = 300000)
377+
@Test(timeout = 350000)
373378
public void testRepeatedStopOneNode() throws Exception {
374379
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
375380
try {
@@ -426,7 +431,7 @@ public void testRepeatedStopOneNode() throws Exception {
426431
}
427432
}
428433

429-
@Test(timeout = 300000)
434+
@Test(timeout = 350000)
430435
public void testStopTwoNodes() throws Exception {
431436
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
432437
try {
@@ -485,7 +490,7 @@ public void testStopTwoNodes() throws Exception {
485490

486491
}
487492

488-
@Test(timeout = 300000)
493+
@Test(timeout = 350000)
489494
public void testMinHosts() throws Exception {
490495
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
491496
final AtomicInteger successCount = new AtomicInteger(0);
@@ -528,7 +533,7 @@ public void testMinHosts() throws Exception {
528533
System.out.println("Ending min test");
529534
}
530535

531-
@Test(timeout = 300000)
536+
@Test(timeout = 350000)
532537
public void testWhiteBlackListNPE() throws Exception {
533538
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
534539
try {

0 commit comments

Comments
 (0)