Download & Extend

Create Simpletests to verify base functionality of the module

Project:Apache Solr Search Integration
Version:7.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The following tests cases should be written in order to have a consistent view for new patches that might possible change current functionality
Tests that already exist are already marked

Base Framework (Solr disabled)

Enable module
apachesolr.index.inc should not be loaded everywhere
Search index should show a notice that no solr instance is connected
SolrBaseQuery unit test
SolrFilterSubQuery unit test
ApacheSolrDocument unit test
Changing Content type
Adding/Modifying taxonomy term
Add a user, add content as that user and modify content

Base Framework (Solr enabled)

Connection should be succesful
DrupalApacheSolrService unit test
Index should be empty
Send test content & verify (UTF-8 included)
Modify content & verify
Delete content & verify
index status should be correct with the indexed content
Solr config files should be listed properly
Number of items per cron run should work
On failure, the configured result should show
Delete index
Reindex index
Simple facet testing ? // Not possible, need facetapi for that

Search Environment

Editing an environment
Cloning an environment and delete
Create a new environment and delete
Change read and write setting and verify
Add a new environment and make it default

Search Pages

Core search page available
Editing the core_search page
Clone the core_search page
Create a new search page and delete
Change search page title
Test search page types (taxonomy) // Not able to check properly without solr
Change search page path
Add a custom filter // Not able to check properly without solr
Change results per page // Not able to check properly without solr
Enable/disable spell check // Not able to check properly without solr
Empty search behavior // Not able to check properly without solr

Bias

Analyze content and validate helper functions
Exclude content type

More like this

Add a more like this block
Remove a more like this block
Validate configuration of more like this block

Node Access (Solr Enabled)

Index testing content without access rules
Index testing content with access rules
Change permission, validate if being reindexed

Comments

#1

Status:active» needs review

First patch.

Base Framework (Solr disabled)

Enable module
Search index should show a notice that no solr instance is connected
SolrBaseQuery unit test
SolrFilterSubQuery unit test??
ApacheSolrDocument unit test

It seems that the SubQuery test doesn't load and when I try to execute it it is failing. Waiting on response for the status of this subQuery class. Continueing now for the Base Framework tests with Solr enabled

Setting the status on needs review so the test bot can execute all of these tests

AttachmentSizeStatusTest resultOperations
1397138-1.patch14.97 KBIdleFAILED: [[SimpleTest]]: [MySQL] 120 pass(es), 0 fail(s), and 1 exception(es).View details

#2

Status:needs review» needs work

The last submitted patch, 1397138-1.patch, failed testing.

#3

Status:needs work» needs review

Updating, so it does not require apachesolr.module or any db queries to run the apachesolr document unit test

AttachmentSizeStatusTest resultOperations
1397138-3.patch14.87 KBIdlePASSED: [[SimpleTest]]: [MySQL] 134 pass(es).View details

#4

+ add test that verifies we are not loading the apachesolr.index.module on every or certain page loads

#5

Added test to verify this apachesolr.index.module + better subquery tests

AttachmentSizeStatusTest resultOperations
1397138-5.patch36.09 KBIdleFAILED: [[SimpleTest]]: [MySQL] 47 pass(es), 6 fail(s), and 1 exception(es).View details

#6

Forgot a dsm and reverted a function from private to public. Fixed now

AttachmentSizeStatusTest resultOperations
1397138-6.patch36.1 KBIdleFAILED: [[SimpleTest]]: [MySQL] 47 pass(es), 6 fail(s), and 1 exception(es).View details

#7

Added interface as separate file to the patch

AttachmentSizeStatusTest resultOperations
1397138-7.patch45.4 KBIdleFAILED: [[SimpleTest]]: [MySQL] 131 pass(es), 3 fail(s), and 0 exception(es).View details

#8

Status:needs review» needs work

The last submitted patch, 1397138-7.patch, failed testing.

#9

Status:needs work» needs review

Added test to clone a search environment

AttachmentSizeStatusTest resultOperations
1397138-8.patch46.28 KBIdleFAILED: [[SimpleTest]]: [MySQL] 157 pass(es), 3 fail(s), and 0 exception(es).View details

#10

Status:needs review» needs work

The last submitted patch, 1397138-8.patch, failed testing.

#11

I had to modify the way of the operator in the FilterQuery parser :
Now :

<?php
protected function rebuildFq() {
   
$fq = array();
    foreach (
$this->fields as $pos => $field) {
     
$fq[] = $this->makeFilterQuery($field);
    }
    foreach (
$this->subqueries as $subquery) {
     
$subfq = $subquery->rebuildFq();
      if (
$subfq) {
       
$operator = $this->operator;
       
$fq[] = "(" . implode(" $operator ", $subfq) . ")";
      }
    }
    return
$fq;
  }
?>

Before :
<?php
protected function rebuildFq() {
   
$fq = array();
    foreach (
$this->fields as $pos => $field) {
     
$fq[] = $this->makeFilterQuery($field);
    }
    foreach (
$this->subqueries as $subquery) {
     
$subfq = $subquery->rebuildFq();
      if (
$subfq) {
       
$operator = $subquery->operator;
       
$fq[] = "(" . implode(" $operator ", $subfq) . ")";
      }
    }
    return
$fq;
  }
?>

This has as a consequence that subqueries now have to define their operator in the AddFilterQuery :

$query1 = apachesolr_drupal_query('DrupalTest');
    $query2 = apachesolr_drupal_query('DrupalTest');
    $query2->addFilter('label', 'bar');
    $query3 = apachesolr_drupal_query('DrupalTest');
    $query2->addFilter('label', 'baz');
    $query1->addFilterSubQuery($query2, 'OR');
    $query2->addFilterSubQuery($query3);
    // This equals (label:bar OR (label:baz)) (URL = ?fq=(label:bar OR (label:baz)))

    // multiple filters in first query
    $query1 = apachesolr_drupal_query('DrupalTest');
    $query1->addFilter('is_uid', '10');
    $query2 = apachesolr_drupal_subquery();
    $query2->addFilter('is_uid', '1');
    $query2->addFilter('tid', '5');
    $query1->addFilterSubQuery($query2, 'OR');
    // This equals is_uid:10 (is_uid:1 OR tid:5)  (URL = ?fq=is_uid:10&fq=(is_uid:1 OR tid:5))
   

The first example is easy to make with the previous code, the second example is nearly impossible unless you use an empty base query where you add subqueries to.
AttachmentSizeStatusTest resultOperations
1397138-11.patch48.7 KBIdleFAILED: [[SimpleTest]]: [MySQL] 236 pass(es), 1 fail(s), and 0 exception(es).View details

#12

Status:needs work» needs review

#13

Status:needs review» needs work

The last submitted patch, 1397138-11.patch, failed testing.

#14

After some mysql performance problems there is some update of the testing suite. Now all the tests available should succeed. Let's cross fingers!

AttachmentSizeStatusTest resultOperations
1397138-14.patch51.45 KBIdlePASSED: [[SimpleTest]]: [MySQL] 287 pass(es).View details

#15

Status:needs work» needs review

#16

Adding search pages tests

AttachmentSizeStatusTest resultOperations
1397138-16.patch54.48 KBIdlePASSED: [[SimpleTest]]: [MySQL] 332 pass(es).View details

#17

Added a clone search page test

AttachmentSizeStatusTest resultOperations
1397138-17.patch55.3 KBIdlePASSED: [[SimpleTest]]: [MySQL] 358 pass(es).View details

#18

Status:needs review» needs work

per discusison need to leave the operator logic as-is

seems like we need some documentation

#19

Status:needs work» needs review

Reverted the operator logic and all that came along with it. Attached is the last patch for today regarding the simpletests.

AttachmentSizeStatusTest resultOperations
1397138-19.patch56.28 KBIdlePASSED: [[SimpleTest]]: [MySQL] 397 pass(es).View details

#20

Status:needs review» needs work

Committed what we have so far. Addons always welcome

#21

Committed all #19 to 6.x-3.x

#22

Status:needs work» fixed

More simpletests will go in as separate issues. Closing this one

#23

Status:fixed» needs work

Hmm, second thoughts, reopening

#24

Status:needs work» closed (fixed)

We can always add more when needed. Closing as a final thought :-)

nobody click here