You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by va...@apache.org on 2019/02/15 23:18:51 UTC

[incubator-livy] branch master updated: [LIVY-556] HearbeatExpired is not stubbed correctly in test cases

This is an automated email from the ASF dual-hosted git repository.

vanzin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d9b453  [LIVY-556] HearbeatExpired is not stubbed correctly in test cases
7d9b453 is described below

commit 7d9b453780a11abb92e8c0cb504a894c174c01a8
Author: Meisam Fathi <me...@gmail.com>
AuthorDate: Fri Feb 15 15:18:45 2019 -0800

    [LIVY-556] HearbeatExpired is not stubbed correctly in test cases
    
    ## What changes were proposed in this pull request?
    Add the proper stubbing to all mocked interactive sessions to make sure session heartbeats work correctly.
    
    ## How was this patch tested?
    This change only fixes the test cases. It is not changing production code.
    
    Author: Meisam Fathi <me...@gmail.com>
    
    Closes #143 from meisam/LIVY-556.
---
 .../apache/livy/server/interactive/InteractiveSessionServletSpec.scala  | 2 ++
 server/src/test/scala/org/apache/livy/sessions/SessionManagerSpec.scala | 1 +
 2 files changed, 3 insertions(+)

diff --git a/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionServletSpec.scala b/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionServletSpec.scala
index 0b061fa..c97aa19 100644
--- a/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionServletSpec.scala
+++ b/server/src/test/scala/org/apache/livy/server/interactive/InteractiveSessionServletSpec.scala
@@ -67,6 +67,7 @@ class InteractiveSessionServletSpec extends BaseInteractiveServletSpec {
       when(session.state).thenReturn(SessionState.Idle)
       when(session.stop()).thenReturn(Future.successful(()))
       when(session.proxyUser).thenReturn(None)
+      when(session.heartbeatExpired).thenReturn(false)
       when(session.statements).thenAnswer(
         new Answer[IndexedSeq[Statement]]() {
           override def answer(args: InvocationOnMock): IndexedSeq[Statement] = statements
@@ -179,6 +180,7 @@ class InteractiveSessionServletSpec extends BaseInteractiveServletSpec {
     when(session.kind).thenReturn(kind)
     when(session.appInfo).thenReturn(appInfo)
     when(session.logLines()).thenReturn(log)
+    when(session.heartbeatExpired).thenReturn(false)
 
     val req = mock[HttpServletRequest]
 
diff --git a/server/src/test/scala/org/apache/livy/sessions/SessionManagerSpec.scala b/server/src/test/scala/org/apache/livy/sessions/SessionManagerSpec.scala
index 523e1d7..193d95b 100644
--- a/server/src/test/scala/org/apache/livy/sessions/SessionManagerSpec.scala
+++ b/server/src/test/scala/org/apache/livy/sessions/SessionManagerSpec.scala
@@ -99,6 +99,7 @@ class SessionManagerSpec extends FunSpec with Matchers with LivyBaseUnitTestSuit
       when(session.name).thenReturn(None)
       when(session.stop()).thenReturn(Future {})
       when(session.lastActivity).thenReturn(System.nanoTime())
+      when(session.heartbeatExpired).thenReturn(false)
 
       val conf = new LivyConf().set(LivyConf.SESSION_TIMEOUT_CHECK, false)
         .set(LivyConf.SESSION_STATE_RETAIN_TIME, "1s")