HDFS-8785. TestDistributedFileSystem is failing in trunk. Contributed by Xiaoyu Yao.
This commit is contained in:
parent
1df78688c6
commit
2196e39e14
@ -1084,6 +1084,8 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HDFS-8810. Correct assertions in TestDFSInotifyEventInputStream class.
|
HDFS-8810. Correct assertions in TestDFSInotifyEventInputStream class.
|
||||||
(Surendra Singh Lilhore via aajisaka)
|
(Surendra Singh Lilhore via aajisaka)
|
||||||
|
|
||||||
|
HDFS-8785. TestDistributedFileSystem is failing in trunk. (Xiaoyu Yao)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -1189,19 +1189,22 @@ public void testDFSClientPeerWriteTimeout() throws IOException {
|
|||||||
try {
|
try {
|
||||||
cluster.waitActive();
|
cluster.waitActive();
|
||||||
DistributedFileSystem dfs = cluster.getFileSystem();
|
DistributedFileSystem dfs = cluster.getFileSystem();
|
||||||
// Write 1 MB to a dummy socket to ensure the write times out
|
// Write 10 MB to a dummy socket to ensure the write times out
|
||||||
ServerSocket socket = new ServerSocket(0);
|
ServerSocket socket = new ServerSocket(0);
|
||||||
Peer peer = dfs.getClient().newConnectedPeer(
|
Peer peer = dfs.getClient().newConnectedPeer(
|
||||||
(InetSocketAddress) socket.getLocalSocketAddress(), null, null);
|
(InetSocketAddress) socket.getLocalSocketAddress(), null, null);
|
||||||
long start = Time.now();
|
long start = Time.now();
|
||||||
try {
|
try {
|
||||||
byte[] buf = new byte[1024 * 1024];
|
byte[] buf = new byte[10 * 1024 * 1024];
|
||||||
peer.getOutputStream().write(buf);
|
peer.getOutputStream().write(buf);
|
||||||
Assert.fail("write should timeout");
|
long delta = Time.now() - start;
|
||||||
|
Assert.fail("write finish in " + delta + " ms" + "but should timedout");
|
||||||
} catch (SocketTimeoutException ste) {
|
} catch (SocketTimeoutException ste) {
|
||||||
long delta = Time.now() - start;
|
long delta = Time.now() - start;
|
||||||
Assert.assertTrue("write timedout too soon", delta >= timeout * 0.9);
|
Assert.assertTrue("write timedout too soon in " + delta + " ms",
|
||||||
Assert.assertTrue("write timedout too late", delta <= timeout * 1.1);
|
delta >= timeout * 0.9);
|
||||||
|
Assert.assertTrue("write timedout too late in " + delta + " ms",
|
||||||
|
delta <= timeout * 1.2);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Assert.fail("wrong exception:" + t);
|
Assert.fail("wrong exception:" + t);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user