kitchen-rackspace 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.md +20 -4
- data/LICENSE.txt +1 -1
- data/README.md +13 -5
- data/data/images.json +17 -0
- data/kitchen-rackspace.gemspec +4 -1
- data/lib/kitchen/driver/rackspace.rb +50 -10
- data/lib/kitchen/driver/rackspace_version.rb +2 -2
- data/spec/kitchen/driver/rackspace_spec.rb +93 -40
- data/spec/spec_helper.rb +14 -1
- metadata +49 -26
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDExNDM2OTBiYWU2ZjU2NTg5NjAyODY3YWVkNTlkZThkYjFjMTZlZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDhiYjVjYjhmZWUwYjExZTM0MDYxZjczZWU5OWRjNWI2MjQ0ZDJjYg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTNlYmVmODNjNTE2ODc1YzdhZWE1Mzc1ZDU0YzljNzI3NWIyNGM5YTg4NDI1
|
10
|
+
YzdjYWI1YzI4MTRkZjQ5Mjk1ZDM1NGZiODAwODMwYjMzYjcxZDRhODk2ODRi
|
11
|
+
ZDBlMjkxMDAxNDdkYTI2MWIzYmJmMmFhYTJlODJhZWNjNWIzZjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDc5YTMzNGUyNDg4YTQyZWUyMjBlOGE3MmQxOTM1NWUzZTE1NDI2ZjZiNmFh
|
14
|
+
MWRhYmFkMzA5YjE5ZGIwMWJhZGIxOGU5YWI2MDUxOWE0MTg4ZTdiZDM5YzQ1
|
15
|
+
MzQxZTRhZWFhODgwNDY5NTY0ZDcyMDA1NDcwOTRiYWZhOWI2YWQ=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# 0.4.0 / 2014-01-27
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* PR [#17][] - Support the common TK platform name style, e.g. `centos-6`,
|
6
|
+
via [@coderanger][]
|
7
|
+
* PR [#17][] - Support environment variables for username and API key, via
|
8
|
+
[@coderanger][]
|
9
|
+
|
10
|
+
### Improvements
|
11
|
+
|
12
|
+
* PR [#17][] - Change default flavor to lowest performance flavor for faster
|
13
|
+
boot times, via [@coderanger][]
|
14
|
+
|
1
15
|
# 0.3.0 / 2013-12-07
|
2
16
|
|
3
17
|
### Improvements
|
@@ -24,9 +38,11 @@
|
|
24
38
|
|
25
39
|
* Initial release! Woo!
|
26
40
|
|
27
|
-
[#
|
28
|
-
[#
|
29
|
-
[#
|
30
|
-
[#
|
41
|
+
[#17]: https://github.com/test-kitchen/kitchen-rackspace/pull/17
|
42
|
+
[#15]: https://github.com/test-kitchen/kitchen-rackspace/pull/15
|
43
|
+
[#9]: https://github.com/test-kitchen/kitchen-rackspace/pull/9
|
44
|
+
[#8]: https://github.com/test-kitchen/kitchen-rackspace/pull/8
|
45
|
+
[#7]: https://github.com/test-kitchen/kitchen-rackspace/pull/7
|
31
46
|
|
47
|
+
[@coderanger]: https://github.com/coderanger
|
32
48
|
[@claco]: https://github.com/claco
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/kitchen-rackspace.png)](http://badge.fury.io/rb/kitchen-rackspace)
|
2
|
-
[![Build Status](https://travis-ci.org/
|
3
|
-
[![Code Climate](https://codeclimate.com/github/
|
4
|
-
[![
|
2
|
+
[![Build Status](https://travis-ci.org/test-kitchen/kitchen-rackspace.png?branch=master)](https://travis-ci.org/test-kitchen/kitchen-rackspace)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/test-kitchen/kitchen-rackspace.png)](https://codeclimate.com/github/test-kitchen/kitchen-rackspace)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/test-kitchen/kitchen-rackspace/badge.png)](https://coveralls.io/r/test-kitchen/kitchen-rackspace)
|
5
|
+
[![Dependency Status](https://gemnasium.com/test-kitchen/kitchen-rackspace.png)](https://gemnasium.com/test-kitchen/kitchen-rackspace)
|
5
6
|
|
6
7
|
# Kitchen::Rackspace
|
7
8
|
|
@@ -33,9 +34,11 @@ Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
|
|
33
34
|
rackspace_username: [YOUR RACKSPACE CLOUD USERNAME]
|
34
35
|
rackspace_api_key: [YOUR RACKSPACE CLOUD API KEY]
|
35
36
|
require_chef_omnibus: latest (if you'll be using Chef)
|
37
|
+
platforms:
|
38
|
+
- name: [A PLATFORM NAME, e.g. 'centos-6']
|
36
39
|
|
37
|
-
By default, the driver will spawn a
|
38
|
-
|
40
|
+
By default, the driver will spawn a 1GB Performance server on the base image
|
41
|
+
for your specified platform. Additional, optional overrides can be provided:
|
39
42
|
|
40
43
|
image_id: [SERVER IMAGE ID]
|
41
44
|
flavor_id: [SERVER FLAVOR ID]
|
@@ -43,6 +46,11 @@ Rackspace region. Additional, optional settings can be provided:
|
|
43
46
|
public_key_path: [PATH TO YOUR PUBLIC SSH KEY]
|
44
47
|
rackspace_region: [A VALID RACKSPACE DC/REGION]
|
45
48
|
|
49
|
+
You also have the option of providing some configs via environment variables:
|
50
|
+
|
51
|
+
export RACKSPACE_USERNAME="user" # (or OS_USERNAME)
|
52
|
+
export RACKSPACE_API_KEY="api_key" # (or OS_PASSWORD)
|
53
|
+
|
46
54
|
## Contributing
|
47
55
|
|
48
56
|
1. Fork it
|
data/data/images.json
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"ubuntu-10.04": "aab63bcf-89aa-440f-b0c7-c7a1c611914b",
|
3
|
+
"ubuntu-12.04": "80fbcb55-b206-41f9-9bc2-2dd7aac6c061",
|
4
|
+
"ubuntu-13.04": "4b54f5a0-137f-4751-8e7c-fe707185e531",
|
5
|
+
"ubuntu-13.10": "df27d481-63a5-40ca-8920-3d132ed643d9",
|
6
|
+
"centos-5.9": "59c037c1-70ec-41e4-aa17-73a9b0cb6b16",
|
7
|
+
"centos-5.10": "9522c27d-51d9-44ee-8eb3-fb7b14fd4042",
|
8
|
+
"centos-5": "9522c27d-51d9-44ee-8eb3-fb7b14fd4042",
|
9
|
+
"centos-6.4": "f70ed7c7-b42e-4d77-83d8-40fa29825b85",
|
10
|
+
"centos-6": "f70ed7c7-b42e-4d77-83d8-40fa29825b85",
|
11
|
+
"debian-6": "695ca76e-fc0d-4e36-82e0-8ed66480a999",
|
12
|
+
"debian-7": "857d7d36-34f3-409f-8435-693e8797be8b",
|
13
|
+
"fedora-18": "896caae3-82f1-4b03-beaa-75fbdde27969",
|
14
|
+
"fedora-19": "8500226f-b193-4471-9eff-9cba8440bfc8",
|
15
|
+
"gentoo": "73764eb8-3c1c-42a9-8fff-71f6beefc6a7",
|
16
|
+
"freebsd-9.2": "fb624ffd-81c2-4217-8cd5-da32d32e85c4"
|
17
|
+
}
|
data/kitchen-rackspace.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['j@p4nt5.com']
|
11
11
|
spec.description = %q{A Test Kitchen Rackspace driver}
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/test-kitchen/kitchen-rackspace'
|
14
14
|
spec.license = 'Apache'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -29,6 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'cane'
|
30
30
|
spec.add_development_dependency 'countloc'
|
31
31
|
spec.add_development_dependency 'rspec'
|
32
|
+
spec.add_development_dependency 'simplecov'
|
33
|
+
spec.add_development_dependency 'simplecov-console'
|
34
|
+
spec.add_development_dependency 'coveralls'
|
32
35
|
end
|
33
36
|
|
34
37
|
# vim: ai et ts=2 sts=2 sw=2 ft=ruby
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
4
|
#
|
5
|
-
# Copyright (C) 2013, Jonathan Hartman
|
5
|
+
# Copyright (C) 2013-2014, Jonathan Hartman
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
@@ -29,16 +29,42 @@ module Kitchen
|
|
29
29
|
# @author Jonathan Hartman <j@p4nt5.com>
|
30
30
|
class Rackspace < Kitchen::Driver::SSHBase
|
31
31
|
default_config :version, 'v2'
|
32
|
-
default_config :
|
33
|
-
default_config :flavor_id, '2'
|
34
|
-
default_config :server_name, nil
|
35
|
-
default_config :public_key_path, File.expand_path('~/.ssh/id_dsa.pub')
|
32
|
+
default_config :flavor_id, 'performance1-1'
|
36
33
|
default_config :username, 'root'
|
37
34
|
default_config :port, '22'
|
38
35
|
default_config :rackspace_region, nil
|
39
36
|
|
37
|
+
default_config :image_id do |driver|
|
38
|
+
driver.default_image
|
39
|
+
end
|
40
|
+
|
41
|
+
default_config :server_name do |driver|
|
42
|
+
driver.default_name
|
43
|
+
end
|
44
|
+
|
45
|
+
default_config :public_key_path do |driver|
|
46
|
+
[
|
47
|
+
File.expand_path('~/.ssh/id_rsa.pub'),
|
48
|
+
File.expand_path('~/.ssh/id_dsa.pub'),
|
49
|
+
File.expand_path('~/.ssh/identity.pub'),
|
50
|
+
File.expand_path('~/.ssh/id_ecdsa.pub'),
|
51
|
+
].find { |path| File.exists?(path) }
|
52
|
+
end
|
53
|
+
|
54
|
+
default_config :rackspace_username do |driver|
|
55
|
+
ENV['RACKSPACE_USERNAME'] || ENV['OS_USERNAME']
|
56
|
+
end
|
57
|
+
|
58
|
+
default_config :rackspace_api_key do |driver|
|
59
|
+
ENV['RACKSPACE_API_KEY'] || ENV['OS_PASSWORD']
|
60
|
+
end
|
61
|
+
|
62
|
+
required_config :rackspace_username
|
63
|
+
required_config :rackspace_api_key
|
64
|
+
required_config :image_id
|
65
|
+
required_config :public_key_path
|
66
|
+
|
40
67
|
def create(state)
|
41
|
-
config[:server_name] ||= generate_name(instance.name)
|
42
68
|
server = create_server
|
43
69
|
state[:server_id] = server.id
|
44
70
|
info("Rackspace instance <#{state[:server_id]}> created.")
|
@@ -59,6 +85,16 @@ module Kitchen
|
|
59
85
|
state.delete(:hostname)
|
60
86
|
end
|
61
87
|
|
88
|
+
def default_image
|
89
|
+
images[instance.platform.name]
|
90
|
+
end
|
91
|
+
|
92
|
+
def default_name
|
93
|
+
# Generate what should be a unique server name
|
94
|
+
rand_str = Array.new(8) { rand(36).to_s(36) }.join
|
95
|
+
"#{instance.name}-#{Etc.getlogin}-#{Socket.gethostname}-#{rand_str}"
|
96
|
+
end
|
97
|
+
|
62
98
|
private
|
63
99
|
|
64
100
|
def compute
|
@@ -83,10 +119,14 @@ module Kitchen
|
|
83
119
|
)
|
84
120
|
end
|
85
121
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
122
|
+
def images
|
123
|
+
@images ||= begin
|
124
|
+
json_file = File.expand_path(
|
125
|
+
File.join(%w{.. .. .. .. data images.json}),
|
126
|
+
__FILE__
|
127
|
+
)
|
128
|
+
JSON.load(IO.read(json_file))
|
129
|
+
end
|
90
130
|
end
|
91
131
|
end
|
92
132
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
4
|
#
|
5
|
-
# Copyright (C) 2013, Jonathan Hartman
|
5
|
+
# Copyright (C) 2013-2014, Jonathan Hartman
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
@@ -19,7 +19,7 @@
|
|
19
19
|
module Kitchen
|
20
20
|
module Driver
|
21
21
|
# Version string for Rackspace Kitchen driver
|
22
|
-
RACKSPACE_VERSION = '0.
|
22
|
+
RACKSPACE_VERSION = '0.4.0'
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
4
|
#
|
5
|
-
# Copyright (C) 2013, Jonathan Hartman
|
5
|
+
# Copyright (C) 2013-2014, Jonathan Hartman
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
@@ -16,20 +16,27 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
+
require_relative '../../spec_helper'
|
20
|
+
|
19
21
|
require 'logger'
|
20
22
|
require 'stringio'
|
21
23
|
require 'rspec'
|
22
24
|
require 'kitchen'
|
23
|
-
require_relative '../../spec_helper'
|
24
25
|
|
25
26
|
describe Kitchen::Driver::Rackspace do
|
26
27
|
let(:logged_output) { StringIO.new }
|
27
28
|
let(:logger) { Logger.new(logged_output) }
|
28
29
|
let(:config) { Hash.new }
|
29
30
|
let(:state) { Hash.new }
|
31
|
+
let(:platform_name) { 'ubuntu' }
|
30
32
|
|
31
33
|
let(:instance) do
|
32
|
-
|
34
|
+
double(
|
35
|
+
:name => 'potatoes',
|
36
|
+
:logger => logger,
|
37
|
+
:to_str => 'instance',
|
38
|
+
:platform => double(:name => platform_name)
|
39
|
+
)
|
33
40
|
end
|
34
41
|
|
35
42
|
let(:driver) do
|
@@ -38,23 +45,25 @@ describe Kitchen::Driver::Rackspace do
|
|
38
45
|
d
|
39
46
|
end
|
40
47
|
|
48
|
+
before(:each) do
|
49
|
+
ENV['RACKSPACE_USERNAME'] = 'user'
|
50
|
+
ENV['RACKSPACE_API_KEY'] = 'key'
|
51
|
+
end
|
52
|
+
|
41
53
|
describe '#initialize'do
|
42
54
|
context 'default options' do
|
43
55
|
it 'defaults to v2 cloud' do
|
44
56
|
expect(driver[:version]).to eq('v2')
|
45
57
|
end
|
46
58
|
|
47
|
-
it 'defaults to a Ubuntu 12.10 image ID' do
|
48
|
-
expect(driver[:image_id]).to eq('d45ed9c5-d6fc-4c9d-89ea-1b3ae1c83999')
|
49
|
-
end
|
50
|
-
|
51
59
|
it 'defaults to the smallest flavor size' do
|
52
|
-
expect(driver[:flavor_id]).to eq('
|
60
|
+
expect(driver[:flavor_id]).to eq('performance1-1')
|
53
61
|
end
|
54
62
|
|
55
|
-
it
|
56
|
-
|
57
|
-
|
63
|
+
it "defaults to local user's SSH public key" do
|
64
|
+
path = File.expand_path('~/.ssh/id_rsa.pub')
|
65
|
+
expect(File).to receive(:exists?).with(path).and_return(true)
|
66
|
+
expect(driver[:public_key_path]).to eq(path)
|
58
67
|
end
|
59
68
|
|
60
69
|
it 'defaults to SSH with root user on port 22' do
|
@@ -62,46 +71,86 @@ describe Kitchen::Driver::Rackspace do
|
|
62
71
|
expect(driver[:port]).to eq('22')
|
63
72
|
end
|
64
73
|
|
65
|
-
it 'defaults to
|
66
|
-
expect(driver[:server_name]).to
|
74
|
+
it 'defaults to a random server name' do
|
75
|
+
expect(driver[:server_name]).to be_a(String)
|
67
76
|
end
|
68
77
|
|
69
78
|
it 'defaults to no region' do
|
70
79
|
expect(driver[:rackspace_region]).to eq(nil)
|
71
80
|
end
|
81
|
+
|
82
|
+
it 'defaults to username from $RACKSPACE_USERNAME' do
|
83
|
+
expect(driver[:rackspace_username]).to eq('user')
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'defaults to API key from $RACKSPACE_API_KEY' do
|
87
|
+
expect(driver[:rackspace_api_key]).to eq('key')
|
88
|
+
end
|
72
89
|
end
|
73
90
|
|
74
|
-
context '
|
75
|
-
let(:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
:public_key_path => '/tmp',
|
80
|
-
:username => 'admin',
|
81
|
-
:port => '2222',
|
82
|
-
:server_name => 'puppy',
|
83
|
-
:rackspace_region => 'ord'
|
84
|
-
}
|
91
|
+
context 'name is ubuntu-12.04' do
|
92
|
+
let(:platform_name) { 'ubuntu-12.04' }
|
93
|
+
|
94
|
+
it 'defaults to the correct image ID' do
|
95
|
+
expect(driver[:image_id]).to eq('80fbcb55-b206-41f9-9bc2-2dd7aac6c061')
|
85
96
|
end
|
97
|
+
end
|
86
98
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
99
|
+
context 'name is centos-6.4' do
|
100
|
+
let(:platform_name) { 'centos-6.4' }
|
101
|
+
|
102
|
+
it 'defaults to the correct image ID' do
|
103
|
+
expect(driver[:image_id]).to eq('f70ed7c7-b42e-4d77-83d8-40fa29825b85')
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'overridden options' do
|
108
|
+
config = {
|
109
|
+
:image_id => '22',
|
110
|
+
:flavor_id => '33',
|
111
|
+
:public_key_path => '/tmp',
|
112
|
+
:username => 'admin',
|
113
|
+
:port => '2222',
|
114
|
+
:server_name => 'puppy',
|
115
|
+
:rackspace_region => 'ord'
|
116
|
+
}
|
117
|
+
|
118
|
+
let(:config) { config }
|
119
|
+
|
120
|
+
config.each do |key, value|
|
121
|
+
it "it uses the overridden #{key} option" do
|
122
|
+
expect(driver[key]).to eq(value)
|
91
123
|
end
|
92
124
|
end
|
93
125
|
end
|
126
|
+
|
127
|
+
context 'OpenStack environment variables' do
|
128
|
+
before(:each) do
|
129
|
+
ENV.delete('RACKSPACE_USERNAME')
|
130
|
+
ENV.delete('RACKSPACE_API_KEY')
|
131
|
+
ENV['OS_USERNAME'] = 'os_user'
|
132
|
+
ENV['OS_PASSWORD'] = 'os_pass'
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'gets to username from $OS_USERNAME' do
|
136
|
+
expect(driver[:rackspace_username]).to eq('os_user')
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'gets to API key from $OS_PASSWORD' do
|
140
|
+
expect(driver[:rackspace_api_key]).to eq('os_pass')
|
141
|
+
end
|
142
|
+
end
|
94
143
|
end
|
95
144
|
|
96
145
|
describe '#create' do
|
97
146
|
let(:server) do
|
98
|
-
|
147
|
+
double(:id => 'test123', :wait_for => true,
|
99
148
|
:public_ip_address => '1.2.3.4')
|
100
149
|
end
|
101
150
|
let(:driver) do
|
102
151
|
d = Kitchen::Driver::Rackspace.new(config)
|
103
152
|
d.instance = instance
|
104
|
-
d.stub(:
|
153
|
+
d.stub(:default_name).and_return('a_monkey!')
|
105
154
|
d.stub(:create_server).and_return(server)
|
106
155
|
d.stub(:wait_for_sshd).with('1.2.3.4').and_return(true)
|
107
156
|
d
|
@@ -136,9 +185,9 @@ describe Kitchen::Driver::Rackspace do
|
|
136
185
|
let(:server_id) { '12345' }
|
137
186
|
let(:hostname) { 'example.com' }
|
138
187
|
let(:state) { { :server_id => server_id, :hostname => hostname } }
|
139
|
-
let(:server) {
|
140
|
-
let(:servers) {
|
141
|
-
let(:compute) {
|
188
|
+
let(:server) { double(:nil? => false, :destroy => true) }
|
189
|
+
let(:servers) { double(:get => server) }
|
190
|
+
let(:compute) { double(:servers => servers) }
|
142
191
|
|
143
192
|
let(:driver) do
|
144
193
|
d = Kitchen::Driver::Rackspace.new(config)
|
@@ -172,7 +221,7 @@ describe Kitchen::Driver::Rackspace do
|
|
172
221
|
s.stub(:get).with('12345').and_return(nil)
|
173
222
|
s
|
174
223
|
end
|
175
|
-
let(:compute) {
|
224
|
+
let(:compute) { double(:servers => servers) }
|
176
225
|
let(:driver) do
|
177
226
|
d = Kitchen::Driver::Rackspace.new(config)
|
178
227
|
d.instance = instance
|
@@ -205,7 +254,9 @@ describe Kitchen::Driver::Rackspace do
|
|
205
254
|
end
|
206
255
|
|
207
256
|
context 'no username provided' do
|
208
|
-
let(:config)
|
257
|
+
let(:config) do
|
258
|
+
{ :rackspace_username => nil, :rackspace_api_key => '1234' }
|
259
|
+
end
|
209
260
|
|
210
261
|
it 'raises an error' do
|
211
262
|
expect { driver.send(:compute) }.to raise_error(ArgumentError)
|
@@ -213,7 +264,9 @@ describe Kitchen::Driver::Rackspace do
|
|
213
264
|
end
|
214
265
|
|
215
266
|
context 'no API key provided' do
|
216
|
-
let(:config)
|
267
|
+
let(:config) do
|
268
|
+
{ :rackspace_username => 'monkey', :rackspace_api_key => nil }
|
269
|
+
end
|
217
270
|
|
218
271
|
it 'raises an error' do
|
219
272
|
expect { driver.send(:compute) }.to raise_error(ArgumentError)
|
@@ -241,7 +294,7 @@ describe Kitchen::Driver::Rackspace do
|
|
241
294
|
s.stub(:bootstrap) { |arg| arg }
|
242
295
|
s
|
243
296
|
end
|
244
|
-
let(:compute) {
|
297
|
+
let(:compute) { double(:servers => servers) }
|
245
298
|
let(:driver) do
|
246
299
|
d = Kitchen::Driver::Rackspace.new(config)
|
247
300
|
d.instance = instance
|
@@ -254,15 +307,15 @@ describe Kitchen::Driver::Rackspace do
|
|
254
307
|
end
|
255
308
|
end
|
256
309
|
|
257
|
-
describe '#
|
310
|
+
describe '#default_name' do
|
258
311
|
before(:each) do
|
259
312
|
Etc.stub(:getlogin).and_return('user')
|
260
313
|
Socket.stub(:gethostname).and_return('host')
|
261
314
|
end
|
262
315
|
|
263
316
|
it 'generates a name' do
|
264
|
-
expect(driver.
|
265
|
-
/^
|
317
|
+
expect(driver.default_name).to match(
|
318
|
+
/^potatoes-user-host-/)
|
266
319
|
end
|
267
320
|
end
|
268
321
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
4
|
#
|
5
|
-
# Copyright (C) 2013, Jonathan Hartman
|
5
|
+
# Copyright (C) 2013-2014, Jonathan Hartman
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
@@ -15,8 +15,21 @@
|
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
|
+
#
|
18
19
|
|
19
20
|
require 'rspec'
|
21
|
+
require 'simplecov'
|
22
|
+
require 'simplecov-console'
|
23
|
+
require 'coveralls'
|
24
|
+
|
25
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
26
|
+
Coveralls::SimpleCov::Formatter,
|
27
|
+
SimpleCov::Formatter::HTMLFormatter,
|
28
|
+
SimpleCov::Formatter::Console
|
29
|
+
]
|
30
|
+
SimpleCov.minimum_coverage 90
|
31
|
+
SimpleCov.start
|
32
|
+
|
20
33
|
require_relative '../lib/kitchen/driver/rackspace'
|
21
34
|
|
22
35
|
# vim: ai et ts=2 sts=2 sw=2 ft=ruby
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jonathan Hartman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: test-kitchen
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: fog
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: unf
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: bundler
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: tailor
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ! '>='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ! '>='
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: cane
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: countloc
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ! '>='
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -142,7 +125,6 @@ dependencies:
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: rspec
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - ! '>='
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,48 @@ dependencies:
|
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov-console
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: coveralls
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
177
|
requirements:
|
155
178
|
- - ! '>='
|
156
179
|
- !ruby/object:Gem::Version
|
@@ -169,35 +192,35 @@ files:
|
|
169
192
|
- LICENSE.txt
|
170
193
|
- README.md
|
171
194
|
- Rakefile
|
195
|
+
- data/images.json
|
172
196
|
- kitchen-rackspace.gemspec
|
173
197
|
- lib/kitchen/driver/rackspace.rb
|
174
198
|
- lib/kitchen/driver/rackspace_version.rb
|
175
199
|
- spec/kitchen/driver/rackspace_spec.rb
|
176
200
|
- spec/spec_helper.rb
|
177
|
-
homepage: https://github.com/
|
201
|
+
homepage: https://github.com/test-kitchen/kitchen-rackspace
|
178
202
|
licenses:
|
179
203
|
- Apache
|
204
|
+
metadata: {}
|
180
205
|
post_install_message:
|
181
206
|
rdoc_options: []
|
182
207
|
require_paths:
|
183
208
|
- lib
|
184
209
|
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
210
|
requirements:
|
187
211
|
- - ! '>='
|
188
212
|
- !ruby/object:Gem::Version
|
189
213
|
version: '0'
|
190
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
215
|
requirements:
|
193
216
|
- - ! '>='
|
194
217
|
- !ruby/object:Gem::Version
|
195
218
|
version: '0'
|
196
219
|
requirements: []
|
197
220
|
rubyforge_project:
|
198
|
-
rubygems_version:
|
221
|
+
rubygems_version: 2.2.1
|
199
222
|
signing_key:
|
200
|
-
specification_version:
|
223
|
+
specification_version: 4
|
201
224
|
summary: A Test Kitchen Rackspace driver
|
202
225
|
test_files:
|
203
226
|
- spec/kitchen/driver/rackspace_spec.rb
|