Skip to content

Commit

Permalink
Merge pull request aws#832 from jeskew/feature/move-integ-suite-to-cu…
Browse files Browse the repository at this point in the history
…cumber

Feature/move integ suite to cucumber
  • Loading branch information
jeskew committed Dec 8, 2015
2 parents 2524c78 + cb52921 commit f09ee76
Show file tree
Hide file tree
Showing 28 changed files with 1,172 additions and 1,462 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -20,6 +20,7 @@ matrix:
install:
- export AWS_ACCESS_KEY_ID=foo
- export AWS_SECRET_ACCESS_KEY=bar
- echo "xdebug.overload_var_dump = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- travis_retry composer update $COMPOSER_OPTS --no-interaction --prefer-source

script:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -45,7 +45,7 @@ coverage-show:
open build/artifacts/coverage/index.html

integ:
vendor/bin/phpunit --debug --testsuite=integ $(TEST)
vendor/bin/behat --format=progress --tags=integ

smoke:
vendor/bin/behat --format=progress
Expand Down
15 changes: 15 additions & 0 deletions behat.yml
Expand Up @@ -6,3 +6,18 @@ default:
performance:
paths: [ %paths.base%/features/performance ]
contexts: [ Aws\Test\PerformanceContext ]
multipart:
paths: [ %paths.base%/features/multipart ]
contexts: [ Aws\Test\Integ\MultipartContext ]
batching:
paths: [ %paths.base%/features/batching ]
contexts: [ Aws\Test\Integ\BatchingContext ]
blocking:
paths: [ %paths.base%/features/blocking ]
contexts: [ Aws\Test\Integ\BlockingContext ]
concurrency:
paths: [ %paths.base%/features/concurrency ]
contexts: [ Aws\Test\Integ\ConcurrencyContext ]
streams:
paths: [ %paths.base%/features/streams ]
contexts: [ Aws\Test\Integ\NativeStreamContext ]
8 changes: 8 additions & 0 deletions features/batching/batchSerialization.feature
@@ -0,0 +1,8 @@
@sqs @integ
Feature: SQS Batch Serialization

Scenario: Deleting Message Batches
Given I have a "sqs" client
And I have put 10 messages in a queue
When I delete a batch of 10 messages
Then 10 messages should have been deleted from the queue
9 changes: 9 additions & 0 deletions features/batching/writeRequestBatch.feature
@@ -0,0 +1,9 @@
@dynamodb @integ
Feature: DynamoDB Write Request Batch
Scenario: Batching
Given I have a "dynamodb" client
When I create a WriteRequestBatch with a batch size of 3 and a pool size of 2
And I put 20 items in the batch
And I flush the batch
Then 20 items should have been written
And the batch should have been flushed 7 times
24 changes: 24 additions & 0 deletions features/blocking/waiters.feature
@@ -0,0 +1,24 @@
@dynamodb @integ
Feature: Waiters

Scenario: Synchronous Waiters
Given I have a "dynamodb" client
And the table named "waiter-test" does not exist
When I create a table named "waiter-test"
And wait for the table named "waiter-test" to exist
Then the table named "waiter-test" exists
Then I can delete the table named "waiter-test"
And wait for the table named "waiter-test" to be deleted
And the table named "waiter-test" does not exist

Scenario: Asynchronous Waiters
Given I have a "dynamodb" client
And the table named "waiter-test" does not exist
When I create a promise to create and await a table named "waiter-test"
And the table named "waiter-test" does not exist
Then I can wait on all promises
And the table named "waiter-test" exists
When I create a promise to delete and await the purging of the table named "waiter-test"
And the table named "waiter-test" exists
Then I can wait on all promises
And the table named "waiter-test" does not exist
42 changes: 42 additions & 0 deletions features/concurrency/requests.feature
@@ -0,0 +1,42 @@
@s3 @integ
Feature: Concurrent Requests

Scenario: Sending a normal, synchronous request
Given I have a "s3" client
When I call the "ListBuckets" API
Then the value at "Owner.ID" should be a "string"

Scenario: Sending a promised, synchronous request
Given I have a "s3" client
When I call the "ListBuckets" API asynchronously
And I wait on the promise
Then the value at "Owner.ID" should be a "string"

Scenario: Sending requests asynchronously
Given a promise composed of the following asynchronous operations:
| service | command | payload |
| s3 | ListBuckets | |
| s3 | ListBuckets | |
| s3 | ListBuckets | |
When I wait on the promise
Then there should be 3 results
And there should be 1 value at "[*].Owner.ID"

Scenario: Sending commands concurrently
Given a pool composed of the following commands:
| service | command | payload |
| s3 | ListBuckets | |
| s3 | ListBuckets | |
| s3 | ListBuckets | |
When I send the commands as a batch to "s3"
Then there should be 3 results
And there should be 1 value at "[*].Owner.ID"

Scenario: Sending requests asynchronously to multiple services
Given a promise composed of the following asynchronous operations:
| service | command | payload |
| s3 | ListBuckets | |
| dynamodb | ListTables | |
| sqs | ListQueues | |
When I wait on the promise
Then there should be 3 results
14 changes: 14 additions & 0 deletions features/multipart/glacier.feature
@@ -0,0 +1,14 @@
@glacier @integ
Feature: Glacier Multipart Uploads

Scenario Outline: Uploading a stream
Given I have a <seekable> read stream
When I upload the stream to Glacier with a concurrency factor of "<concurrency>"
Then the result should contain a(n) "location"

Examples:
| seekable | concurrency |
| seekable | 1 |
| non-seekable | 1 |
| seekable | 3 |
| non-seekable | 3 |
14 changes: 14 additions & 0 deletions features/multipart/s3.feature
@@ -0,0 +1,14 @@
@s3 @integ
Feature: S3 Multipart Uploads

Scenario Outline: Uploading a stream
Given I have a <seekable> read stream
When I upload the stream to S3 with a concurrency factor of "<concurrency>"
Then the result should contain a(n) "ObjectURL"

Examples:
| seekable | concurrency |
| seekable | 1 |
| non-seekable | 1 |
| seekable | 3 |
| non-seekable | 3 |
57 changes: 57 additions & 0 deletions features/streams/streamWrapper.feature
@@ -0,0 +1,57 @@
#language: en
@s3 @integ
Feature: S3 Stream Wrapper

Background:
Given I have a "s3" client
And have registered an s3 stream wrapper

Scenario: Making directories
Given I create a subdirectory "subdir" with mkdir
When I call is_dir on the subdir path
Then the call should return true

Scenario Outline: Checking existence of directories
When I call is_dir on the <subdirectory> path
Then the call should return <boolean>

Examples:
| subdirectory | boolean |
| / | true |
| /foo | false |
| /bar | false |

Scenario: Uploading Files
Given I have a file at "key" with the content "testing!"
When I call file_exists on the key path
Then the call should return true
And the file at "key" should contain "testing!"

Scenario: Deleting Files
Given I have a file at "key" with the content "testing!"
When I call unlink on the key path
And I call file_exists on the key path
Then the call should return false

Scenario Outline: Opening streams
Given I have a file at "<path>" with the content "<contents>"
And I have a read handle on the file at "<path>"
Then reading 2 bytes should return <first2>
And reading 1000 bytes should return <next1000>
And calling fstat should report a size of <size>

Examples:
| path | contents | size | first2 | next1000 |
| key1 | testing! | 8 | te | sting! |
| key2 | foo, bar, baz | 13 | fo | o, bar, baz |

Scenario: No errors raised for missing files
Given I have cleared the last error
When I call file_exists on the jkfdsalhjkgdfhsurew path
Then the call should return false
And no errors should have been raised

Scenario: Traversing empty directories
Given I have a file at "/empty/" with no content
When I have a file at "/empty/bar" with the content "hello"
Then scanning the directory at "/empty/" should return a list with one member named "bar"
38 changes: 38 additions & 0 deletions tests/CognitoSync/CognitoSyncClientTest.php
@@ -0,0 +1,38 @@
<?php
namespace Aws\Test\CognitoSync;

use Aws\Test\UsesServiceTrait;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\RequestInterface;

class CognitoSyncClientTest extends \PHPUnit_Framework_TestCase
{
use UsesServiceTrait;

public function testRequestSucceedsWithColon()
{
$identityId = 'aaa:bbb';
$identityPoolId = 'ccc:ddd';
$client = $this->getTestClient('CognitoSync', [
'http_handler' => function (RequestInterface $request) use (
$identityId,
$identityPoolId
) {
foreach ([$identityId, $identityPoolId] as $unencodedString) {
$this->assertContains(
urlencode($unencodedString),
(string) $request->getUri()
);
}

return new FulfilledPromise(new Response);
},
]);

$client->describeIdentityUsage([
'IdentityId' => $identityId,
'IdentityPoolId' => $identityPoolId,
]);
}
}

0 comments on commit f09ee76

Please sign in to comment.