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 C934D200D04 for ; Mon, 11 Sep 2017 19:11:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C7BB61609C4; Mon, 11 Sep 2017 17:11:55 +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 1A9641609B7 for ; Mon, 11 Sep 2017 19:11:54 +0200 (CEST) Received: (qmail 14125 invoked by uid 500); 11 Sep 2017 17:11:53 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 14114 invoked by uid 99); 11 Sep 2017 17:11:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Sep 2017 17:11:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 71842F576E; Mon, 11 Sep 2017 17:11:53 +0000 (UTC) From: ilooner To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #923: DRILL-5723: Added System Internal Options That can ... Content-Type: text/plain Message-Id: <20170911171153.71842F576E@git1-us-west.apache.org> Date: Mon, 11 Sep 2017 17:11:53 +0000 (UTC) archived-at: Mon, 11 Sep 2017 17:11:56 -0000 Github user ilooner commented on a diff in the pull request: https://github.com/apache/drill/pull/923#discussion_r138133008 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/testing/TestPauseInjection.java --- @@ -150,66 +150,61 @@ public void pauseOnSpecificBit() { final ZookeeperHelper zkHelper = new ZookeeperHelper(); zkHelper.startZookeeper(1); - // Creating two drillbits - final Drillbit drillbit1, drillbit2; - final DrillConfig drillConfig = zkHelper.getConfig(); try { - drillbit1 = Drillbit.start(drillConfig, remoteServiceSet); - drillbit2 = Drillbit.start(drillConfig, remoteServiceSet); - } catch (final DrillbitStartupException e) { - throw new RuntimeException("Failed to start two drillbits.", e); - } - - final DrillbitContext drillbitContext1 = drillbit1.getContext(); - final DrillbitContext drillbitContext2 = drillbit2.getContext(); - - final UserSession session = UserSession.Builder.newBuilder() - .withCredentials(UserCredentials.newBuilder() - .setUserName("foo") - .build()) - .withUserProperties(UserProperties.getDefaultInstance()) - .withOptionManager(drillbitContext1.getOptionManager()) - .build(); - - final DrillbitEndpoint drillbitEndpoint1 = drillbitContext1.getEndpoint(); - final String controls = Controls.newBuilder() - .addPauseOnBit(DummyClass.class, DummyClass.PAUSES, drillbitEndpoint1) - .build(); - - ControlsInjectionUtil.setControls(session, controls); - - { - final long expectedDuration = 1000L; - final ExtendedLatch trigger = new ExtendedLatch(1); - final Pointer ex = new Pointer<>(); - final QueryContext queryContext = new QueryContext(session, drillbitContext1, QueryId.getDefaultInstance()); - (new ResumingThread(queryContext, trigger, ex, expectedDuration)).start(); - - // test that the pause happens - final DummyClass dummyClass = new DummyClass(queryContext, trigger); - final long actualDuration = dummyClass.pauses(); - assertTrue(String.format("Test should stop for at least %d milliseconds.", expectedDuration), - expectedDuration <= actualDuration); - assertTrue("No exception should be thrown.", ex.value == null); + // Creating two drillbits + final Drillbit drillbit1, drillbit2; + final DrillConfig drillConfig = zkHelper.getConfig(); try { - queryContext.close(); - } catch (final Exception e) { - fail("Failed to close query context: " + e); + drillbit1 = Drillbit.start(drillConfig, remoteServiceSet); + drillbit2 = Drillbit.start(drillConfig, remoteServiceSet); + } catch (final DrillbitStartupException e) { + throw new RuntimeException("Failed to start two drillbits.", e); } - } - { - final ExtendedLatch trigger = new ExtendedLatch(1); - final QueryContext queryContext = new QueryContext(session, drillbitContext2, QueryId.getDefaultInstance()); + final DrillbitContext drillbitContext1 = drillbit1.getContext(); + final DrillbitContext drillbitContext2 = drillbit2.getContext(); + + final UserSession session = UserSession.Builder.newBuilder().withCredentials(UserCredentials.newBuilder().setUserName("foo").build()).withUserProperties(UserProperties.getDefaultInstance()).withOptionManager(drillbitContext1.getOptionManager()).build(); --- End diff -- done ---