ocean-dynamo 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce113a0cc1dc99b428010d59a1a4f5cb508dcefb
4
- data.tar.gz: c2ce6a2d070908c370e1e3fc29a60eab0e15a269
3
+ metadata.gz: f2cdd30b503b4060f584c550f20b4bfa7b2ba959
4
+ data.tar.gz: 5048098e3a9566858ce71b3862c3af4f822ef765
5
5
  SHA512:
6
- metadata.gz: e945ae2cf6e19c81bddd963ad1416064b997eaefaf73ae3c4edaaff223c50851ba9fd2227064fbcd56fe9496c6e0fde697d27c43058e036769361f21f4be52be
7
- data.tar.gz: 4a749b813876644ceb054c28f76b3124315f90b115b4c0aac967a6ab912b66641be50763af0fa7397fbc2f00161b9cfbf66a900ec701047ef3a689f8645ddf9d
6
+ metadata.gz: 2600759e665f052392e3255ff0a382ee6175d25d393ff64a550b96ae2f49841abf87a35f56cf3ac174765cd3bf9fd71b83d11e8c1527c09fc611c85d177446d9
7
+ data.tar.gz: 0f7242ea5d99b228600f79e2cc7f83c47bca269c6c605794a09d87a8beeacc6d0fc8c25ce40ee4df976b191a3e418cbcfc42e99b26d61753953b3cc6edfd2f31
@@ -37,7 +37,7 @@ The following example shows the basic syntax for declaring a DynamoDB-based sche
37
37
 
38
38
  dynamo_schema(:guid) do
39
39
  attribute :credentials, :string
40
- attribute :token, :string, default: Proc { SecureRandom.guid }
40
+ attribute :token, :string, default: Proc { SecureRandom.uuid }
41
41
  attribute :steps, :serialized, default: []
42
42
  attribute :max_seconds_in_queue, :integer, default: 1.day
43
43
  attribute :default_poison_limit, :integer, default: 5
@@ -269,26 +269,29 @@ With DynamoDB Local running, you should now be able to do
269
269
  All tests should pass.
270
270
 
271
271
 
272
- === Resetting the DynamoDB Local database
272
+ === Cleaning up the DB
273
273
 
274
- You might want to add the following to your spec_helper.rb file, inside the +RSpec.configure+
275
- block. It deletes all test tables before your test suite is run:
274
+ You might want to add the following to your spec_helper.rb file, before the +RSpec.configure+
275
+ block:
276
276
 
277
- config.before(:suite) do
277
+ # DynamoDB table cleaner
278
+ CHEF_ENV = "master" unless defined?(CHEF_ENV)
279
+ cleaner = lambda {
278
280
  c = Aws::DynamoDB::Client.new
279
- regexp = Regexp.new("^.+_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_test$")
280
- c.list_tables.table_names.each do |t|
281
- next unless t =~ regexp
281
+ c.list_tables.table_names.each do |t|
282
+ next unless t =~ Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_test$")
282
283
  c.delete_table({table_name: t})
283
284
  end
284
- end
285
+ }
286
+
287
+ Then, inside the +RSpec.configure+ block:
288
+
289
+ config.before(:suite) { cleaner.call }
290
+ config.after(:suite) { cleaner.call }
291
+
292
+ This will remove only those tables created by the specs on this particular machine and
293
+ environment. This is safe even on AWS and for parallel testing.
285
294
 
286
- You can add an +after(:suite)+ block too if you like, to remove all test tables after
287
- the suite has run. Later, we will add automatic removal of only those tables created
288
- by the test run itself, which is required when tests are done in parallel against
289
- the real AWS service. Until then, you might want to modify the above code to do nothing
290
- when running against AWS and clear your test tables manually. (If you're running Ocean,
291
- an Ocean CronJob will already take care of this for you each night.)
292
295
 
293
296
  == Rails console
294
297
 
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk