[ 
https://issues.apache.org/jira/browse/DRILL-5973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16273796#comment-16273796
 ] 

ASF GitHub Bot commented on DRILL-5973:
---------------------------------------

Github user kkhatua commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1055#discussion_r154248904
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/testing/TestPauseInjection.java
 ---
    @@ -144,6 +144,34 @@ public void pauseInjected() {
         }
       }
     
    +  @Test
    +  public void timedPauseInjected() {
    +    final long pauseDuration = 2000L;
    +    final long expectedDuration = pauseDuration;
    +    final ExtendedLatch trigger = new ExtendedLatch(1);
    +    final Pointer<Exception> ex = new Pointer<>();
    +    final String controls = Controls.newBuilder()
    +      .addTimedPause(DummyClass.class, DummyClass.PAUSES, 0, pauseDuration)
    +      .build();
    +
    +    ControlsInjectionUtil.setControls(session, controls);
    +
    +    final QueryContext queryContext = new QueryContext(session, 
bits[0].getContext(), QueryId.getDefaultInstance());
    +    //We don't need a ResumingThread because this should automatically 
resume
    +
    +    // 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);
    +    try {
    +      queryContext.close();
    +    } catch (final Exception e) {
    +      fail("Failed to close query context: " + e);
    --- End diff --
    
    ```
    did you forget to remove that part following up on your other change?
    ```
    Didn't forget to remove. It drives the logger to publish the message in the 
debugger as time-bound if it is non-zero.


> Support injection of time-bound pauses in server
> ------------------------------------------------
>
>                 Key: DRILL-5973
>                 URL: https://issues.apache.org/jira/browse/DRILL-5973
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Tools, Build & Test
>    Affects Versions: 1.11.0
>            Reporter: Kunal Khatua
>            Assignee: Kunal Khatua
>             Fix For: 1.13.0
>
>
> While working on DRILL-3640 , when creating a unit test for a server-induced 
> timeout, the injecting a pause leaves the JUnit framework's DrillClient 
> without a handle to the query on the server. This is because we injected the 
> pause to occur before the server could send back a query ID, so the 
> DrillClient has no way to unpause the server.
> The workaround to support this unit test is to allow for injecting pauses 
> with a defined time-bound, after which the server would resume.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to