You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@predictionio.apache.org by mars <gi...@git.apache.org> on 2017/03/08 23:51:22 UTC

[GitHub] incubator-predictionio-template-skeleton pull request #5: Example Tests

GitHub user mars opened a pull request:

    https://github.com/apache/incubator-predictionio-template-skeleton/pull/5

    Example Tests

    This skeleton repo seems to be the authoritative starting point for creating a new engine. Since testing is a great way to improve collaboration and reliability, what do you think about including example tests in the skeleton?
    
    Here I implemented tests with a [ScalaTest](http://www.scalatest.org) suite which includes a mixin `SharedSingletonContext` to make a Spark context available as `SparkContext`.
    
    Each of the engine-defined classes now has a tiny passing test: `AlgorithmTest`, `EngineTest`, `PreparatorTest`, & `ServingTest`.
    
    `DataSourceTest` is the outlier and so currently tagged **ignore**. It's difficult to test in the skeleton, because it requires a database connection as well as database cleansing or transaction isolation between tests.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mars/incubator-predictionio-template-skeleton example-tests

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-predictionio-template-skeleton/pull/5.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5
    
----
commit a6954e9bc7bd53fc47e5150f6132757e740b42a5
Author: Mars Hall <ma...@heroku.com>
Date:   2017-03-08T21:29:45Z

    Implement tests in template skeleton.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-predictionio-template-skeleton issue #5: Example Tests

Posted by dszeto <gi...@git.apache.org>.
Github user dszeto commented on the issue:

    https://github.com/apache/incubator-predictionio-template-skeleton/pull/5
  
    Thanks! Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-predictionio-template-skeleton issue #5: Example Tests

Posted by mars <gi...@git.apache.org>.
Github user mars commented on the issue:

    https://github.com/apache/incubator-predictionio-template-skeleton/pull/5
  
    I've been trying to support `DataSourceTest` using an in-memory H2 database. Unfortunately, that's currently failing with:
    
    ```
    [info] DataSourceTest:
    [info] readTraining
    [info] - should return the data *** FAILED ***
    [info]   java.lang.IllegalStateException: Connection pool is not yet initialized.(name:'default)
    [info]   at scalikejdbc.ConnectionPool$$anonfun$get$1.apply(ConnectionPool.scala:57)
    [info]   at scalikejdbc.ConnectionPool$$anonfun$get$1.apply(ConnectionPool.scala:55)
    [info]   at scala.Option.getOrElse(Option.scala:120)
    [info]   at scalikejdbc.ConnectionPool$.get(ConnectionPool.scala:55)
    [info]   at scalikejdbc.ConnectionPool$.apply(ConnectionPool.scala:46)
    [info]   at scalikejdbc.DB$.connectionPool(DB.scala:150)
    [info]   at scalikejdbc.DB$.autoCommit(DB.scala:213)
    [info]   at org.apache.predictionio.data.storage.jdbc.JDBCApps.<init>(JDBCApps.scala:32)
    [info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    ```
    
    \u2026which seems to be caused by [this `DB autoCommit` call in the JDBC initializer](https://github.com/apache/incubator-predictionio/blob/release/0.10.0/data/src/main/scala/org/apache/predictionio/data/storage/jdbc/JDBCApps.scala#L32).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-predictionio-template-skeleton pull request #5: Example Tests

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-predictionio-template-skeleton/pull/5


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---