You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by "Corey A Stubbs (JIRA)" <ji...@apache.org> on 2016/04/11 16:32:25 UTC

[jira] [Created] (TOREE-296) Migrate System Tests To Use Jupyter Kernel Test

Corey A Stubbs created TOREE-296:
------------------------------------

             Summary: Migrate System Tests To Use Jupyter Kernel Test
                 Key: TOREE-296
                 URL: https://issues.apache.org/jira/browse/TOREE-296
             Project: TOREE
          Issue Type: Test
            Reporter: Corey A Stubbs
            Priority: Critical


Unreliable system tests were removed for the 0.1.0 release. These tests should be migrated to use the [jupyter kernel test|https://github.com/jupyter/jupyter_kernel_test] project.  I have included the pseudocode/comments from the system tests which were removed.

{code:file=TruncationTests.scala}
describe( "Test Truncation") {
  it("should show or not show types based on %showtypes") {
    // Run the code on the kernel
    """%showtypes off
      |1
    """
    // Assert the output should end with "1"
    
    // Run the code on the kernel
    """%showtypes on
      |1
    """
    // Assert the output should be "Int = 1"
    
    // Run the code on the kernel  
    """%showtypes off
    |1
    """
    // Assert the output should end with "1"
  }
  it("should truncate or not truncate based on %truncate") {

    // Run the code on the kernel
    "for ( a <-  1 to 300 ) yield a" 
    // Assert the output should end with "..."

    // Run the code on the kernel
    """%Truncation off
      |for ( a <-  1 to 300 ) yield a
    """
    // Assert the output should end with "300"

      // Run the code on the kernel
      """%Truncation on
        |for ( a <-  1 to 300 ) yield a
      """ 
      // Assert the output should end with "..."
  }
}
{code}

{code:file=KernelCommSpecForSystem.scala}
describe("Comm for Kernel System") {
  describe("executing Comm API to open a new comm") {
    it("should correctly send comm_open to socket") {
      //  Send the following code to the kernel
      """
        |kernel.comm.open("$testTargetName")
      """
      // Assert CommOpen message was received
    }
  }

  describe("executing Comm API to send a message") {
    it("should correctly send comm_msg to socket") {
      //  Send the following code to the kernel
      s"""
         |val commWriter = kernel.comm.open("$testTargetName")
         |commWriter.writeMsg(
         |   org.apache.toree.kernel.protocol.v5.MsgData("key" -> "value")
         |)
        """
      // Assert CommMsg was received with msg.data.key == 'value'
    }
  }

  describe("executing Comm API to close an existing comm") {
    it("should correctly send comm_close to socket") {
      //  Send the following code to the kernel
      s"""
         |val commWriter = kernel.comm.open("$testTargetName")
         |commWriter.close()
        """
      //  Assert CommClose was sent
    }
  }

  describe("receiving Comm API open from a client") {
    it("should respond comm_close if the target is not found") {
      //  Send a CommOpen for a non-existent target
      //  Assert we receive a CommClose for that target
    }
  }

  it("should not execute open callbacks if the target is not found") {
    // Create a comm open  callback
    // Send a comm_open (as if a client did it) with wrong target
    // Assert the open was never called
  }

  it("should execute open callbacks if the target is found") {
    // Create a callback for our comm target
    // Send a comm_open (as if a client did it)
    // Assert the comm callback is called
  }
}

    describe("receiving Comm API message from a client") {
      it("should not execute message callbacks if the Comm id is not found") {
        // Create a callback for our comm target
        // Set up the Comm id prior so we have a proper link
        // Send a comm_msg (as if a client did it) to the incorrect id
        // Assert the comm callback is not called
      }

      it("should execute message callbacks if the Comm id is found") {
          // Create a callback for our comm target
          // Set up the Comm id prior so we have a proper link
          // Send a comm_msg (as if a client did it)
          // Assert the comm callback is called
        }
    }

    describe("receiving Comm API close from a client") {
      it("should not execute close callbacks if the Comm id is not found") {
        // Create a callback for our comm target
        // Set up a Comm id prior so we have a proper link
        // Send a comm_close to the incorrect Comm id
        // Assert our callback is not called
      }

      it("should execute close callbacks if the Comm id is found") {
        // Create a callback for our comm target
        // Set up a Comm id prior so we have a proper link
        // Send a comm_close
        // Assert our callback is called
      }

      it("should unlink the Comm id from the target if the Comm id is found") {
        // Create a callback for our comm target
        // Set up a Comm id prior so we have a proper link
        // Send a comm_close
        // Assert our callback is called
        // Send a comm_close (again) with the expectation that nothing happens
        // Assert our callback is not called again
      }
    }

}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)