Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4E8110DF0 for ; Thu, 5 Feb 2015 08:29:35 +0000 (UTC) Received: (qmail 56241 invoked by uid 500); 5 Feb 2015 08:29:35 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 56183 invoked by uid 500); 5 Feb 2015 08:29:35 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 56170 invoked by uid 99); 5 Feb 2015 08:29:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Feb 2015 08:29:35 +0000 Date: Thu, 5 Feb 2015 08:29:35 +0000 (UTC) From: "Konstantin Shvachko (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-7738) Add more negative tests for truncate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14306822#comment-14306822 ] Konstantin Shvachko commented on HDFS-7738: ------------------------------------------- Hey Nicholas, agreed more test cases is a good idea. Few comments on the patch: # I would wrap the {{op}} parameter in {{recoverLeaseInternal()}} as {{enum}} rather than passing an arbitrary string. # The if-esle statement in {{testBasicTruncate()}} can be replaced with a single assert {code} assertEquals("File is expected to be closed only for truncates to the block boundary", isReady, (toTruncate == 0 || newLength % BLOCK_SIZE == 0)); {code} I think comments in asserts are important. # Why extra bracket blocks in {{testTruncateFailure()}}? I don't think freeing local variables worth it. # In {{testTruncateFailure()}} you should probably handle {{InterruptedException}} rather than passing it through the test case. > 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 > > > 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)