Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Solve #1691, fix TestCopy2S3Scheduler.testDir (#1705)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyuangong committed May 4, 2018
1 parent d9303fb commit 9e8841e
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.smartdata.model.FileState;
import org.smartdata.model.RuleState;
import org.smartdata.model.S3FileState;
import org.smartdata.server.engine.CmdletManager;

import java.util.List;

Expand All @@ -39,7 +38,6 @@ public void testDir() throws Exception {
waitTillSSMExitSafeMode();
MetaStore metaStore = ssm.getMetaStore();
SmartAdmin admin = new SmartAdmin(smartContext.getConf());
CmdletManager cmdletManager = ssm.getCmdletManager();
DistributedFileSystem dfs = cluster.getFileSystem();
final String srcPath = "/src/";
dfs.mkdirs(new Path(srcPath));
Expand All @@ -57,15 +55,13 @@ public void testDir() throws Exception {
actions = metaStore.getActions(ruleId, 0);
Thread.sleep(1000);
} while (actions.size() < 3);
Assert.assertTrue(actions.size() == 3);
}

@Test(timeout = 45000)
public void testZeroLength() throws Exception {
waitTillSSMExitSafeMode();
MetaStore metaStore = ssm.getMetaStore();
SmartAdmin admin = new SmartAdmin(smartContext.getConf());
CmdletManager cmdletManager = ssm.getCmdletManager();
DistributedFileSystem dfs = cluster.getFileSystem();
final String srcPath = "/src/";
dfs.mkdirs(new Path(srcPath));
Expand All @@ -80,15 +76,14 @@ public void testZeroLength() throws Exception {
RuleState.ACTIVE);
Thread.sleep(2500);
List<ActionInfo> actions = metaStore.getActions(ruleId, 0);
Assert.assertTrue(actions.size() == 0);
Assert.assertEquals(actions.size(), 0);
}

@Test(timeout = 45000)
public void testOnS3() throws Exception {
waitTillSSMExitSafeMode();
MetaStore metaStore = ssm.getMetaStore();
SmartAdmin admin = new SmartAdmin(smartContext.getConf());
CmdletManager cmdletManager = ssm.getCmdletManager();
DistributedFileSystem dfs = cluster.getFileSystem();
final String srcPath = "/src/";
dfs.mkdirs(new Path(srcPath));
Expand All @@ -98,6 +93,7 @@ public void testOnS3() throws Exception {
// Not 0 because this file may be not be truncated yet
DFSTestUtil.createFile(dfs, new Path(srcPath + i),
10, (short) 1, 1);
// Add S3 Statuses
FileState fileState = new S3FileState(srcPath + i);
metaStore.insertUpdateFileState(fileState);
}
Expand All @@ -107,6 +103,6 @@ public void testOnS3() throws Exception {
RuleState.ACTIVE);
Thread.sleep(2500);
List<ActionInfo> actions = metaStore.getActions(ruleId, 0);
Assert.assertTrue(actions.size() == 0);
Assert.assertEquals(actions.size(), 0);
}
}

0 comments on commit 9e8841e

Please sign in to comment.