Skip to content

sebcode/gsandbox

Repository files navigation

gsandbox

Build Status

Sandbox for Amazon Glacier written in PHP. Useful to mock Amazon Glacier API in unit tests.

Coverage

Action HTTP request
Create vault PUT /-/vaults/vault-name
List vaults GET /-/vaults
Delete vault DELETE /-/vaults/vault-name
Describe vault GET /-/vaults/vault-name
Add/remove tags POST /-/vaults/vault-name/tags
List tags GET /-/vaults/vault-name/tags
Action HTTP request
Initiate job POST /-/vaults/vault-name/jobs
List jobs GET /-/vaults/vault-name/jobs
Describe job GET /-/vaults/vault-name/job/job-id
Get job output GET /-/vaults/vault-name/jobs/job-id/output
Action HTTP request
Upload Archive POST /-/vaults/vault-name/archives
Delete Archive DELETE /-/vaults/vault-name/archives/archive-id
Action HTTP request
Initiate multipart upload POST /-/vaults/vault-name/multipart-uploads
List multipart uploads GET /-/vaults/vault-name/multipart-uploads
Upload multipart part PUT /-/vaults/vault-name/multipart-uploads/id
List multipart upload parts GET /-/vaults/vault-name/multipart-uploads/id
Finalize multipart upload POST /-/vaults/vault-name/multipart-uploads/id
Abort multipart upload DELETE /-/vaults/vault-name/multipart-uploads/id
Action HTTP request
Get Data Retrieval Policy GET /-/policies/data-retrieval
Set Data Retrieval Policy PUT /-/policies/data-retrieval

Limitations

  • Request signature checking is not implemented.
  • Error responses are not properly implemented yet.

Notes

  • Call GET /sandbox/reset/ACCESSKEY to delete all data for the specified account.

Requirements

Installation

  • Checkout repository to /var/www/gsandbox for example.
  • Call composer install to install dependencies.
  • cp config.sample.php config.php.
  • Edit config.php and change storePath to the path where data should be stored (e.g. /var/gsandboxstore/).
  • Make storePath readable and writeable for web server.
  • Each directory in storePath represents a fake Amazon AWS Access Key you will be using to connect to the test server. Create that directory and make it readable and writeable for the web server.
  • Add 127.0.0.1 gsandbox.test to /etc/hosts

Using PHP's Builtin Webserver

  • Run php -S 127.0.0.1:8080 htdocs/index.php

Using Apache

  • Example apache virtual host:

     <VirtualHost *:8080>
       ServerName gsandbox.test
       DocumentRoot /var/www/gsandbox/htdocs
    
       <Directory /var/www/gsandbox/htdocs>
         AllowMethods GET PUT POST OPTIONS DELETE
         RewriteEngine On
         RewriteBase /
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_FILENAME} !-d
         RewriteRule . index.php [L]
         SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    
         DirectoryIndex index.php
         AllowOverride All
         Order allow,deny
         Allow from all
       </Directory>
     </VirtualHost>
    

Run Tests

  • Make sure that $storePath/UNITTEST/vaults exists.
  • Make sure that gsandbox is accessible via http://gsandbox.test:8080/.
  • Run vendor/bin/codecept run.

Credits

Sebastian Volland - http://github.com/sebcode

About

Sandbox for Amazon Glacier written in PHP. Useful to mock Amazon Glacier API in unit tests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages