Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix warnings in tests
  • Loading branch information
k0ka committed Jan 8, 2024
commit 57e48b73ad1dde4f65bbf22d69b775053dc6d184
12 changes: 6 additions & 6 deletions src/Common/Resource/HasWaiterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ trait HasWaiterTrait
* will enter a loop, requesting feedback from the remote API until it sends back an appropriate
* status.
*
* @param string $status The state to be reached
* @param int $timeout The maximum timeout. If the total time taken by the waiter has reached
* @param string $status The state to be reached
* @param bool|int $timeout The maximum timeout. If the total time taken by the waiter has reached
* or exceed this timeout, the blocking operation will immediately cease.
* @param int $sleepPeriod the amount of time to pause between each HTTP request
* @param int $sleepPeriod the amount of time to pause between each HTTP request
*/
public function waitUntil(string $status, $timeout = 60, int $sleepPeriod = 1)
{
Expand All @@ -44,14 +44,14 @@ public function waitUntil(string $status, $timeout = 60, int $sleepPeriod = 1)
* will enter a loop, executing the callback until TRUE is returned. This provides great
* flexibility.
*
* @param callable $fn An anonymous function that will be executed on every iteration. You can
* @param callable $fn An anonymous function that will be executed on every iteration. You can
* encapsulate your own logic to determine whether the resource has
* successfully transitioned. When TRUE is returned by the callback,
* the loop will end.
* @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached
* @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached
* or exceed this timeout, the blocking operation will immediately cease. If FALSE
* is provided, the timeout will never be considered.
* @param int $sleepPeriod the amount of time to pause between each HTTP request
* @param int $sleepPeriod the amount of time to pause between each HTTP request
*/
public function waitWithCallback(callable $fn, $timeout = 60, int $sleepPeriod = 1)
{
Expand Down
19 changes: 10 additions & 9 deletions tests/integration/Compute/v2/CoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use OpenStack\Networking\v2\Service as NetworkService;
use OpenStack\BlockStorage\v2\Service as BlockStorageService;
use OpenStack\Networking\v2\Extensions\SecurityGroups\Service as SecurityGroupService;
use RuntimeException;

class CoreTest extends TestCase
{
Expand Down Expand Up @@ -60,7 +61,7 @@ class CoreTest extends TestCase
private $keypairName;
private $volumeAttachmentId;

private function getService()
private function getService() : \OpenStack\Compute\v2\Service
{
if (null === $this->service) {
$this->service = Utils::getOpenStack()->computeV2();
Expand All @@ -69,7 +70,7 @@ private function getService()
return $this->service;
}

private function getNetworkService()
private function getNetworkService() : \OpenStack\Networking\v2\Service
{
if (!$this->networkService) {
$this->networkService = Utils::getOpenStack()->networkingV2();
Expand Down Expand Up @@ -103,7 +104,7 @@ private function searchImages($name)
}

if (!$this->imageId) {
throw new \RuntimeException(sprintf('Unable to find image "%s". Make sure this image is available for integration test.', $name));
throw new RuntimeException(sprintf('Unable to find image "%s". Make sure this image is available for integration test.', $name));
}
}

Expand Down Expand Up @@ -231,7 +232,7 @@ private function createServer()
$flavorId = getenv('OS_FLAVOR');

if (!$flavorId) {
throw new \RuntimeException('OS_FLAVOR env var must be set');
throw new RuntimeException('OS_FLAVOR env var must be set');
}

$replacements = [
Expand All @@ -244,7 +245,7 @@ private function createServer()
/** @var $server \OpenStack\Compute\v2\Models\Server */
require_once $this->sampleFile('servers/create_server.php', $replacements);

$server->waitUntilActive(false);
$server->waitUntilActive();

self::assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
self::assertNotEmpty($server->id);
Expand Down Expand Up @@ -341,7 +342,7 @@ private function resizeServer()
{
$resizeFlavorId = getenv('OS_RESIZE_FLAVOR');
if (!$resizeFlavorId) {
throw new \RuntimeException('OS_RESIZE_FLAVOR env var must be set');
throw new RuntimeException('OS_RESIZE_FLAVOR env var must be set');
}

$replacements = [
Expand Down Expand Up @@ -413,7 +414,7 @@ private function rebootServer()
/** @var $server \OpenStack\Compute\v2\Models\Server */
require_once $this->sampleFile('servers/reboot_server.php', $replacements);

$server->waitUntilActive(false);
$server->waitUntilActive();

$this->logStep('Rebooted server {serverId}', $replacements);
}
Expand All @@ -437,7 +438,7 @@ private function startServer()
/** @var $server \OpenStack\Compute\v2\Models\Server */
require_once $this->sampleFile('servers/start_server.php', $replacements);

$server->waitUntilActive(false);
$server->waitUntilActive();

$this->logStep('Started server {serverId}', $replacements);
}
Expand Down Expand Up @@ -673,7 +674,7 @@ private function removeServerSecurityGroup()

require_once $this->sampleFile('servers/remove_security_group.php', $replacements);

$this->logStep('Delete security group {secGroupName} from server {serverId}', $replacements);
$this->logStep(/** @lang text */ 'Delete security group {secGroupName} from server {serverId}', $replacements);
}

private function attachVolumeToServer()
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase implements TestInter

public function __construct(LoggerInterface $logger, SampleManagerInterface $sampleManager)
{
parent::__construct();

$this->logger = $logger;
$this->sampleManager = $sampleManager;
}
Expand Down