right_aws 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,8 +60,9 @@ class TestEc2 < Test::Unit::TestCase
60
60
 
61
61
  def test_09_delete_key_pair
62
62
  assert @ec2.delete_key_pair(@key), 'Delete_key_pair fail'
63
- # key must be deleted already
64
- assert_raise(Rightscale::AwsError) { @ec2.delete_key_pair(@key) }
63
+ ## Hmmm... Amazon does not through the exception any more. It now just returns a 'true' if the key does not exist any more...
64
+ ## # key must be deleted already
65
+ ## assert_raise(Rightscale::AwsError) { @ec2.delete_key_pair(@key) }
65
66
  end
66
67
 
67
68
  end
@@ -25,7 +25,7 @@ class TestS3 < Test::Unit::TestCase
25
25
  end
26
26
 
27
27
  def test_03_list_empty_bucket
28
- assert_equal 0, @s3.list_bucket(@bucket).size, "#{@queue_name} must exist!"
28
+ assert_equal 0, @s3.list_bucket(@bucket).size, "#{@bucket} must exist!"
29
29
  end
30
30
 
31
31
  def test_04_put
@@ -31,13 +31,14 @@ class TestSqs < Test::Unit::TestCase
31
31
  queue_url = @sqs.queue_url_by_name(@queue_name)
32
32
  assert queue_url[/http.*#{@queue_name}/], "#{@queue_name} must exist!"
33
33
  assert @sqs.set_queue_attributes(queue_url, 'VisibilityTimeout', 111), 'Set_queue_attributes fail'
34
- sleep 5 # Amazon needs some time to change attribute
34
+ sleep 10 # Amazon needs some time to change attribute
35
35
  assert_equal '111', @sqs.get_queue_attributes(queue_url)['VisibilityTimeout'], 'New VisibilityTimeout must be equal to 111'
36
36
  end
37
37
 
38
38
  def test_04_set_and_get_visibility_timeout
39
39
  queue_url = @sqs.queue_url_by_name(@queue_name)
40
40
  assert @sqs.set_visibility_timeout(queue_url, 222), 'Set_visibility_timeout fail'
41
+ sleep 10 # Amazon needs some time to change attribute
41
42
  assert_equal 222, @sqs.get_visibility_timeout(queue_url), 'Get_visibility_timeout must return to 222'
42
43
  end
43
44
 
@@ -83,7 +84,10 @@ class TestSqs < Test::Unit::TestCase
83
84
  def test_10_clear_and_delete_queue
84
85
  queue_url = @sqs.queue_url_by_name(@queue_name)
85
86
  assert_raise(Rightscale::AwsError) { @sqs.delete_queue(queue_url) }
86
- assert @sqs.force_clear_queue(queue_url), 'Force_clear_queue fail'
87
+ ## oops, force_clear_queue does not work any more - amazon expects for 60 secs timeout between
88
+ ## queue deletion and recreation...
89
+ ## assert @sqs.force_clear_queue(queue_url), 'Force_clear_queue fail'
90
+ assert @sqs.clear_queue(queue_url), 'Clear_queue fail'
87
91
  assert @sqs.delete_queue(queue_url), 'Delete_queue fail'
88
92
  end
89
93
 
@@ -94,13 +98,13 @@ class TestSqs < Test::Unit::TestCase
94
98
  def test_20_sqs_create_delete_queue
95
99
  assert @s, 'Rightscale::Sqs must exist'
96
100
  # get queues list
97
- queues = @s.queues
101
+ queues_size = @s.queues.size
98
102
  # create new queue
99
103
  queue = @s.queue("#{@queue_name}_20", true)
100
104
  # check that it is created
101
105
  assert queue.is_a?(Rightscale::Sqs::Queue)
102
106
  # check that amount of queues has increased
103
- assert_equal queues.size+1, @s.queues.size
107
+ assert_equal queues_size + 1, @s.queues.size
104
108
  # delete queue
105
109
  assert queue.delete
106
110
  end
@@ -110,12 +114,11 @@ class TestSqs < Test::Unit::TestCase
110
114
  queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_21", true)
111
115
  # check that it is created
112
116
  assert queue.is_a?(Rightscale::Sqs::Queue)
113
- # Don't test this - just for cleanup purposes
114
- queue.delete
115
117
  end
116
118
 
117
119
  def test_22_queue_attributes
118
- queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_22", false)
120
+ sleep 10
121
+ queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_21", false)
119
122
  # get a list of attrinutes
120
123
  attributes = queue.get_attribute
121
124
  assert attributes.is_a?(Hash) && attributes.size>0
@@ -124,7 +127,7 @@ class TestSqs < Test::Unit::TestCase
124
127
  # set attribute
125
128
  assert queue.set_attribute('VisibilityTimeout', v)
126
129
  # wait a bit
127
- sleep 5
130
+ sleep 10
128
131
  # check that attribute has changed
129
132
  assert_equal v, queue.get_attribute('VisibilityTimeout')
130
133
  # get queue visibility timeout
@@ -133,14 +136,16 @@ class TestSqs < Test::Unit::TestCase
133
136
  queue.visibility += 10
134
137
  # make sure that it is changed
135
138
  assert v.to_i + 10, queue.visibility
136
- # Don't test this - just for cleanup purposes
137
- queue.delete
138
139
  end
139
140
 
140
141
  def test_23_grantees
141
- queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_23", false)
142
+ queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_21", false)
142
143
  # get a list of grantees
143
144
  grantees = queue.grantees
145
+ # well, queue must exist at least some seconds before we could add grantees to it....
146
+ # otherwise we get "Queue does not exists" message. Hence we use the queue
147
+ # has been created at previous step.
148
+ #
144
149
  # create new grantee
145
150
  grantee = Rightscale::Sqs::Grantee.new(queue, GRANTEE_EMAIL_ADDRESS)
146
151
  assert grantee.perms.empty?
@@ -160,7 +165,7 @@ class TestSqs < Test::Unit::TestCase
160
165
  end
161
166
 
162
167
  def test_24_send_size
163
- queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_24", false)
168
+ queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_24", true)
164
169
  # send 5 messages
165
170
  assert queue.push('a1')
166
171
  assert queue.push('a2')
@@ -173,13 +178,10 @@ class TestSqs < Test::Unit::TestCase
173
178
  assert queue.push('a6')
174
179
  # check queue size again
175
180
  assert_equal 6, queue.size
176
- # Don't test this - just for cleanup purposes
177
- queue.clear
178
- queue.delete
179
181
  end
180
182
 
181
183
  def test_25_message_receive_pop_peek_delete
182
- queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_25", false)
184
+ queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_24", false)
183
185
  # get queue size
184
186
  size = queue.size
185
187
  # get first message
@@ -201,23 +203,16 @@ class TestSqs < Test::Unit::TestCase
201
203
  assert m1.delete
202
204
  # make sure that queue size has decreased again
203
205
  assert_equal size-2, queue.size
204
- # Don't test this - just for cleanup purposes
205
- queue.delete
206
206
  end
207
207
 
208
208
  def test_26
209
- queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_26", false)
209
+ queue = Rightscale::Sqs::Queue.create(@s, "#{@queue_name}_24", false)
210
210
  # lock message
211
211
  queue.receive(100)
212
212
  # clear queue
213
213
  assert queue.clear
214
214
  # queue size is greater than zero
215
215
  assert queue.size>0
216
- # force clear queue
217
- assert queue.clear(true)
218
- # queue size must be equal to zero
219
- assert queue.size==0
220
- # push new message
221
216
  queue.push('123456')
222
217
  assert_raise(Rightscale::AwsError) { queue.delete }
223
218
  assert queue.delete(true)
@@ -1,4 +1,5 @@
1
1
  require 'test/unit'
2
+ $: << File.dirname(__FILE__)
2
3
  require 'test_credentials'
3
4
  TestCredentials.get_credentials
4
5
 
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: right_aws
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2007-08-15 00:00:00 -07:00
6
+ version: 1.2.0
7
+ date: 2007-09-12 00:00:00 -07:00
8
8
  summary: Interface classes for the Amazon EC2, SQS, and S3 Web Services
9
9
  require_paths:
10
10
  - lib
11
11
  email: support@rightscale.com
12
- homepage: " by RightScale, Inc."
12
+ homepage:
13
13
  rubyforge_project: rightaws
14
- description: "RightAws::Ec2 is a Ruby library for the Amazon EC2 (Elastic Compute Cloud) service. RightAws::S3 and RightAws::S3Interface are Ruby libraries for the Amazon S3 (Simple Storage Service) service. RightAws::Sqs and RightAws::SqsInterface is a Ruby library for the Amazon SQS (Simple Queue Service) service. All RightAws interfaces work in one of two ways: 1) They use a single persistent HTTP connection per process or 2) per Ruby thread. Foir example, it doesn't matter how many RightAws::S3 objects you create, they all use the same per-program or per-thread connection. The purpose of sharing the connection is to keep a single persistent HTTP connection open to avoid paying connection overhead on every request. However, if you have multiple concurrent threads, you may want or need an HTTP connection per thread to enable concurrent requests to S3. The way this plays out in practice is: 1) If you have a non-multithreaded Ruby program, use the non-multithreaded setting for Gem. 2) If you have a multi-threaded Ruby program, use the multithreaded setting to enable concurrent requests to S3 (SQS, EC2). 3) For running under Mongrel/Rails, use thhe non-multithreaded setting for Gem even though Mongrel is multithreaded. This is because only one Rails handler is invoked at any time (i.e. it acts like a single-threaded program)"
14
+ description: "== DESCRIPTION: The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, Amazon, S3, and Amazon SQS. These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon. The RightScale AWS gems comprise: - RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud) - RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service) - RightAws::Sqs and RightAws::SqsInterface -- interface to Amazon SQS (Simple Queue Service) == FEATURES:"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -35,6 +35,7 @@ files:
35
35
  - Rakefile
36
36
  - lib/right_aws.rb
37
37
  - lib/awsbase/benchmark_fix.rb
38
+ - lib/awsbase/support.rb
38
39
  - lib/awsbase/right_awsbase.rb
39
40
  - lib/ec2/right_ec2.rb
40
41
  - lib/s3/right_s3.rb
@@ -50,15 +51,7 @@ files:
50
51
  - test/ts_right_aws.rb
51
52
  - test/test_credentials.rb
52
53
  test_files:
53
- - test/awsbase/test_helper.rb
54
- - test/awsbase/test_right_awsbase.rb
55
- - test/ec2/test_helper.rb
56
- - test/ec2/test_right_ec2.rb
57
- - test/s3/test_helper.rb
58
- - test/s3/test_right_s3.rb
59
- - test/sqs/test_helper.rb
60
- - test/sqs/test_right_sqs.rb
61
- - test/test_credentials.rb
54
+ - test/ts_right_aws.rb
62
55
  rdoc_options:
63
56
  - --main
64
57
  - README.txt
@@ -73,15 +66,6 @@ extensions: []
73
66
  requirements: []
74
67
 
75
68
  dependencies:
76
- - !ruby/object:Gem::Dependency
77
- name: activesupport
78
- version_requirement:
79
- version_requirements: !ruby/object:Gem::Version::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: 1.4.1
84
- version:
85
69
  - !ruby/object:Gem::Dependency
86
70
  name: right_http_connection
87
71
  version_requirement:
@@ -1,2 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../../lib/right_aws'
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
- require 'pp'
3
-
4
- class TestAwsbase < Test::Unit::TestCase
5
-
6
- def setup
7
- end
8
-
9
- def test_01_create_describe_key_pairs
10
- end
11
-
12
- end