OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
Xpress
/
vendor
/
aws
/
aws-sdk-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
AbstractConfigurationProviderTest.php
3.42 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Api
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Arn
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Auth
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
AwsClientTest.php
29.67 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Build
-
03/05/2025 10:56:41 AM
rwxr-xr-x
📄
ClientResolverTest.php
55.74 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
ClientSideMonitoring
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CloudFront
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CloudSearchDomain
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CloudTrail
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CloudWatchLogs
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CognitoIdentity
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
CognitoSync
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
CommandPoolTest.php
5.8 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
CommandTest.php
3.28 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
ConfigurationResolverTest.php
12.35 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Credentials
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Crypto
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
DefaultsMode
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
DocDb
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
DoctrineCacheAdapterTest.php
1.23 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
DynamoDb
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Ec2
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
ElasticLoadBalancingV2
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Endpoint
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
EndpointDiscovery
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
EndpointParameterMiddlewareTest.php
9.21 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
EndpointV2
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
EventBridge
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Exception
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
FunctionsTest.php
14.33 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Glacier
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Handler
-
03/05/2025 10:56:43 AM
rwxr-xr-x
📄
HandlerListTest.php
7.16 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
HasMonitoringEventsTraitTest.php
895 bytes
05/19/2025 10:07:17 AM
rw-r--r--
📄
HashingStreamTest.php
1.41 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
HistoryTest.php
4.2 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
IdempotencyTokenMiddlewareTest.php
2.76 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Identity
-
03/05/2025 10:56:43 AM
rwxr-xr-x
📄
InputValidationMiddlewareTest.php
5.62 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Integ
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
JsonCompilerTest.php
730 bytes
05/19/2025 10:07:17 AM
rw-r--r--
📁
Lambda
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
LexModelsV2
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
LruArrayCacheTest.php
1.59 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
MachineLearning
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
MiddlewareTest.php
16.08 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
MockHandlerTest.php
3.79 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
MultiRegionClientTest.php
5.41 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Multipart
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Neptune
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
PerformanceContext.php
8.2 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
PhpHashTest.php
1.33 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Polly
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
PresignUrlMiddlewareTest.php
3.95 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
Psr16CacheAdapterTest.php
1.84 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
PsrCacheAdapterTest.php
2.64 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
QueryCompatibleInputMiddlewareTest.php
9.1 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Rds
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
RequestCompression
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
ResultPaginatorTest.php
16.21 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
ResultTest.php
1.38 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Retry
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
RetryMiddlewareTest.php
24.57 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
RetryMiddlewareV2Test.php
40.33 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Route53
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
S3
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
S3Control
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Script
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
SdkTest.php
2.37 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Ses
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Signature
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Sqs
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📁
Ssm
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
StreamRequestPayloadMiddlewareTest.php
10.1 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Sts
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
TestServiceTrait.php
3.78 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
Token
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
TraceMiddlewareTest.php
16.16 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
UsesServiceTrait.php
4.37 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
WaiterTest.php
12.63 KB
05/19/2025 10:07:17 AM
rw-r--r--
📄
WrappedHttpHandlerTest.php
13.8 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
bootstrap
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
bootstrap.php
1.53 KB
05/19/2025 10:07:17 AM
rw-r--r--
📁
fixtures
-
03/05/2025 11:00:30 AM
rwxr-xr-x
📁
static
-
03/05/2025 10:54:31 AM
rwxr-xr-x
Editing: PerformanceContext.php
Close
<?php namespace Aws\Test; use Aws; use Aws\Api\ApiProvider; use Aws\Api\Service; use Aws\Result; use Aws\S3\S3Client; use Behat\Behat\Context\Context; use Behat\Behat\Context\SnippetAcceptingContext; use Behat\Behat\Hook\Scope\AfterScenarioScope; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use DomainException; use PHPUnit\Framework\Assert; use GuzzleHttp\Psr7; /** * Defines application features from the specific context. */ class PerformanceContext implements Context, SnippetAcceptingContext { use UsesServiceTrait; /** @var array */ private $resourceUsageSnapshot = []; /** @var string[] */ private $serviceList = []; /** @var array */ private $clients = []; /** @var string */ private $tempFilePath; /** @var S3Client */ private $s3Client; /** * @BeforeScenario @streaming * * @param BeforeScenarioScope $scope */ public function setUp(BeforeScenarioScope $scope) { $this->s3Client = $this->getTestClient('s3'); } /** * @AfterScenario @streaming * * @param AfterScenarioScope $scope */ public function cleanUpFile(AfterScenarioScope $scope) { if ($this->tempFilePath) { unlink($this->tempFilePath); } } /** * @Given I have loaded my SDK and its dependencies */ public function iHaveLoadedMySdkAndItsDependencies() { $this->iCreateAndDiscardClientSForEachService(1); } /** * @Given I take a snapshot of my resources */ public function iTakeASnapshotOfMyResources() { $this->resourceUsageSnapshot = [ 'memory' => memory_get_usage(), 'open_file_handles' => $this->getOpenFileHandleCount(), ]; } /** * @Given I have a list of services */ public function iHaveAListOfServices() { $this->serviceList = array_keys(Aws\manifest()); } /** * @Given /^I have a (\d+) byte file$/ */ public function iHaveAByteFile($fileSize) { $path = tempnam(sys_get_temp_dir(), 'performance_test'); $kb = ceil($fileSize / 1024); if (self::isRunningOnWindows()) { // dd is not available, so write out a file of the requisite size $handle = fopen($path, 'w'); $dummyText = str_repeat('x', 1024); for ($i = 0; $i < $kb; $i++) { fwrite($handle, $dummyText); } fclose($handle); } else { shell_exec("dd if=/dev/zero of=$path bs=1024 count=$kb >& /dev/null"); } $this->tempFilePath = $path; } /** * @When I create a client for each service */ public function iCreateAClientForEachService() { foreach ($this->serviceList as $service) { $this->clients[$service] = $this->getTestClient($service, [ 'CloudSearchDomain' => [ 'endpoint' => 'https://aws.amazon.com', ], ]); } } /** * @When /^I create and discard (\d+) clients for each service$/ */ public function iCreateAndDiscardClientSForEachService($numClients) { foreach ($this->serviceList as $service) { for ($i = 0; $i < $numClients; $i++) { $this->getTestClient($service, [ 'CloudSearchDomain' => [ 'endpoint' => 'https://aws.amazon.com', ], ]); } } } /** * @When /^I execute (\d+) command\(s\) on each client$/ */ public function iExecuteCommandsOnEachClient($numCommands) { foreach ($this->serviceList as $service) { try { $operation = $this ->findOperationWithNoRequiredParameters($service); $this->addMockResults( $this->clients[$service], array_fill(0, $numCommands, new Result) ); for ($i = 0; $i < $numCommands; $i++) { $this->clients[$service]->execute( $this->clients[$service]->getCommand($operation) ); } } catch (DomainException $e) { // This step cannot be completed due to service constraints. } } } /** * @When I upload the file */ public function iUploadTheFile() { $options = [ 'concurrency' => 5, 'mup_threshold' => 16 * 1024 * 1024, 'part_size' => 5 * 1024 * 1024, ]; $putObject = new Result(); $initiate = new Result(['UploadId' => 'foo']); $putPart = new Result(['ETag' => 'bar']); $complete = new Result(['Location' => 'https://s3.amazonaws.com/bucket/key']); $filesize = filesize($this->tempFilePath); if ($filesize < $options['mup_threshold']) { $this->addMockResults($this->s3Client, [$putObject]); } else { $parts = ceil($filesize / $options['part_size']); $this->addMockResults( $this->s3Client, array_merge( [$initiate], array_fill(0, $parts, $putPart), [$complete] ) ); } $this->s3Client->upload( 'bucket', 'key', fopen($this->tempFilePath, 'rb'), 'private', $options ); } /** * @When then download the file */ public function thenDownloadTheFile() { $this->addMockResults($this->s3Client, [new Result([ 'Body' => Psr7\Utils::streamFor(Psr7\Utils::tryFopen($this->tempFilePath, 'rb')), ])]); $this->s3Client->getObject([ 'Bucket' => 'bucket', 'Key' => 'key', ]); } /** * @When I destroy all the clients */ public function iDestroyAllTheClients() { $this->clients = []; gc_collect_cycles(); } /** * @Then I should not have leaked any resources */ public function iShouldNotHaveLeakedAnyResources() { // These should account for additional memory and files handles used to // load class definitions into the PHP runtime static $memoryFudge; static $handlesFudge; if (empty($memoryFudge)) { $opcacheEnabled = function_exists('opcache_get_status') && !empty(opcache_get_status(false)['opcache_enabled']); $memoryFudge = $opcacheEnabled ? 256 * 1024 // 256KB if OPCache is enabled : 5 * 1024 * 1024; // 5MB otherwise $handlesFudge = 5; } // Make sure you're not counting anything that's eligible for GC gc_collect_cycles(); Assert::assertLessThanOrEqual( $this->resourceUsageSnapshot['memory'] + $memoryFudge, memory_get_usage() ); Assert::assertLessThanOrEqual( $this->resourceUsageSnapshot['open_file_handles'] + $handlesFudge, $this->getOpenFileHandleCount() ); } private function findOperationWithNoRequiredParameters($service) { $provider = ApiProvider::defaultProvider(); $definition = new Service($provider('api', $service, 'latest'), $provider); foreach ($definition->getOperations() as $name => $operation) { if (empty($operation->getInput()['required'])) { return $name; } } throw new DomainException("The $service service has no operations" . " without required parameters"); } private function getOpenFileHandleCount() { if (self::isRunningOnWindows()) { return 0; } return (int) shell_exec('lsof -p ' . getmypid() . ' | wc -l'); } private static function isRunningOnWindows() { return 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); } }