Skip to content
Snippets Groups Projects
Commit defc6828 authored by Thibault Debatty's avatar Thibault Debatty
Browse files

clean test

parent c957542e
No related branches found
No related tags found
No related merge requests found
Pipeline #10871 failed
......@@ -253,14 +253,10 @@ class ExampleTest extends TestCase
// Insert a fake status change
$change = new \App\StatusChange();
$change->status = 155;
$change->status = \App\Status::ERROR;
$change->server_id = $server_id;
$change->save();
// Run change detection
$change_detection_job = new \App\Jobs\StatusChangeDetection();
$change_detection_job->detectChangeForServer($server);
// Check if a new StatusChange was inserted in Mongo
$last_change = \App\StatusChange::getLastChangeForServer($server_id);
$records = $server->lastRecords1Day();
......@@ -268,12 +264,15 @@ class ExampleTest extends TestCase
$server->status($records)->code(),
$last_change->status
);
// Run change detection
$change_detection_job = new \App\Jobs\StatusChangeDetection();
$change_detection_job->detectChangeForServer($server);
// Check if a notification were inserted
// Check if a notification was inserted
$this->assertTrue(Notification::findForServer($server_id)->count() > 0);
// Insert multiple status changes to simulate bouncing
for ($i = 0; $i < 4; $i++) {
$change = new \App\StatusChange();
$change->status = 155;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment