Skip to content

Instantly share code, notes, and snippets.

@jamiehannaford
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiehannaford/73271df790a6cbb5f940 to your computer and use it in GitHub Desktop.
Save jamiehannaford/73271df790a6cbb5f940 to your computer and use it in GitHub Desktop.
Object Storage feature stories
Feature: Copy object
In order to move around my objects easily
As an OpenStack SDK user
I want to copy an object
Scenario: Copy an object from one container to another
Given I have a container with an object inside
And I have a destination container
When I call copy
Then The destination container should contain the object
And The response status code should be 201
Scenario: Copy a non-existent object
Given I have an empty container
And I have a destination container
When I call copy
Then A ResourceNotFound exception should be thrown
And The error message should be "The copied object does not exist"
Scenario: Copy an object to non-existent container
Given I have a container with an object inside
And I have no destination container
When I call copy
Then A ResourceNotFound exception should be thrown
And The error message should be "The destination container does not exist"
Feature: Delete Container
In order to keep resource costs down
As an OpenStack SDK user
I want to delete pre-existing containers that are empty
Scenario: Delete an empty container
Given There is an empty container
When I call delete
Then An instance of ModelInterface should be returned
And The response status code should be 204
And The empty container should no longer exist
Scenario: Delete a non-existent container
Given I have no containers
When I call delete
Then A ResourceNotFoundException should be thrown
And The error message should be "The container does not exist"
Scenario: Delete a non-empty container
Given I have a container with an object inside
When I call delete
Then A ConflictException should be thrown
And The error message should be "Non-empty containers cannot be deleted"
Feature: Get account details and list containers
In order to understand how I'm using my account
As an OpenStack user
I want to get my account details and list my containers
Scenario: Get an account with no containers
Given I have no containers
When I query my account
Then There should be no containers returned
And The response status code should be 204
Scenario: Get an account with multiple containers
Given I have <Container count> containers
And Each container has <Object count> objects
And Each object is <Object size> bytes
When I query my account
Then There should be <Container count> containers returned
And ContainerCount should equal <Container count>
And ObjectCount should equal <Total object count>
And BytesUsed should equal <Total object size>
And The response status code should be 200
Examples:
| Container count | Object count | Object size | Total object count | Total object size |
| 1 | 10 | 24 | 10 | 240 |
| 10 | 21 | 5 | 210 | 1050 |
Scenario: Get an account with custom metadata
Given I have a container with 3 custom metadata items
When I query my account
Then There should be 3 metadata items returned
Scenario: List containers up to a certain limit
Given I have 5 containers
When I query my account
And Set a limit of 2
Then There should be 2 containers returned
Scenario: List containers from marker onwards
Given I have containers with names from A to D
When I query my account
And Set a marker of C
Then There should be 2 containers returned
Scenario: List containers from end_marker backwards
Given I have containers with names from X to Z
When I query my account
And Set an end_marker of Y
Then There should be 2 containers returned
Scenario: Only list containers that contain a prefix
Given I have containers with the names "foo_1", "foo_2", and "bar"
When I query my account
And Set a prefix value of "foo_"
Then There should be 2 containers returned
Feature: Get Container
In order to understand more about my containers
As an OpenStack SDK user
I want to get their contents and metadata
Scenario: Get an empty container
Given I have a container
When I call getContainer
Then ObjectCount should equal 0
And BytesUsed should equal 0
And objects should be empty
# Here we can use an outline to specify the steps once
# and then play multiple sets of values through them
Scenario Outline: Get a container with objects inside
Given I have a container with <Object count> objects inside
And Each object is <Object size> bytes
When I call getContainer
Then ObjectCount should equal <Object count>
And BytesUsed should equal <Total size>
And The objects element should contain <Object count> elements
Examples:
| Object count | Object size | Total size |
| 10 | 10 | 100 |
| 1 | 1024 | 1024 |
| 120 | 512 | 61440 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment