torpedo 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,5 @@
1
+ * Sat Oct 29 2011 Dan Prince <dan.prince@rackspace.com> - 1.0.1
2
+ - Add config options to support custom flavor settings.
3
+
4
+ * Fri Oct 28 2011 Dan Prince <dan.prince@rackspace.com> - 1.0.0
5
+ - Initial release.
data/README.md CHANGED
@@ -24,6 +24,10 @@ Installation
24
24
  #image_name:
25
25
  #image_ref:
26
26
 
27
+ # FLAVORS (Set one of the following)
28
+ #flavor_name:
29
+ flavor_ref: 4
30
+
27
31
  # TIMEOUTS
28
32
  #ping_timeout: 60
29
33
  #ssh_timeout: 30
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -17,8 +17,8 @@ module Helper
17
17
 
18
18
  def self.get_image_ref(conn)
19
19
 
20
- image_ref = ENV['IMAGE_REF']
21
- image_name = ENV['IMAGE_NAME']
20
+ image_ref = IMAGE_REF
21
+ image_name = IMAGE_NAME
22
22
 
23
23
  if image_name and not image_name.empty? then
24
24
  images = conn.images.each do |image|
@@ -36,6 +36,48 @@ module Helper
36
36
 
37
37
  end
38
38
 
39
+ def self.get_flavor_ref(conn)
40
+
41
+ flavor_ref = FLAVOR_REF
42
+ flavor_name = FLAVOR_NAME
43
+
44
+ if flavor_name and not flavor_name.empty? then
45
+ flavors = conn.flavors.each do |flavor|
46
+ if flavor[:name] == flavor_name then
47
+ flavor_ref = flavor[:id]
48
+ end
49
+ end
50
+ elsif not flavor_ref or flavor_ref.to_s.empty? then
51
+ # default to 2 (m1.small) if FLAVOR_REF and or FLAVOR_NAME aren't set
52
+ flavor_ref = 2
53
+ end
54
+
55
+ flavor_ref.to_s
56
+
57
+ end
58
+
59
+ #flavor ref used for resize
60
+ def self.get_flavor_ref_resize(conn)
61
+
62
+ flavor_ref_resize = FLAVOR_REF_RESIZE
63
+ flavor_name_resize = FLAVOR_NAME_RESIZE
64
+
65
+ if flavor_name_resize and not flavor_name_resize.empty? then
66
+ flavors = conn.flavors.each do |flavor|
67
+ if flavor[:name] == flavor_name_resize then
68
+ flavor_ref_resize = flavor[:id]
69
+ end
70
+ end
71
+ elsif not flavor_ref_resize or flavor_ref_resize.to_s.empty? then
72
+ # if no flavor ref is specified for resize add one to it
73
+ flavor_ref = Helper.get_flavor_ref(conn)
74
+ flavor_ref_resize = flavor_ref.to_is + 1
75
+ end
76
+
77
+ flavor_ref_resize.to_s
78
+
79
+ end
80
+
39
81
  end
40
82
  end
41
83
  end
@@ -8,6 +8,7 @@ class Servers < Test::Unit::TestCase
8
8
  @@servers = []
9
9
  @@images = []
10
10
  @@image_ref = Helper::get_image_ref(Helper::get_connection)
11
+ @@flavor_ref = Helper::get_flavor_ref(Helper::get_connection)
11
12
  @@server = nil #ref to last created server
12
13
 
13
14
  def setup
@@ -72,7 +73,7 @@ class Servers < Test::Unit::TestCase
72
73
  def check_server(server, image_ref, flavor_ref, check_status="ACTIVE")
73
74
 
74
75
  assert_not_nil(server.hostId)
75
- assert_equal(flavor_ref.to_s, server.flavor['id'])
76
+ assert_equal(flavor_ref, server.flavor['id'])
76
77
  assert_equal(image_ref.to_s, server.image['id'])
77
78
  assert_equal('test1', server.name)
78
79
  server = @conn.server(server.id)
@@ -108,7 +109,7 @@ class Servers < Test::Unit::TestCase
108
109
  # limitations
109
110
  personalities={SSH_PUBLIC_KEY => "/root/.ssh/authorized_keys"}
110
111
  metadata={ "key1" => "value1", "key2" => "value2" }
111
- options = {:name => "test1", :imageRef => @@image_ref, :flavorRef => 2, :personality => personalities, :metadata => metadata}
112
+ options = {:name => "test1", :imageRef => @@image_ref, :flavorRef => @@flavor_ref, :personality => personalities, :metadata => metadata}
112
113
  if KEYNAME and not KEYNAME.empty? then
113
114
  options[:key_name] = KEYNAME
114
115
  end
@@ -116,7 +117,7 @@ class Servers < Test::Unit::TestCase
116
117
  assert_not_nil(@@server.adminPass)
117
118
 
118
119
  #boot an instance and check it
119
- check_server(server, @@image_ref, 2)
120
+ check_server(server, @@image_ref, @@flavor_ref)
120
121
 
121
122
  assert_equal "value1", @@server.metadata['key1']
122
123
  assert_equal "value2", @@server.metadata['key2']
@@ -303,13 +304,15 @@ class Servers < Test::Unit::TestCase
303
304
  @@server.rebuild!(:imageRef => @@image_ref, :personality => personalities)
304
305
  server = @conn.server(@@server.id)
305
306
  sleep 15 # sleep a couple seconds until rebuild starts
306
- check_server(server, @@image_ref, 2)
307
+ check_server(server, @@image_ref, @@flavor_ref)
307
308
 
308
309
  end if TEST_REBUILD_SERVER == "true"
309
310
 
310
311
  def test_040_resize_instance
311
312
 
312
- @@server.resize!(3)
313
+ flavor_ref_resize = Helper::get_flavor_ref_resize(@conn)
314
+
315
+ @@server.resize!(flavor_ref_resize)
313
316
  server = @conn.server(@@server.id)
314
317
  assert_equal('RESIZE', @@server.status)
315
318
 
@@ -327,13 +330,13 @@ class Servers < Test::Unit::TestCase
327
330
  fail('Timeout resizing server.')
328
331
  end
329
332
 
330
- check_server(server, @@image_ref, 3, 'VERIFY_RESIZE')
333
+ check_server(server, @@image_ref, flavor_ref_resize, 'VERIFY_RESIZE')
331
334
 
332
335
  server.confirm_resize!
333
336
  server = @conn.server(@@server.id)
334
337
  assert_equal('ACTIVE', @@server.status)
335
338
 
336
- check_server(server, @@image_ref, 3)
339
+ check_server(server, @@image_ref, flavor_ref_resize)
337
340
 
338
341
  end if TEST_RESIZE_SERVER == "true"
339
342
 
data/lib/torpedo.rb CHANGED
@@ -17,6 +17,12 @@ KEYNAME=configs['keyname']
17
17
  IMAGE_REF=configs['image_ref']
18
18
  IMAGE_NAME=configs['image_name']
19
19
 
20
+ FLAVOR_REF=configs['flavor_ref']
21
+ FLAVOR_NAME=configs['flavor_name']
22
+
23
+ FLAVOR_REF_RESIZE=configs['flavor_ref_resize']
24
+ FLAVOR_NAME_RESIZE=configs['flavor_name_resize']
25
+
20
26
  OPENSTACK_COMPUTE_VERSION=configs['openstack_compute_version'] || '1.1.4'
21
27
 
22
28
  USERNAME=ENV['NOVA_USERNAME']
data/torpedo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{torpedo}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Prince"]
12
- s.date = %q{2011-10-28}
12
+ s.date = %q{2011-10-29}
13
13
  s.default_executable = %q{torpedo}
14
14
  s.description = %q{CLI to run functional smoke tests for OpenStack.}
15
15
  s.email = %q{dan.prince@rackspace.com}
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
+ "CHANGELOG",
23
24
  "Gemfile",
25
+ "Gemfile.lock",
24
26
  "LICENSE.txt",
25
27
  "README.md",
26
28
  "Rakefile",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torpedo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Prince
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-28 00:00:00 -04:00
18
+ date: 2011-10-29 00:00:00 -04:00
19
19
  default_executable: torpedo
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -91,6 +91,7 @@ extra_rdoc_files:
91
91
  - README.md
92
92
  files:
93
93
  - .document
94
+ - CHANGELOG
94
95
  - Gemfile
95
96
  - Gemfile.lock
96
97
  - LICENSE.txt