torpedo 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ * Mon Apr 9 2012 Dan Prince <dprince@redhat.com> - 1.0.17
2
+ -Adding SLEEP_AFTER_IMAGE_CREATE env option.
3
+ -Added 'test_limits' option.
4
+ -Added 'test_ip_type' Set to '4' (for IPv4) or '6' (for IPv6).
5
+
1
6
  * Mon Apr 2 2012 Dan Prince <dprince@redhat.com> - 1.0.16
2
7
  -Add NOVA_SERVICE_NAME env setting (defaults is nil)
3
8
  -Add NOVA_SERVICE_TYPE env setting (default is 'compute')
data/README.md CHANGED
@@ -108,4 +108,4 @@ Payload
108
108
 
109
109
  License
110
110
  -------
111
- Copyright (c) 2011 Dan Prince. See LICENSE.txt for further details.
111
+ Copyright (c) 2011-2012 Dan Prince. See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.16
1
+ 1.0.17
data/bin/torpedo CHANGED
@@ -5,6 +5,7 @@ require "thor"
5
5
 
6
6
  # uncomment this for local testing
7
7
  #$:.unshift File.dirname(__FILE__) + "/../lib"
8
+ STDOUT.sync = true
8
9
 
9
10
  require "torpedo"
10
11
 
data/lib/torpedo.rb CHANGED
@@ -8,6 +8,7 @@ TEST_SSH=configs.fetch('test_ssh', true)
8
8
  PING_TIMEOUT=(configs['ping_timeout'] || 60).to_i
9
9
  TEST_PING=configs.fetch('test_ping', true)
10
10
  SERVER_BUILD_TIMEOUT=(configs['server_build_timeout'] || 60).to_i
11
+ SLEEP_AFTER_IMAGE_CREATE=(configs['sleep_after_image_create'] || 0).to_i
11
12
  SSH_PRIVATE_KEY=configs['ssh_private_key'] || ENV['HOME'] + "/.ssh/id_rsa"
12
13
  SSH_PUBLIC_KEY=configs['ssh_public_key'] || ENV['HOME'] + "/.ssh/id_rsa.pub"
13
14
  TEST_CREATE_IMAGE=configs['test_create_image'] || false
@@ -18,6 +19,8 @@ TEST_RESIZE_SERVER=configs['test_resize_server'] || false
18
19
  TEST_REVERT_RESIZE_SERVER=configs['test_revert_resize_server'] || false
19
20
  TEST_ADMIN_PASSWORD=configs['test_admin_password'] || false
20
21
  TEST_HOSTID_ON_RESIZE=configs['test_hostid_on_resize'] || false
22
+ TEST_IP_TYPE=configs['test_ip_type'] || 4
23
+ TEST_LIMITS=configs.fetch('test_limits', true)
21
24
  CLEAN_UP_SERVERS=configs.fetch('clean_up_servers', true)
22
25
  CLEAN_UP_IMAGES=configs.fetch('clean_up_images', true)
23
26
  KEYPAIR=configs['keypair']
@@ -14,6 +14,6 @@ class Limits < Test::Unit::TestCase
14
14
 
15
15
  end
16
16
 
17
- end
17
+ end if TEST_LIMITS
18
18
  end
19
19
  end
@@ -81,17 +81,15 @@ class Servers < Test::Unit::TestCase
81
81
 
82
82
  def ping_test(ip_addr)
83
83
  begin
84
+ ping = TEST_IP_TYPE == 6 ? 'ping6' : 'ping'
85
+ ping_command = "#{ping} -c 1 #{ip_addr} > /dev/null 2>&1"
84
86
  Timeout::timeout(PING_TIMEOUT) do
85
-
86
87
  while(1) do
87
- if system("ping -c 1 #{ip_addr} > /dev/null 2>&1") then
88
- return true
89
- end
88
+ return true if system(ping_command)
90
89
  end
91
-
92
90
  end
93
91
  rescue Timeout::Error => te
94
- fail("Timeout pinging server: #{ip_addr}")
92
+ fail("Timeout pinging server: #{ping_command}")
95
93
  end
96
94
 
97
95
  return false
@@ -120,14 +118,15 @@ class Servers < Test::Unit::TestCase
120
118
  fail('Timeout creating server.')
121
119
  end
122
120
 
123
- # lookup the first IPv4 address and use that for verification
124
- v4_addresses = server.addresses[:public].reject {|addr| addr.version != 4}
125
- ping_test(v4_addresses[0].address) if TEST_PING
121
+ # lookup the first public IP address and use that for verification
122
+ addresses = server.addresses[:public].select {|a| a.version == TEST_IP_TYPE}
123
+ address = addresses[0].address
124
+ ping_test(address) if TEST_PING
126
125
  if TEST_SSH
127
126
  if TEST_ADMIN_PASSWORD
128
- ssh_test(v4_addresses[0].address, "cat /tmp/foo/bar", "yo")
127
+ ssh_test(address, "cat /tmp/foo/bar", "yo")
129
128
  else
130
- ssh_test(v4_addresses[0].address)
129
+ ssh_test(address)
131
130
  end
132
131
  end
133
132
 
@@ -250,9 +249,9 @@ class Servers < Test::Unit::TestCase
250
249
  def test_020_create_image
251
250
 
252
251
  #snapshot the image
253
- image = create_image(@@server, :name => "My Backup", :metadata => {"key1" => "value1"})
252
+ image = create_image(@@server, :name => "torpedo", :metadata => {"key1" => "value1"})
254
253
  assert_equal('SAVING', image.status)
255
- assert_equal('My Backup', image.name)
254
+ assert_equal('torpedo', image.name)
256
255
  assert_equal(25, image.progress)
257
256
  #FIXME: server id should be a uuid string
258
257
  assert_equal(@@server.id.to_s, image.server['id'])
@@ -271,6 +270,8 @@ class Servers < Test::Unit::TestCase
271
270
  fail('Timeout creating image snapshot.')
272
271
  end
273
272
 
273
+ sleep SLEEP_AFTER_IMAGE_CREATE
274
+
274
275
  # Overwrite image_ref to make all subsequent tests use this snapshot
275
276
  @@image_ref = image.id.to_s
276
277
 
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: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 16
10
- version: 1.0.16
9
+ - 17
10
+ version: 1.0.17
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: 2012-04-02 00:00:00 Z
18
+ date: 2012-04-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement