Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EC179200B17 for ; Tue, 7 Jun 2016 07:03:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EACAA160A55; Tue, 7 Jun 2016 05:03:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3ECCD160A24 for ; Tue, 7 Jun 2016 07:03:22 +0200 (CEST) Received: (qmail 50606 invoked by uid 500); 7 Jun 2016 05:03:21 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 50585 invoked by uid 99); 7 Jun 2016 05:03:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2016 05:03:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 000F22C1F61 for ; Tue, 7 Jun 2016 05:03:20 +0000 (UTC) Date: Tue, 7 Jun 2016 05:03:20 +0000 (UTC) From: "Matteo Bertozzi (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-15975) logic in TestHTableDescriptor#testAddCoprocessorWithSpecStr is wrong MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 07 Jun 2016 05:03:23 -0000 [ https://issues.apache.org/jira/browse/HBASE-15975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15317855#comment-15317855 ] Matteo Bertozzi commented on HBASE-15975: ----------------------------------------- I had an hard time to read this test with the use of "expected" without having it reset every step. can you change the test to avoid the use of "expected" and do something like a bit more readable like: {code} // Try double add of same coprocessor try { htd.addCoprocessorWithSpec(spec); fatal(); // the coproc already exist so we should fail with IOException } catch (IOException ioe) { // We expect Coprocessor com.foo.FooRegionObserver already exists. } {code} > logic in TestHTableDescriptor#testAddCoprocessorWithSpecStr is wrong > -------------------------------------------------------------------- > > Key: HBASE-15975 > URL: https://issues.apache.org/jira/browse/HBASE-15975 > Project: HBase > Issue Type: Bug > Components: test > Affects Versions: master > Reporter: huaxiang sun > Assignee: huaxiang sun > Priority: Trivial > Attachments: HBASE-15975-v001.patch > > > While working on an unitest case for HBASE-14644, crossed over > testAddCoprocessorWithSpecStr(). > {code} > HTableDescriptor htd = new HTableDescriptor(TableName.META_TABLE_NAME); > String cpName = "a.b.c.d"; > boolean expected = false; > try { > htd.addCoprocessorWithSpec(cpName); > } catch (IllegalArgumentException iae) { > expected = true; > } > if (!expected) fail(); > // Try minimal spec. > try { > htd.addCoprocessorWithSpec("file:///some/path" + "|" + cpName); > } catch (IllegalArgumentException iae) { > expected = false; > } > if (expected) fail(); > // Try more spec. > String spec = "hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2"; > try { > htd.addCoprocessorWithSpec(spec); > } catch (IllegalArgumentException iae) { > expected = false; <<<< It should be true as it is expected to succeed. > } > if (expected) fail(); > // Try double add of same coprocessor > try { > htd.addCoprocessorWithSpec(spec); > } catch (IOException ioe) { > expected = true; > } > if (!expected) fail(); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)