HDFS-13159. TestTruncateQuotaUpdate fails in trunk. Contributed by Nanda kumar.

This commit is contained in:
Arpit Agarwal 2018-02-20 10:57:35 -08:00
parent 7280c5af82
commit 9028ccaf83
1 changed files with 6 additions and 4 deletions

View File

@ -22,6 +22,8 @@ import org.apache.hadoop.fs.permission.PermissionStatus;
import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous;
import org.apache.hadoop.hdfs.server.namenode.snapshot.DiffList;
import org.apache.hadoop.hdfs.server.namenode.snapshot.DiffListByArrayList;
import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff;
import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiffList; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiffList;
import org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature;
@ -156,11 +158,11 @@ public class TestTruncateQuotaUpdate {
FileDiff diff = mock(FileDiff.class); FileDiff diff = mock(FileDiff.class);
when(diff.getBlocks()).thenReturn(blocks); when(diff.getBlocks()).thenReturn(blocks);
FileDiffList diffList = new FileDiffList(); FileDiffList diffList = new FileDiffList();
Whitebox.setInternalState(diffList, "diffs", new ArrayList<FileDiff>()); Whitebox.setInternalState(diffList, "diffs", new DiffListByArrayList<>(0));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ArrayList<FileDiff> diffs = ((ArrayList<FileDiff>)Whitebox.getInternalState DiffList<FileDiff> diffs = (DiffList<FileDiff>)Whitebox.getInternalState(
(diffList, "diffs")); diffList, "diffs");
diffs.add(diff); diffs.addFirst(diff);
FileWithSnapshotFeature sf = new FileWithSnapshotFeature(diffList); FileWithSnapshotFeature sf = new FileWithSnapshotFeature(diffList);
file.addFeature(sf); file.addFeature(sf);
} }