Skip to content

Commit

Permalink
Fixed search tests to be able to rerun without the index growing
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry committed Aug 25, 2015
1 parent 87308a3 commit d3a95d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 6 additions & 1 deletion api/tests/ElasticSearchTest.php
Expand Up @@ -3,7 +3,6 @@
use App\Models\TestEntity;
/**
* Class ElasticSearchTest
* @group failing
*/
class ElasticSearchTest extends TestCase
{
Expand All @@ -13,6 +12,8 @@ public function setUp()
parent::setUp();
TestEntity::flushEventListeners();
TestEntity::boot(); //run event listeners

TestEntity::removeAllFromIndex();
}

/**
Expand All @@ -33,6 +34,8 @@ public function testElasticSearchAddToIndex()


$this->assertEquals(1, $search->totalHits());

$testEntity->delete(); //clean up so it doesn't remain in the index
}

public function testElasticSearchRemoveFromIndex()
Expand Down Expand Up @@ -72,6 +75,8 @@ public function testElasticSearchUpdateIndex()
]);

$this->assertEquals(1, $search->totalHits());

$testEntity->delete(); //clean up so it doesn't remain in the index
}

}
7 changes: 1 addition & 6 deletions api/tests/integration/EntityTest.php
Expand Up @@ -656,9 +656,7 @@ public function testEntitySearch()
'varchar' => 'searchforthisstring'
]);

TestEntity::addAllToIndex();

sleep(1); //give the elastic search agent time to index (!)
sleep(1); //give the elastic search agent time to index

$this->get('/test/entities/pages?q=searchforthisstring', ['Range'=>'entities=0-9']);

Expand All @@ -675,9 +673,6 @@ public function testEntitySearch()

public function testEntitySearchNoResults()
{
TestEntity::reindex();

sleep(1); //give the elastic search agent time to index

$this->get('/test/entities/pages?q=thisstringwontreturnresults', ['Range'=>'entities=0-9']);

Expand Down

0 comments on commit d3a95d5

Please sign in to comment.