Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sped up a few of the DynamoDB batch write integration tests.

  • Loading branch information...
commit 2b3eb54b770eb37c544bbc8a291ef436fb926c51 1 parent 976cf7b
@trevorrowe trevorrowe authored
View
20 features/dynamo_db/batch_write.feature
@@ -15,19 +15,25 @@
@dynamo_db @batch_write
Feature: DynamoDB Tables
- @slow
Scenario: Batch Writing items
- Given I create a DynamoDB table
- And the table should eventually be active
+ Given I have an empty DynamoDB table with options:
+ """
+ { :hash_key => { :id => :string } }
+ """
When I batch put 25 items to the table
Then the table should have 25 items
When I batch delete 25 items from the table
Then the table should have 0 items
- @slow
Scenario: Batch Writing across tables
- Given I create a DynamoDB table
- And I create a DynamoDB table
- And the tables are eventually active
+ Given I have an empty DynamoDB table with options:
+ """
+ { :hash_key => { :id => :string } }
+ """
+ And I have an empty DynamoDB table with options:
+ """
+ { :hash_key => { :id => :string },
+ :range_key => { :range => :number } }
+ """
When I batch put 10 items to each table
Then the tables should have 10 items each
View
6 features/dynamo_db/step_definitions/batch_write.rb
@@ -27,10 +27,10 @@
When /^I batch put (\d+) items to each table$/ do |count|
- put = (1..count.to_i).map{|n| { :id => n.to_s, :counts => [n, n+1] }}
+ put = (1..count.to_i).map{|n| { :id => n.to_s, :range => [n, n+1] }}
@dynamo_db.batch_write do |batch|
- @created_tables.each do |table|
+ @tables.each do |table|
batch.write(table, :put => put)
end
end
@@ -38,7 +38,7 @@
end
Then /^the tables should have (\d+) items each$/ do |count|
- @created_tables.each do |table|
+ @tables.each do |table|
table.items.count.should == count.to_i
end
end
View
2  features/dynamo_db/step_definitions/dynamo_db.rb
@@ -18,6 +18,7 @@
session = AWS::STS.new.new_session
@dynamo_db = AWS::DynamoDB.new
+ @tables = []
@created_tables = []
end
@@ -39,6 +40,7 @@ def create_table(string)
begin
@table = @dynamo_db.tables.create(table_name, 10, 10, eval(string))
+ @tables << @table
eventually do
@table.exists?.should == true and @table.status.should == :active
Please sign in to comment.
Something went wrong with that request. Please try again.