From commits-return-14123-archive-asf-public=cust-asf.ponee.io@hudi.apache.org Wed Mar 25 03:08:26 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id CC5C518065C for ; Wed, 25 Mar 2020 04:08:25 +0100 (CET) Received: (qmail 64825 invoked by uid 500); 25 Mar 2020 03:08:25 -0000 Mailing-List: contact commits-help@hudi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hudi.apache.org Delivered-To: mailing list commits@hudi.apache.org Received: (qmail 64814 invoked by uid 99); 25 Mar 2020 03:08:25 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Mar 2020 03:08:25 +0000 From: GitBox To: commits@hudi.apache.org Subject: [GitHub] [incubator-hudi] leesf commented on a change in pull request #1436: [HUDI-711] Refactor exporter main logic Message-ID: <158510570502.18760.17160228569710431221.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Wed, 25 Mar 2020 03:08:25 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit leesf commented on a change in pull request #1436: [HUDI-711] Refactor exporter main logic URL: https://github.com/apache/incubator-hudi/pull/1436#discussion_r397584926 ########## File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHoodieSnapshotExporter.java ########## @@ -159,18 +161,85 @@ public void testExportAsHudi() throws IOException { assertTrue(dfs.exists(new Path(partition + "/.hoodie_partition_metadata"))); assertTrue(dfs.exists(new Path(targetPath + "/_SUCCESS"))); } + } + + public static class TestHoodieSnapshotExporterForEarlyAbort extends ExporterTestHarness { + + private HoodieSnapshotExporter.Config cfg; + + @Before + public void setUp() throws Exception { + super.setUp(); + cfg = new Config(); + cfg.sourceBasePath = sourcePath; + cfg.targetOutputPath = targetPath; + cfg.outputFormat = OutputFormatValidator.HUDI; + } @Test - public void testExportEmptyDataset() throws IOException { + public void testExportWhenTargetPathExists() throws IOException { + // make target output path present + dfs.mkdirs(new Path(targetPath)); + + // export + Throwable t = null; + try { + new HoodieSnapshotExporter().export(jsc, cfg); + } catch (Exception e) { + t = e; + } finally { + assertNotNull(t); + assertTrue(t instanceof HoodieSnapshotExporterException); + assertEquals("The target output path already exists.", t.getMessage()); Review comment: would move to catch ? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services