[
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14310394#comment-14310394
]
Konstantin Shvachko commented on HDFS-7738:
-------------------------------------------
# Since you kept TestHAAppend in the patch I'd suggest to simplify
{{randomFilePartition()}}. Something like
{code}
public static int[] randomFilePartition(int n, int parts) {
assert n > parts : "n=" + n + " should exceed parts=" + parts;
int[] p = new int[parts];
for(int i=0, left=0, right=n-parts; i < parts; left=p[i], right++, i++) {
p[i] = nextInt(right - left) + left;
}
return p;
}
{code}
# We also need to log the partitions somewhere to be able to reproduce if
something fails.
# The test is consistently passing now.
> I think it is good enough. Agree?
I will not argue. But I do not support your preoccupation with random tests, as
they introduce non-determinism. Random mix of operations is very good as a
stand alone application, which you can run overnight or for a few days. Such
apps can be incorporated say with BigTop, but they make poor unit tests, imho.
> Add more negative tests for truncate
> ------------------------------------
>
> Key: HDFS-7738
> URL: https://issues.apache.org/jira/browse/HDFS-7738
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: test
> Reporter: Tsz Wo Nicholas Sze
> Assignee: Tsz Wo Nicholas Sze
> Priority: Minor
> Fix For: 2.7.0
>
> Attachments: h7738_20150204.patch, h7738_20150205.patch,
> h7738_20150205b.patch, h7738_20150206.patch, h7738_20150206b.patch
>
>
> The following are negative test cases for truncate.
> - new length > old length
> - truncating a directory
> - truncating a non-existing file
> - truncating a file without write permission
> - truncating a file opened for append
> - truncating a file in safemode
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)