[jira] Created: (SOLR-3) create test harness and port TestApp to junit

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
create test harness and port TestApp to junit
---------------------------------------------

         Key: SOLR-3
         URL: http://issues.apache.org/jira/browse/SOLR-3
     Project: Solr
        Type: Task
    Reporter: Hoss Man
    Priority: Minor


To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)

Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)


Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.



--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
     [ http://issues.apache.org/jira/browse/SOLR-3?page=all ]

Hoss Man updated SOLR-3:
------------------------

    Attachment: TestHarness.java
                TestBasicFunctionality.java

Here's what i've got so far, still a work in progress -- but you can see the basic idea.

I was trying to avoid putting anything junit specific in the TestHarness, but it definitely looks like having an abstract subclass of TestCase that provides some assert methods that can take in adds or requests/xpaths and validate directly would make hte tests easier to read.

Any comments would be appreacited.

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task
>     Reporter: Hoss Man
>     Priority: Minor
>  Attachments: TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12370211 ]

Yonik Seeley commented on SOLR-3:
---------------------------------

Looking good Hoss!

There are probably some opportunities to use Java5 stuff like varargs...
  doc("id",42,"subject","easy")

Also what we really need is a way to dynamically add/create a schema, so one could add a new analysis filter,
then define a fieldtype & field that uses it and test it out, without modifying some global testing schema.

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task
>     Reporter: Hoss Man
>     Priority: Minor
>  Attachments: TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12370218 ]

Hoss Man commented on SOLR-3:
-----------------------------

>There are probably some opportunities to use Java5 stuff like varargs...
>  doc("id",42,"subject","easy")

...i'm doing that in validateAddDoc (which calls makeSimpleDoc) ... are there other methods you think it also makes sense for?

> Also what we really need is a way to dynamically add/create a schema, so one could add
> a new analysis filter,
> then define a fieldtype & field that uses it and test it out, without modifying some global
> testing schema.

i was operating under the assumption that for stuff like that, the best thing to do would be to have multiple sets of solrconfig/schema files ... for Solr itself there would probably be one big generic file that most tests could use, but any test that wanted to try something exotic would check in a new one (in a directory with the same name as the test class) and speciy it when constructing hte harness.

the only flaw in that plan right now is that SolrCore only lets you specify a schema file path when you construct it, not a solrconfig, but i was going to tackle refactoring that once i had the basics up and running.

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task
>     Reporter: Hoss Man
>     Priority: Minor
>  Attachments: TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
     [ http://issues.apache.org/jira/browse/SOLR-3?page=all ]

Hoss Man updated SOLR-3:
------------------------

    Attachment: SOLR-3.zip

zip file contains a bunch of code and a patch file that modifies the build.xml and XML.java

the new code consists of:
  * the TestHarness from before (with a few additions) which should be usefull for interacting with a SolrCore independent of any specific testing framework
   * a new AbstractSolrTestCase that is designed to make it easy to write JUnit tests in particular.
   * a Sample test, and a short test of the basic Solr functions that demonstrate "best practices" of the AbstractSolrTestCase
   * a ConvertedLegacyTest which is a progromatic translation of src/apps/SolrTest/newtest.txt (the converstion perl script is included in the zip for refrence, but i wasn't planning on commiting it.)

this represents 95% of what i think we need as far as a good testing framework moving forward: the last 5% being modifications to SolrConfig so that individual tests can use different solrconfig.xml files. Even without that, this code can be commited as is -- tests will just have to share a solrconfig.xml for the time being, but they can use unique schema files.



The only hitch with all of this, is that i seem to have a filehandle leak somewhere.  Or at least i think i do ... running "ant legacyTest" works fine with an openfiles limit of 1024, but "ant junit" runs out of filehandles using the same limit (at 2048 the test runs fine).  The index itself only contains about 100 files when this happens so i'm not sure what's going on.

If anyone can help me spot the problem, i'd appreciate it.

I'm going to take a look at it with some fresh eyes (and lsof) in the morning.

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

Re: [jira] Updated: (SOLR-3) create test harness and port TestApp to junit

Chris Hostetter-3

:      [ http://issues.apache.org/jira/browse/SOLR-3?page=all ]

: The only hitch with all of this, is that i seem to have a filehandle
: leak somewhere.  Or at least i think i do ... running "ant legacyTest"

I figured out the problem.  SolrQueryRequestBase maintains a handle to the
IndexSearcher it's using which is released when the
SolrQueryRequestBase.close() is called (i should have realized this, it's
the way Solr ensures a request gets a consistent view of the index no
matter how many underlying queries it makes.

adding this line near the end of TestHarness.query solved my problem...

    ((SolrQueryRequestBase)req).close();

...but that cast is obviously a hack.

I could change all of the method signatures in all of thes test classes
I've written to use LocalSolrQueryRequest instead of SolrQueryRequest --
in which case i wouldn't need the cast, and it wouldn't be a hack ... but
it still seems ugly.

is there any reason why SolrQueryRequest shouldn't have the close() method
be part of it's interface?

If no one objects, i'll change it tomorow and commit all of this code.

-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: [jira] Updated: (SOLR-3) create test harness and port TestApp to junit

Yonik Seeley
On 4/9/06, Chris Hostetter <[hidden email]> wrote:
> is there any reason why SolrQueryRequest shouldn't have the close() method
> be part of it's interface?

Nope... just an oversight since I was always using concrete implementations.

-Yonik
Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
     [ http://issues.apache.org/jira/browse/SOLR-3?page=all ]

Hoss Man reassigned SOLR-3:
---------------------------

    Assign To: Hoss Man

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Assignee: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12373961 ]

Hoss Man commented on SOLR-3:
-----------------------------

filehandle leak was resolved by closing requests, code was commited.

leaving issue open for now, pending sub-task to deal with solrconfig.xml loading, and a decission about wether we want to completely remove SolrTest or not.  (either way, we should copy/move the config/schema used by the tests somewhere under the test directory, and change the working directory of the JUnit tests)

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Assignee: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12375053 ]

Hoss Man commented on SOLR-3:
-----------------------------

Everything I set out to do is done. Should this issue be resolved, or should SolrTest be removed from the repository?

Does it serve any useful purpose now that we have the JUnit tests?

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Assignee: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12375416 ]

Yonik Seeley commented on SOLR-3:
---------------------------------

Yes, I suppose SolrTest can be removed <nostalgic sniff...>

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Assignee: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12375493 ]

Hoss Man commented on SOLR-3:
-----------------------------

Well, the one thing SolrTest could do that we don't have a replacement for that SolrTest was usefull for is load testing SolrCore -- it might make sense to leave that part in, but rip out the guts and replace it with using the SolrTestHarness.

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>          Key: SOLR-3
>          URL: http://issues.apache.org/jira/browse/SOLR-3
>      Project: Solr
>         Type: Task

>     Reporter: Hoss Man
>     Assignee: Hoss Man
>     Priority: Minor
>  Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12454254 ]
           
Hoss Man commented on SOLR-3:
-----------------------------

In the interest of reducing possible confusion (and since i haven't been motivated to refactor SolrTest to use SolrTestHarness in the last 6 months) i think maybe I should just svn remove solr/src/apps and the build.xml references to it before we have an official release.

we can always restore it in the future if there is a desire.

objections?

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>                 Key: SOLR-3
>                 URL: http://issues.apache.org/jira/browse/SOLR-3
>             Project: Solr
>          Issue Type: Task
>            Reporter: Hoss Man
>         Assigned To: Hoss Man
>            Priority: Minor
>         Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12454257 ]
           
Bertrand Delacretaz commented on SOLR-3:
----------------------------------------

No objection here, keeping the code clean is a Good Thing

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>                 Key: SOLR-3
>                 URL: http://issues.apache.org/jira/browse/SOLR-3
>             Project: Solr
>          Issue Type: Task
>            Reporter: Hoss Man
>         Assigned To: Hoss Man
>            Priority: Minor
>         Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
    [ http://issues.apache.org/jira/browse/SOLR-3?page=comments#action_12454331 ]
           
Yonik Seeley commented on SOLR-3:
---------------------------------

> maybe I should just svn remove solr/src/apps

+1

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>                 Key: SOLR-3
>                 URL: http://issues.apache.org/jira/browse/SOLR-3
>             Project: Solr
>          Issue Type: Task
>            Reporter: Hoss Man
>         Assigned To: Hoss Man
>            Priority: Minor
>         Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (SOLR-3) create test harness and port TestApp to junit

Tim Allison (Jira)
In reply to this post by Tim Allison (Jira)
     [ http://issues.apache.org/jira/browse/SOLR-3?page=all ]

Hoss Man resolved SOLR-3.
-------------------------

    Resolution: Fixed

TestApp removed ... thus ends the longest "In Progress" Solr issue to date :)

> create test harness and port TestApp to junit
> ---------------------------------------------
>
>                 Key: SOLR-3
>                 URL: http://issues.apache.org/jira/browse/SOLR-3
>             Project: Solr
>          Issue Type: Task
>            Reporter: Hoss Man
>         Assigned To: Hoss Man
>            Priority: Minor
>         Attachments: SOLR-3.zip, TestBasicFunctionality.java, TestHarness.java
>
>
> To both encourage good internal development, and to make it easy for plugin developers to write unit tests of their own code I think we need a harness that makes it easy to unit test updates and queries against Solr (without needing a servlet container)
> Once we have this, i think we can/should also retire "TestApp" in favor of some JUnit tests (which would probably make more sense for other developers)
> Iv'e already started on this, i thought i'd have something to commit tonight, but i got distracted ... filing this bug as a tracker for now.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira