mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-12 11:28:49 +00:00
[s3_storage] Update Composer dependency ahead of release
- Updating akeeba/s3 (2.3.1 => 2.3.2)
This commit is contained in:
parent
c6b2ed96d7
commit
d910502a17
53 changed files with 583 additions and 206 deletions
74
s3_storage/vendor/akeeba/s3/minitest/NOTES.md
vendored
74
s3_storage/vendor/akeeba/s3/minitest/NOTES.md
vendored
|
@ -1,5 +1,7 @@
|
|||
# Testing notes
|
||||
|
||||
**⚠️ WARNING**: Running all tests across all services takes _hours_. It is recommended that you use the SignedURLs test as a quick validation tool across multiple services, then test against the `$standardTests` suite overnight.
|
||||
|
||||
## Against Amazon S3 proper
|
||||
|
||||
This is the _canonical_ method for testing this library since Amazon S3 proper is the canonical provider of the S3 API (and not all of its quirks are fully documented, we might add).
|
||||
|
@ -8,9 +10,9 @@ Copy `config.dist.php` to `config.php` and enter the connection information to y
|
|||
|
||||
## Against [LocalStack](https://localstack.cloud)
|
||||
|
||||
This method is very useful for development.
|
||||
This method is very useful for development. It is the most faithful implementation of S3, but it does have some minor quirks not present in the real thing as a result of it running inside a Docker container.
|
||||
|
||||
Install LocalStack [as per their documentation](https://docs.localstack.cloud/getting-started/installation/).
|
||||
Install LocalStack [per its documentation](https://docs.localstack.cloud/getting-started/installation/), or using its Docker Desktop Extension.
|
||||
|
||||
You will also need to install [`awslocal`](https://github.com/localstack/awscli-local) like so:
|
||||
```php
|
||||
|
@ -18,45 +20,67 @@ pip install awscli
|
|||
pip install awscli-local
|
||||
```
|
||||
|
||||
Start LocalStack e.g. `localstack start -d`
|
||||
Start LocalStack e.g. `localstack start -d` or via the Docker Desktop Extension.
|
||||
|
||||
Create a new bucket called `test` i.e. `awslocal s3 mk s3://test`
|
||||
Create a new bucket called `test` i.e. `awslocal s3 mb s3://test`
|
||||
|
||||
Copy `config.dist.php` to `config.php` and make the following changes:
|
||||
```php
|
||||
define('DEFAULT_ENDPOINT', 'localhost.localstack.cloud:4566');
|
||||
define('DEFAULT_ACCESS_KEY', 'ANYRANDOMSTRINGWILLDO');
|
||||
define('DEFAULT_SECRET_KEY', 'ThisIsAlwaysIgnoredByLocalStack');
|
||||
define('DEFAULT_REGION', 'us-east-1');
|
||||
define('DEFAULT_BUCKET', 'test');
|
||||
define('DEFAULT_SIGNATURE', 'v4');
|
||||
define('DEFAULT_PATH_ACCESS', true);
|
||||
```
|
||||
|
||||
Note that single- and dualstack tests result in the same URLs for all S3-compatible services, including LocalStack. These tests are essentially duplicates in this use case.
|
||||
The `config.dist.php` already has a configuration for LocalStack. Yes, the access and secret key can be any random string.
|
||||
|
||||
## Against Wasabi
|
||||
|
||||
Wasabi nominally supports v4 signatures, but their implementation is actually _non-canonical_, as they only read the date from the optional `x-amz-date` header, without falling back to the standard HTTP `Date` header. We have added a workaround for this behaviour which necessitates testing with it.
|
||||
Wasabi nominally supports v4 signatures, but their implementation is actually _non-canonical_, as they only read the date from the optional `x-amz-date` header, without falling back to the standard HTTP `Date` header. We have changed the behaviour of the library to always go through the X-Amz-Date header as a result. Hence, the need to test with Wasabi.
|
||||
|
||||
The Wasabi configuration block looks like this:
|
||||
|
||||
Just like with Amazon S3 proper, copy `config.dist.php` to `config.php` and enter the connection information to your Wasabi storage. You will also need to set up the custom endpoint like so:
|
||||
```php
|
||||
define('DEFAULT_ENDPOINT', 's3.eu-central-2.wasabisys.com');
|
||||
'wasabi-v4' => [
|
||||
'access' => 'THE_ACCESS_KEY',
|
||||
'secret' => 'VERY_SECRET_MUCH_WOW',
|
||||
'region' => 'eu-central-2',
|
||||
'bucket' => 'bucketname',
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
'ssl' => true,
|
||||
'endpoint' => 's3.eu-central-2.wasabisys.com',
|
||||
],
|
||||
'wasabi-v2' => [
|
||||
'access' => 'THE_ACCESS_KEY',
|
||||
'secret' => 'VERY_SECRET_MUCH_WOW',
|
||||
'region' => 'eu-central-2',
|
||||
'bucket' => 'bucketname',
|
||||
'signature' => 'v2',
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
'ssl' => true,
|
||||
'endpoint' => 's3.eu-central-2.wasabisys.com',
|
||||
],
|
||||
|
||||
```
|
||||
|
||||
**IMPORTANT!** The above endpoint will be different, depending on which region you've created your bucket in. The example above assumes the `eu-central-2` region. If you use the wrong region the tests _will_ fail!
|
||||
**❗Important**: The Endpoint and Region must match each other, and the region the bucket was crated in. In the example above, we have created a bucket in the `eu-central-2` region. If you use the wrong region and/or endpoint the tests _will_ fail!
|
||||
|
||||
## Against Synology C2
|
||||
|
||||
Synology C2 is an S3-“compatible” storage service. It is not very “compatible” though, since they implemented Amazon's documentation of the v4 signatures instead of how the v4 signatures work in the real world (yeah, there's a very big difference). While Amazon S3 _in reality_ expects all dates to be formatted as per RFC1123, they document that they expect them to be formatted as per “ISO 8601” and they give their _completely wrong_ interpretation of what the “ISO 8601” format is. Synology did not catch that discrepancy, and they only expect the wrongly formatted dates which is totally NOT what S3 itself expects. Luckily, most third party implementations expect either format because they've caught the discrepancy between documentation and reality, therefore making it possible for us to come up with a viable workaround.
|
||||
Synology C2 is an S3-“compatible” storage service. It is not very “compatible” though, since they implemented Amazon's documentation of the v4 signatures instead of how the v4 signatures work in the real world (yeah, there's a very big difference). While Amazon S3 _in reality_ expects all dates to be formatted as per RFC1123, they document that they expect them to be formatted as per “ISO 8601”, and they give their _completely wrong_ interpretation of what the “ISO 8601” format is. Synology did not catch that discrepancy, and they only expect the wrongly formatted dates which is totally NOT what S3 itself expects. Luckily, most third party implementations expect either format because they've caught the discrepancy between documentation and reality, therefore making it possible for us to come up with a viable workaround.
|
||||
|
||||
And that's why we need to test with C2 as well, folks.
|
||||
|
||||
Copy `config.dist.php` to `config.php` and enter the connection information to your Synology S3 service.
|
||||
The C2 config block looks like this:
|
||||
|
||||
It is very important to note two things:
|
||||
```php
|
||||
define('DEFAULT_ENDPOINT', 'eu-002.s3.synologyc2.net');
|
||||
define('DEFAULT_REGION', 'eu-002');
|
||||
'c2' => [
|
||||
'access' => 'THE_ACCESS_KEY',
|
||||
'secret' => 'VERY_SECRET_MUCH_WOW',
|
||||
'region' => 'eu-002',
|
||||
'bucket' => 'bucketname',
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
'ssl' => true,
|
||||
'endpoint' => 'eu-002.s3.synologyc2.net',
|
||||
],
|
||||
|
||||
```
|
||||
|
||||
The endpoint URL is given in the Synology C2 Object Manager, next to each bucket. Note the part before `.s3.`. This is the **region** you need to use with v4 signatures. They do not document this anywhere.
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
@ -22,20 +22,39 @@ class SignedURLs extends AbstractTest
|
|||
return static::signedURL($s3, $options, Acl::ACL_PUBLIC_READ);
|
||||
}
|
||||
|
||||
public static function signedURLPublicObjectSpaces(Connector $s3, array $options): bool
|
||||
{
|
||||
return static::signedURL($s3, array_merge($options, [
|
||||
'spaces' => true
|
||||
]), Acl::ACL_PUBLIC_READ);
|
||||
}
|
||||
|
||||
public static function signedURLPrivateObject(Connector $s3, array $options): bool
|
||||
{
|
||||
return static::signedURL($s3, $options, Acl::ACL_PRIVATE);
|
||||
}
|
||||
|
||||
public static function signedURLPrivateObjectSpaces(Connector $s3, array $options): bool
|
||||
{
|
||||
return static::signedURL($s3, array_merge($options, [
|
||||
'spaces' => true
|
||||
]), Acl::ACL_PRIVATE);
|
||||
}
|
||||
|
||||
private static function signedURL(Connector $s3, array $options, string $aclPrivilege): bool
|
||||
{
|
||||
$spaces = isset($options['spaces']) && boolval($options['spaces']);
|
||||
$tempData = static::getRandomData(AbstractTest::TEN_KB);
|
||||
$input = Input::createFromData($tempData);
|
||||
$uri = 'test.' . md5(microtime(false)) . '.dat';
|
||||
$prefix = $spaces ? 'test file' : 'test';
|
||||
$uri = $prefix . '.' . md5(microtime(false)) . '.dat';
|
||||
|
||||
$s3->putObject($input, $options['bucket'], $uri, $aclPrivilege);
|
||||
|
||||
$downloadURL = $s3->getAuthenticatedURL($options['bucket'], $uri, null, $options['ssl']);
|
||||
|
||||
echo "\n\tDownload URL: $downloadURL\n";
|
||||
|
||||
$downloadedData = @file_get_contents($downloadURL);
|
||||
|
||||
try
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
|
|
246
s3_storage/vendor/akeeba/s3/minitest/config.dist.php
vendored
246
s3_storage/vendor/akeeba/s3/minitest/config.dist.php
vendored
|
@ -3,31 +3,89 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
// Custom Endpoint. The example below is for using LocalStack, see https://localstack.cloud/
|
||||
// define('DEFAULT_ENDPOINT', 'localhost.localstack.cloud:4566');
|
||||
// Default Amazon S3 Access Key
|
||||
define('DEFAULT_ACCESS_KEY', 'your s3 access key');
|
||||
// Default Amazon S3 Secret Key
|
||||
define('DEFAULT_SECRET_KEY', 'your secret key');
|
||||
// Default region for the bucket
|
||||
define('DEFAULT_REGION', 'us-east-1');
|
||||
// Default bucket name
|
||||
define('DEFAULT_BUCKET', 'example');
|
||||
// Default signature method (v4 or v2)
|
||||
define('DEFAULT_SIGNATURE', 'v4');
|
||||
// Use Dualstack unless otherwise specified?
|
||||
define('DEFAULT_DUALSTACK', false);
|
||||
// Use legacy path access by default?
|
||||
define('DEFAULT_PATH_ACCESS', false);
|
||||
// Should I use SSL by default?
|
||||
define('DEFAULT_SSL', true);
|
||||
// Create the 2100 test files in the bucket?
|
||||
define('CREATE_2100_FILES', true);
|
||||
|
||||
/**
|
||||
* Configure the connection options for S3 and S3-compatible services here. Use them in the $testConfigurations array.
|
||||
*/
|
||||
$serviceConfigurations = [
|
||||
's3-v4' => [
|
||||
'access' => 'AK0123456789BCDEFGHI',
|
||||
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
||||
'region' => 'eu-west-1',
|
||||
'bucket' => 'mybucket',
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
'ssl' => false,
|
||||
'endpoint' => null,
|
||||
],
|
||||
's3-v2' => [
|
||||
'access' => 'AK0123456789BCDEFGHI',
|
||||
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
||||
'region' => 'eu-west-1',
|
||||
'bucket' => 'mybucket',
|
||||
'signature' => 'v2',
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
'ssl' => false,
|
||||
'endpoint' => null,
|
||||
],
|
||||
'localstack-v4' => [
|
||||
'access' => 'KYLOREN',
|
||||
'secret' => 'BenSolo',
|
||||
'region' => 'us-east-1',
|
||||
'bucket' => 'test',
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
'ssl' => false,
|
||||
'endpoint' => 'localhost.localstack.cloud:4566',
|
||||
],
|
||||
'localstack-v2' => [
|
||||
'access' => 'KYLOREN',
|
||||
'secret' => 'BenSolo',
|
||||
'region' => 'us-east-1',
|
||||
'bucket' => 'test',
|
||||
'signature' => 'v2',
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
'ssl' => false,
|
||||
'endpoint' => 'localhost.localstack.cloud:4566',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Test EVERYTHING.
|
||||
*/
|
||||
$allTheTests = [
|
||||
'BucketsList',
|
||||
'BucketLocation',
|
||||
'HeadObject',
|
||||
'ListFiles',
|
||||
'SmallFiles',
|
||||
'SmallInlineFiles',
|
||||
'SmallFilesNoDelete',
|
||||
'SmallFilesOnlyUpload',
|
||||
'SmallInlineFilesNoDelete',
|
||||
'SmallInlineFilesOnlyUpload',
|
||||
'SmallInlineXMLFiles',
|
||||
'BigFiles',
|
||||
'Multipart',
|
||||
'StorageClasses',
|
||||
'SignedURLs',
|
||||
];
|
||||
|
||||
if (CREATE_2100_FILES)
|
||||
{
|
||||
$allTheTests[] = 'ListThousandsOfFiles';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for standard key pairs allowing us to read, write and delete
|
||||
*
|
||||
|
@ -36,15 +94,15 @@ define('CREATE_2100_FILES', true);
|
|||
$standardTests = [
|
||||
'BucketsList',
|
||||
'BucketLocation',
|
||||
'SmallFiles',
|
||||
'HeadObject',
|
||||
'ListFiles',
|
||||
'SmallFiles',
|
||||
'SmallInlineFiles',
|
||||
'SmallInlineXMLFiles',
|
||||
'SignedURLs',
|
||||
'StorageClasses',
|
||||
'ListFiles',
|
||||
'BigFiles',
|
||||
'Multipart',
|
||||
'StorageClasses',
|
||||
'SignedURLs',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -123,53 +181,123 @@ $testConfigurations = [
|
|||
* - Buckets with international letters
|
||||
* - Access from within EC2
|
||||
*/
|
||||
'Global key, v4, DNS, single stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
],
|
||||
|
||||
// Amazon S3, v2 signatures
|
||||
'S3, v2, subdomain, single stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v2'],
|
||||
[
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'Global key, v4, DNS, dual stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v4',
|
||||
'dualstack' => true,
|
||||
'path_access' => false,
|
||||
],
|
||||
'S3, v2, subdomain, dual stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v2'],
|
||||
[
|
||||
'dualstack' => true,
|
||||
'path_access' => false,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'Global key, v4, path, single stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v4',
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
],
|
||||
'S3, v2, path, single stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v2'],
|
||||
[
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'Global key, v4, path, dual stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v4',
|
||||
'dualstack' => true,
|
||||
'path_access' => true,
|
||||
],
|
||||
'S3, v2, path, dual stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v2'],
|
||||
[
|
||||
'dualstack' => true,
|
||||
'path_access' => true,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
|
||||
'Global key, v2, DNS, single stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v2',
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
],
|
||||
// Amazon S3, v4 signatures
|
||||
'S3, v4, subdomain, single stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v4'],
|
||||
[
|
||||
'dualstack' => false,
|
||||
'path_access' => false,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'Global key, v2, DNS, dual stack' => [
|
||||
'configuration' => [
|
||||
'signature' => 'v2',
|
||||
'dualstack' => true,
|
||||
'path_access' => false,
|
||||
],
|
||||
'S3, v4, subdomain, dual stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v4'],
|
||||
[
|
||||
'dualstack' => true,
|
||||
'path_access' => false,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'S3, v4, path, single stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v4'],
|
||||
[
|
||||
'dualstack' => false,
|
||||
'path_access' => true,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
'S3, v4, path, dual stack' => [
|
||||
'configuration' => array_merge(
|
||||
$serviceConfigurations['s3-v4'],
|
||||
[
|
||||
'dualstack' => true,
|
||||
'path_access' => true,
|
||||
]
|
||||
),
|
||||
'tests' => $standardTests,
|
||||
'skip' => false,
|
||||
],
|
||||
|
||||
// LocalStack
|
||||
'LocalStack, V2 (always path access, single stack)' => [
|
||||
'configuration' => $serviceConfigurations['localstack-v2'],
|
||||
'tests' => $allTheTests,
|
||||
'skip' => false,
|
||||
],
|
||||
|
||||
'LocalStack, V4 (always path access, single stack)' => [
|
||||
'configuration' => $serviceConfigurations['localstack-v4'],
|
||||
'tests' => $allTheTests,
|
||||
'skip' => false,
|
||||
],
|
||||
|
||||
/**
|
||||
* In the real config file we also have tests running on:
|
||||
*
|
||||
* - Wasabi, v2, path-style access.
|
||||
* - Wasabi, v4, path-style access.
|
||||
* - Synology C2, subdomain access.
|
||||
*
|
||||
* See [[NOTES.md]] for more information. If you have another environment you think we should test with please
|
||||
* update NOTES.md and make a pull request, along with the reasoning behind it.
|
||||
*
|
||||
* There are known failures for some cases, notably LocalStack v4 (something is amiss?) and C2 (necessary flag is
|
||||
* not yet supported by the minitest framework).
|
||||
*/
|
||||
];
|
|
@ -3,13 +3,29 @@
|
|||
* Akeeba Engine
|
||||
*
|
||||
* @package akeebaengine
|
||||
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd
|
||||
* @license GNU General Public License version 3, or later
|
||||
*/
|
||||
|
||||
use Akeeba\S3\Configuration;
|
||||
use Akeeba\S3\Connector;
|
||||
use Akeeba\S3\Input;
|
||||
|
||||
/**
|
||||
* The Miniature Test Framework For The Akeeba S3 Library
|
||||
*
|
||||
* This is a self-contained test-suite runner. Running minitest.php will execute all the tests against all
|
||||
* configurations set up in the config.php file. When it's decked out with all real world examples this can take many
|
||||
* hours to complete (it's not as "mini" as its name would like you to believe).
|
||||
*
|
||||
* Please read NOTES.md before proceeding and do keep in mind that some tests may fail for reasons outside the control
|
||||
* of the library such as network conditions, whether PHP has a configured Certification Authority cache etc.
|
||||
*
|
||||
* As to why we didn't use Unit Tests: Elementary, dear Watson. Unit Tests are great when testing your code against a
|
||||
* specification. In this case, the specification would be the Amazon S3 API documentation. Sounds great in theory, but
|
||||
* not even Amazon itself works according to its own documentation, let alone the third party "S3-compatible" services
|
||||
* which each one implements its own interpretation of that documentation. Therefore, slow-as-heck integration testing
|
||||
* is the only way to do any kind of meaningful testing.
|
||||
*/
|
||||
|
||||
// Necessary for including the library
|
||||
define('AKEEBAENGINE', 1);
|
||||
|
@ -152,6 +168,13 @@ foreach ($testConfigurations as $description => $setup)
|
|||
echo "▶ " . $description . PHP_EOL;
|
||||
echo str_repeat('〰', 80) . PHP_EOL . PHP_EOL;
|
||||
|
||||
if ($setup['skip'] ?? false)
|
||||
{
|
||||
echo "\t🤡 Skipping\n\n";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Extract the configuration options
|
||||
if (!isset($setup['configuration']))
|
||||
{
|
||||
|
@ -159,14 +182,14 @@ foreach ($testConfigurations as $description => $setup)
|
|||
}
|
||||
|
||||
$configOptions = array_merge([
|
||||
'access' => DEFAULT_ACCESS_KEY,
|
||||
'secret' => DEFAULT_SECRET_KEY,
|
||||
'region' => DEFAULT_REGION,
|
||||
'bucket' => DEFAULT_BUCKET,
|
||||
'signature' => DEFAULT_SIGNATURE,
|
||||
'dualstack' => DEFAULT_DUALSTACK,
|
||||
'path_access' => DEFAULT_PATH_ACCESS,
|
||||
'ssl' => DEFAULT_SSL,
|
||||
'access' => defined('DEFAULT_ACCESS_KEY') ? DEFAULT_ACCESS_KEY : null,
|
||||
'secret' => defined('DEFAULT_SECRET_KEY') ? DEFAULT_SECRET_KEY : null,
|
||||
'region' => defined('DEFAULT_REGION') ? DEFAULT_REGION : null,
|
||||
'bucket' => defined('DEFAULT_BUCKET') ? DEFAULT_BUCKET : null,
|
||||
'signature' => defined('DEFAULT_SIGNATURE') ? DEFAULT_SIGNATURE : null,
|
||||
'dualstack' => defined('DEFAULT_DUALSTACK') ? DEFAULT_DUALSTACK : null,
|
||||
'path_access' => defined('DEFAULT_PATH_ACCESS') ? DEFAULT_PATH_ACCESS : null,
|
||||
'ssl' => defined('DEFAULT_SSL') ? DEFAULT_SSL : null,
|
||||
'endpoint' => defined('DEFAULT_ENDPOINT') ? constant('DEFAULT_ENDPOINT') : null,
|
||||
], $setup['configuration']);
|
||||
|
||||
|
@ -200,6 +223,22 @@ foreach ($testConfigurations as $description => $setup)
|
|||
$s3Configuration->setUseLegacyPathStyle($configOptions['path_access']);
|
||||
$s3Configuration->setSSL($configOptions['ssl']);
|
||||
|
||||
// Feature flags
|
||||
if (isset($configOptions['alternateDateHeaderFormat']))
|
||||
{
|
||||
$s3Configuration->setAlternateDateHeaderFormat((bool) $configOptions['alternateDateHeaderFormat']);
|
||||
}
|
||||
|
||||
if (isset($configOptions['useHTTPDateHeader']))
|
||||
{
|
||||
$s3Configuration->setUseHTTPDateHeader((bool) $configOptions['useHTTPDateHeader']);
|
||||
}
|
||||
|
||||
if (isset($configOptions['preSignedBucketInURL']))
|
||||
{
|
||||
$s3Configuration->setPreSignedBucketInURL((bool) $configOptions['preSignedBucketInURL']);
|
||||
}
|
||||
|
||||
// Create the connector object
|
||||
$s3Connector = new Connector($s3Configuration);
|
||||
|
||||
|
@ -350,7 +389,7 @@ foreach ($testConfigurations as $description => $setup)
|
|||
[$className, $method] = $callableSetup;
|
||||
echo " ⏱ Tearing down {$className}:{$method}…";
|
||||
call_user_func($callableTeardown, $s3Connector, $configOptions);
|
||||
echo "\r Teared down {$className} " . PHP_EOL;
|
||||
echo "\r Tore down {$className} " . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue