@Test public void singleMasterJournalCrashIntegrationTest() throws Exception { LocalTachyonCluster cluster = setupSingleMasterCluster(); CommonUtils.sleepMs(TEST_TIME_MS); // Shutdown the cluster cluster.stopTFS(); CommonUtils.sleepMs(TEST_TIME_MS); // Ensure the client threads are stopped. mExecutorsForClient.shutdown(); mExecutorsForClient.awaitTermination(TEST_TIME_MS, TimeUnit.MILLISECONDS); reproduceAndCheckState(mCreateFileThread.getSuccessNum()); // clean up cluster.stopUFS(); }
private static boolean checkStatus() throws Exception { // Connect to Master and check if all the test operations are reproduced by Master successfully. for (ClientThread clientThread : sClientThreadList) { ClientOpType opType = clientThread.getOpType(); String workDir = clientThread.getWorkDir(); int successNum = clientThread.getSuccessNum(); LOG.info( "Expected Status: OpType[{}] WorkDir[{}] SuccessNum[{}].", opType, workDir, successNum); for (int s = 0; s < successNum; s++) { TachyonURI checkURI = new TachyonURI(workDir + s); if (ClientOpType.CREATE_FILE == opType) { try { sTfs.open(checkURI); } catch (Exception e) { // File not exist. This is unexpected for CREATE_FILE. LOG.error("File not exist for create test. Check failed! File: {}", checkURI); return false; } } else if (ClientOpType.CREATE_DELETE_FILE == opType) { try { sTfs.open(checkURI); } catch (Exception e) { // File not exist. This is expected for CREATE_DELETE_FILE. continue; } LOG.error("File exists for create/delete test. Check failed! File: {}", checkURI); return false; } else if (ClientOpType.CREATE_RENAME_FILE == opType) { try { sTfs.open(new TachyonURI(checkURI + "-rename")); } catch (Exception e) { // File not exist. This is unexpected for CREATE_RENAME_FILE. LOG.error( "File not exist for create/rename test. Check failed! File: {}-rename", checkURI); return false; } } // else if (ClientOpType.CREATE_TABLE == opType) { // if (tfs.getRawTable(new TachyonURI(workDir + s)).getId() == -1) { // tfs.close(); // return false; // } // } } } return true; }
@Ignore @Test public void multiMasterJournalCrashIntegrationTest() throws Exception { LocalTachyonClusterMultiMaster cluster = setupMultiMasterCluster(); // Kill the leader one by one. for (int kills = 0; kills < TEST_NUM_MASTERS; kills++) { CommonUtils.sleepMs(TEST_TIME_MS); Assert.assertTrue(cluster.killLeader()); } cluster.stopTFS(); CommonUtils.sleepMs(TEST_TIME_MS); // Ensure the client threads are stopped. mExecutorsForClient.shutdown(); while (!mExecutorsForClient.awaitTermination(TEST_TIME_MS, TimeUnit.MILLISECONDS)) {} reproduceAndCheckState(mCreateFileThread.getSuccessNum()); // clean up cluster.stopUFS(); }