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
add more wait time for volume attachments
  • Loading branch information
k0ka committed Feb 1, 2024
commit 2b21d543a5e310564cfc01b686f91ec4a57a578a
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"autoload-dev": {
"psr-4": {
"OpenStack\\Integration\\": "tests/integration/",
"OpenStack\\Sample\\": "tests/sample/",
"OpenStack\\Test\\": "tests/unit/"
}
Expand Down
7 changes: 6 additions & 1 deletion tests/sample/Compute/v2/VolumeAttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testAttach(): VolumeAttachment
// let's wait for the server to be completely up
// https://bugs.launchpad.net/nova/+bug/1998148
// https://bugs.launchpad.net/nova/+bug/1960346
sleep(10);
sleep(15);

$volume = $this->getCachedService(Service::class)->createVolume(
[
Expand Down Expand Up @@ -67,6 +67,11 @@ public function testList(VolumeAttachment $createdVolumeAttachment)
*/
public function testDetach(VolumeAttachment $createdVolumeAttachment)
{
// let's wait for the server to be completely up
// https://bugs.launchpad.net/nova/+bug/1998148
// https://bugs.launchpad.net/nova/+bug/1960346
sleep(15);

require_once $this->sampleFile(
'servers/detach_volume_attachment.php',
[
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/Compute/v2/Models/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function setUp(): void

public function test_it_retrieves()
{
$this->mockRequest('GET', 'images/imageId', 'image-get', null, []);
$this->mockRequest('GET', 'images/imageId', 'image-get');

$this->image->retrieve();

Expand All @@ -46,14 +46,14 @@ public function test_it_retrieves()

public function test_it_deletes()
{
$this->mockRequest('DELETE', 'images/imageId', new Response(204), null, []);
$this->mockRequest('DELETE', 'images/imageId', new Response(204));

$this->image->delete();
}

public function test_it_retrieves_metadata()
{
$this->mockRequest('GET', 'images/imageId/metadata', 'server-metadata-get', null, []);
$this->mockRequest('GET', 'images/imageId/metadata', 'server-metadata-get');

$metadata = $this->image->getMetadata();

Expand All @@ -70,7 +70,7 @@ public function test_it_sets_metadata()
$expectedJson = ['metadata' => $metadata];

$response = $this->createResponse(200, [], $expectedJson);
$this->mockRequest('PUT', 'images/imageId/metadata', $response, $expectedJson, []);
$this->mockRequest('PUT', 'images/imageId/metadata', $response, $expectedJson);

$this->image->resetMetadata($metadata);

Expand All @@ -84,7 +84,7 @@ public function test_it_updates_metadata()
$expectedJson = ['metadata' => $metadata];

$response = $this->createResponse(200, [], array_merge_recursive($expectedJson, ['metadata' => ['bar' => '2']]));
$this->mockRequest('POST', 'images/imageId/metadata', $response, $expectedJson, []);
$this->mockRequest('POST', 'images/imageId/metadata', $response, $expectedJson);

$this->image->mergeMetadata($metadata);

Expand All @@ -95,7 +95,7 @@ public function test_it_updates_metadata()
public function test_it_retrieves_a_metadata_item()
{
$response = $this->createResponse(200, [], ['metadata' => ['fooKey' => 'bar']]);
$this->mockRequest('GET', 'images/imageId/metadata/fooKey', $response, null, []);
$this->mockRequest('GET', 'images/imageId/metadata/fooKey', $response);

$value = $this->image->getMetadataItem('fooKey');

Expand All @@ -104,8 +104,8 @@ public function test_it_retrieves_a_metadata_item()

public function test_it_deletes_a_metadata_item()
{
$this->mockRequest('DELETE', 'images/imageId/metadata/fooKey', new Response(204), null, []);
$this->mockRequest('DELETE', 'images/imageId/metadata/fooKey', new Response(204));

self::assertNull($this->image->deleteMetadataItem('fooKey'));
$this->image->deleteMetadataItem('fooKey');
}
}
28 changes: 14 additions & 14 deletions tests/unit/Identity/v3/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function test_it_authenticates()
]
];

$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson], []);
$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson]);

[$token, $url] = $this->service->authenticate($userOptions);

Expand Down Expand Up @@ -231,7 +231,7 @@ public function test_it_throws_exception_if_no_endpoint_found()
]
];

$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson], []);
$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson]);
$this->expectException(\RuntimeException::class);

$this->service->authenticate([
Expand Down Expand Up @@ -296,14 +296,14 @@ public function test_it_revokes_token()
{
$this->mockRequest('DELETE', 'auth/tokens', new Response(204), [], ['X-Subject-Token' => 'tokenId']);

self::assertNull($this->service->revokeToken('tokenId'));
$this->service->revokeToken('tokenId');
}

public function test_it_creates_service()
{
$userOptions = ['name' => 'foo', 'type' => 'bar', 'description' => 'description'];

$this->mockRequest('POST', 'services', 'service', ['service' => $userOptions], []);
$this->mockRequest('POST', 'services', 'service', ['service' => $userOptions]);

$service = $this->service->createService($userOptions);

Expand Down Expand Up @@ -360,7 +360,7 @@ public function test_it_creates_domain()
'name' => 'foo'
];

$this->mockRequest('POST', 'domains', 'domain', ['domain' => $userOptions], []);
$this->mockRequest('POST', 'domains', 'domain', ['domain' => $userOptions]);

/** @var $endpoint \OpenStack\Identity\v3\Models\Domain */
$domain = $this->service->createDomain($userOptions);
Expand Down Expand Up @@ -391,7 +391,7 @@ public function test_it_creates_project()
'name' => 'foo'
];

$this->mockRequest('POST', 'projects', 'project', ['project' => $userOptions], []);
$this->mockRequest('POST', 'projects', 'project', ['project' => $userOptions]);

/** @var $endpoint \OpenStack\Identity\v3\Models\Project */
$project = $this->service->createProject($userOptions);
Expand All @@ -405,7 +405,7 @@ public function test_it_creates_project()

public function test_it_lists_projects()
{
$this->mockRequest('GET', 'projects', 'projects', null, []);
$this->mockRequest('GET', 'projects', 'projects');

$projects = $this->service->listProjects();

Expand Down Expand Up @@ -443,7 +443,7 @@ public function test_it_creates_user()
$userJson['domain_id'] = $userJson['domainId'];
unset($userJson['defaultProjectId'], $userJson['domainId']);

$this->mockRequest('POST', 'users', 'user', ['user' => $userJson], []);
$this->mockRequest('POST', 'users', 'user', ['user' => $userJson]);

/** @var $endpoint \OpenStack\Identity\v3\Models\User */
$user = $this->service->createUser($userOptions);
Expand Down Expand Up @@ -476,7 +476,7 @@ public function test_it_creates_group()
'name' => 'name',
];

$this->mockRequest('POST', 'groups', 'group', ['group' => $userOptions], []);
$this->mockRequest('POST', 'groups', 'group', ['group' => $userOptions]);

/** @var $endpoint \OpenStack\Identity\v3\Models\Group */
$group = $this->service->createGroup($userOptions);
Expand Down Expand Up @@ -515,7 +515,7 @@ public function test_it_creates_credential()
'user_id' => $userOptions['userId'],
];

$this->mockRequest('POST', 'credentials', 'cred', $userJson, []);
$this->mockRequest('POST', 'credentials', 'cred', $userJson);

/** @var $endpoint \OpenStack\Identity\v3\Models\Credential */
$cred = $this->service->createCredential($userOptions);
Expand All @@ -542,7 +542,7 @@ public function test_it_creates_role()
{
$userOptions = ['name' => 'a role name'];

$this->mockRequest('POST', 'roles', 'role', ['role' => $userOptions], []);
$this->mockRequest('POST', 'roles', 'role', ['role' => $userOptions]);

/** @var $endpoint \OpenStack\Identity\v3\Models\Role */
$role = $this->service->createRole($userOptions);
Expand Down Expand Up @@ -579,7 +579,7 @@ public function test_it_creates_policy()
'user_id' => $userOptions['userId'],
];

$this->mockRequest('POST', 'policies', 'policy', ['policy' => $userJson], []);
$this->mockRequest('POST', 'policies', 'policy', ['policy' => $userJson]);

/** @var $endpoint \OpenStack\Identity\v3\Models\Policy */
$policy = $this->service->createPolicy($userOptions);
Expand Down Expand Up @@ -626,7 +626,7 @@ public function test_it_generates_tokens_with_user_creds()
]
];

$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson], []);
$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson]);

$token = $this->service->generateToken($userOptions);
self::assertInstanceOf(Models\Token::class, $token);
Expand All @@ -651,7 +651,7 @@ public function test_it_generates_token_with_token_id()
]
];

$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson], []);
$this->mockRequest('POST', 'auth/tokens', 'token', ['auth' => $expectedJson]);

$token = $this->service->generateToken($userOptions);
self::assertInstanceOf(Models\Token::class, $token);
Expand Down