| @@ 30-47 (lines=18) @@ | ||
| 27 | /** |
|
| 28 | * Test that timeout expiry works |
|
| 29 | */ |
|
| 30 | public function testTimeout() { |
|
| 31 | $step = $this->getDummyConfirmationStep(); |
|
| 32 | $step->start(); |
|
| 33 | ||
| 34 | // Assert not error at startup |
|
| 35 | $this->assertEquals('Started', $step->Status); |
|
| 36 | ||
| 37 | // Go to two hours in the future |
|
| 38 | SS_Datetime::set_mock_now(date('Y-m-d H:i:s', strtotime('+2 hours'))); |
|
| 39 | ||
| 40 | // Retry step |
|
| 41 | $step->start(); |
|
| 42 | $this->assertEquals('Finished', $step->Status); |
|
| 43 | $this->assertTrue($step->isTimedOut()); |
|
| 44 | ||
| 45 | // check a log entry exists |
|
| 46 | $this->assertHasLog('RollbackWindowStep is older than 3600 seconds and has timed out'); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function testRollback() { |
|
| 50 | SS_Datetime::set_mock_now(date('Y-m-d H:i:s')); |
|
| @@ 30-47 (lines=18) @@ | ||
| 27 | /** |
|
| 28 | * Test that timeout expiry works |
|
| 29 | */ |
|
| 30 | public function testTimeout() { |
|
| 31 | $step = $this->getDummyConfirmationStep(); |
|
| 32 | $step->start(); |
|
| 33 | ||
| 34 | // Assert not error at startup |
|
| 35 | $this->assertEquals('Started', $step->Status); |
|
| 36 | ||
| 37 | // Go to two weeks into the future |
|
| 38 | SS_Datetime::set_mock_now(date('Y-m-d H:i:s', strtotime('+2 weeks'))); |
|
| 39 | ||
| 40 | // Retry step |
|
| 41 | $step->start(); |
|
| 42 | $this->assertEquals('Failed', $step->Status); |
|
| 43 | $this->assertTrue($step->isTimedOut()); |
|
| 44 | ||
| 45 | // check a log entry exists |
|
| 46 | $this->assertHasLog('Deployment step is older then 86400 seconds and has timed out'); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function testDeploy() { |
|
| 50 | SS_Datetime::set_mock_now(date('Y-m-d H:i:s')); |
|