kitchen-digitalocean 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6eb20cf0d8fe3a7dc9703c0427fed7909b041901
4
+ data.tar.gz: 1825d40a5d2e7a8bee48095ac88d170c24f497be
5
+ SHA512:
6
+ metadata.gz: 19df48d3f8c0784094a7914fc3fff0cebfea4f242fe7145cfcd395525c07edd206f919af153abbb10de58fc837bba9544c85a3f75f75813aa9ff7c90a57ebc5a
7
+ data.tar.gz: 0ac0dad03250e2d8792e5943ae2b83f91d100c7f8f12160e328098d6862edfa92490a41d9c092d39d46541a9e7d8a3a466cbcd1f8e90342234da87c0263b89f0
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .kitchen
19
+ *.sw?
20
+ *~
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ gemfile:
4
+ - Gemfile
5
+
6
+ rvm:
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - 2.0.0
10
+
11
+ # vim: ai et ts=2 sts=2 sw=2 ft=yaml
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.1.0 / 2013-05-12
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kitchen-digitalocean.gemspec
4
+ gemspec
5
+
6
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
data/LICENSE.txt ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Greg Fitzgerald (<greg@gregf.org>)
2
+
3
+ Copyright (c) 2013 Greg Fitzgerald
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,110 @@
1
+ [![Build Status](https://travis-ci.org/gregf/kitchen-digitalocean.png?branch=master)](https://travis-ci.org/gregf/kitchen-digitalocean) [![Code Climate](https://codeclimate.com/github/gregf/kitchen-digitalocean.png)](https://codeclimate.com/github/gregf/kitchen-digitalocean) [![Dependency Status](https://gemnasium.com/gregf/kitchen-digitalocean.png)](https://gemnasium.com/gregf/kitchen-digitalocean)
2
+
3
+ # Kitchen::Digitalocean
4
+
5
+ A Digital Ocean driver for Test Kitchen 1.0!
6
+
7
+ Shamelessly copied from [RoboticCheese](https://github.com/RoboticCheese)'s
8
+ awesome work on an [Rackspace driver](https://github.com/RoboticCheese/kitchen-rackspace).
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'kitchen-digitalocean'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install kitchen-digitalocean
23
+
24
+ ## Usage
25
+
26
+ Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
27
+
28
+ driver_plugin: digitalocean
29
+ driver_config:
30
+ digitalocean_client_id: [YOUR DIGITAL OCEAN CLIENT ID]
31
+ digitalocean_api_key: [YOUR DIGITAL OCEAN API KEY]
32
+ require_chef_omnibus: latest (if you'll be using Chef)
33
+
34
+ By default, the driver will spawn a 512MB Ubuntu 12.10 instance in the New York
35
+ Digital Ocean . Additional, optional settings can be provided:
36
+
37
+ image_id: [SERVER IMAGE ID]
38
+ flavor_id: [SERVER FLAVOR ID]
39
+ name: [A UNIQUE SERVER NAME]
40
+ region_id: [A VALID DIGITAL OCEAN REGION ID]
41
+ ssh_key_ids: [SSH KEY ID FROM DIGITAL OCEAN]
42
+
43
+ ### List of Regions
44
+
45
+ ```shell
46
+ ID Name
47
+ 1 New York 1
48
+ 2 Amsterdam 1
49
+ 3 San Francisco 1
50
+ ```
51
+
52
+ ### List of Flavors
53
+ ```shell
54
+ ID Distribution Name Global
55
+ 249545 Arch Linux Arch Linux 2013.03 x32 +
56
+ 249546 Arch Linux Arch Linux 2013.03 x64 +
57
+ 1602 CentOS CentOS 5.8 x32 +
58
+ 1601 CentOS CentOS 5.8 x64 +
59
+ 1605 CentOS CentOS 6.0 x32 +
60
+ 1611 CentOS CentOS 6.2 x64 +
61
+ 12578 CentOS CentOS 6.3 x32 +
62
+ 12574 CentOS CentOS 6.3 x64 +
63
+ 196798 CentOS Centos 6.4 x32 Server +
64
+ 197088 CentOS Centos 6.4 x64 Server +
65
+ 12575 Debian Debian 6.0 x32 +
66
+ 12573 Debian Debian 6.0 x64 +
67
+ 1606 Fedora Fedora 15 x64 +
68
+ 1618 Fedora Fedora 16 x64 Desktop +
69
+ 1615 Fedora Fedora 16 x64 Server +
70
+ 32399 Fedora Fedora 17 x32 Desktop +
71
+ 32387 Fedora Fedora 17 x32 Server +
72
+ 32419 Fedora Fedora 17 x64 Desktop +
73
+ 32428 Fedora Fedora 17 x64 Server +
74
+ 46964 Ubuntu LAMP on Ubuntu 12.04 +
75
+ 14098 Ubuntu Ubuntu 10.04 x32 Server +
76
+ 14097 Ubuntu Ubuntu 10.04 x64 Server +
77
+ 43462 Ubuntu Ubuntu 11.04x32 Desktop +
78
+ 43458 Ubuntu Ubuntu 11.04x64 Server +
79
+ 1609 Ubuntu Ubuntu 11.10 x32 Server +
80
+ 42735 Ubuntu Ubuntu 12.04 x32 Server +
81
+ 14218 Ubuntu Ubuntu 12.04 x64 Desktop +
82
+ 2676 Ubuntu Ubuntu 12.04 x64 Server +
83
+ 25485 Ubuntu Ubuntu 12.10 x32 Desktop +
84
+ 25306 Ubuntu Ubuntu 12.10 x32 Server +
85
+ 25493 Ubuntu Ubuntu 12.10 x64 Desktop +
86
+ 25489 Ubuntu Ubuntu 12.10 x64 Server +
87
+ ```
88
+
89
+ ### List of Sizes
90
+ ```shell
91
+ ID Name
92
+ 63 1GB
93
+ 62 2GB
94
+ 64 4GB
95
+ 65 8GB
96
+ 61 16GB
97
+ 60 32GB
98
+ 70 48GB
99
+ 69 64GB
100
+ 68 96GB
101
+ 66 512MB
102
+ ```
103
+
104
+ ## Contributing
105
+
106
+ 1. Fork it
107
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
108
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
109
+ 4. Push to the branch (`git push origin my-new-feature`)
110
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'tailor/rake_task'
3
+ require 'cane/rake_task'
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc 'Run Cane to check quality metrics'
7
+ Cane::RakeTask.new
8
+
9
+ desc 'Run Tailor to lint check code'
10
+ Tailor::RakeTask.new do |task|
11
+ task.file_set '**/**/*.rb'
12
+ end
13
+
14
+ desc 'Display LOC stats'
15
+ task :loc do
16
+ puts "\n## LOC Stats"
17
+ sh 'countloc -r lib/kitchen'
18
+ end
19
+
20
+ desc 'Run RSpec unit tests'
21
+ RSpec::Core::RakeTask.new(:spec)
22
+
23
+ task :default => [ :cane, :tailor, :loc, :spec ]
24
+
25
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby fdm=marker
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/digitalocean_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-digitalocean'
8
+ spec.version = Kitchen::Driver::DIGITALOCEAN_VERSION
9
+ spec.authors = ['Greg Fitzgerald']
10
+ spec.email = ['greg@gregf.org']
11
+ spec.description = %q{A Test Kitchen Digital Ocean driver}
12
+ spec.summary = spec.description
13
+ spec.homepage = 'https://github.com/gregf/kitchen-digitalocean'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'test-kitchen', '~> 1.0.0.alpha'
22
+ spec.add_dependency 'fog', '~> 1.11'
23
+
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'tailor'
27
+ spec.add_development_dependency 'cane'
28
+ spec.add_development_dependency 'countloc'
29
+ spec.add_development_dependency 'rspec'
30
+ end
31
+
32
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
@@ -0,0 +1,92 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Greg Fitzgerald (<greg@gregf.org>)
4
+ #
5
+ # Copyright (C) 2013, Greg Fitzgerald
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'benchmark'
20
+ require 'fog'
21
+ require 'kitchen'
22
+ require 'etc'
23
+ require 'socket'
24
+
25
+ module Kitchen
26
+ module Driver
27
+ # Digital Ocean driver for Kitchen.
28
+ #
29
+ # @author Greg Fitzgerald <greg@gregf.org>
30
+ class Digitalocean < Kitchen::Driver::SSHBase
31
+ default_config :image_id, '25489'
32
+ default_config :flavor_id, '66'
33
+ default_config :name, nil
34
+ default_config :ssh_key_ids, nil
35
+ default_config :region_id, 1
36
+ default_config :username, 'root'
37
+ default_config :port, '22'
38
+ default_config :sudo, false
39
+
40
+ def create(state)
41
+ config[:name] ||= generate_name(instance.name)
42
+ server = create_server
43
+ state[:server_id] = server.id
44
+ info("Digital Ocean instance <#{state[:server_id]}> created.")
45
+ server.wait_for { ready? } ; puts "(server ready)"
46
+ state[:hostname] = server.ip_address
47
+ wait_for_sshd(state[:hostname]) ; puts "(ssh ready)"
48
+ rescue Fog::Errors::Error, Excon::Errors::Error => ex
49
+ raise ActionFailed, ex.message
50
+ end
51
+
52
+ def destroy(state)
53
+ return if state[:server_id].nil?
54
+
55
+ server = compute.servers.get(state[:server_id])
56
+ server.destroy unless server.nil?
57
+ info("Digital Ocean instance <#{state[:server_id]}> destroyed.")
58
+ state.delete(:server_id)
59
+ state.delete(:hostname)
60
+ end
61
+
62
+ private
63
+
64
+ def compute
65
+ server_def = {
66
+ :provider => "Digitalocean",
67
+ :digitalocean_api_key => config[:digitalocean_api_key],
68
+ :digitalocean_client_id => config[:digitalocean_client_id]
69
+ }
70
+ Fog::Compute.new(server_def)
71
+ end
72
+
73
+ def create_server
74
+ compute.servers.create(
75
+ :name => config[:name],
76
+ :image_id => config[:image_id],
77
+ :flavor_id => config[:flavor_id],
78
+ :region_id => config[:region_id],
79
+ :ssh_key_ids => config[:ssh_key_ids]
80
+ )
81
+ end
82
+
83
+ def generate_name(base)
84
+ # Generate what should be a unique server name
85
+ rand_str = Array.new(8) { rand(36).to_s(36) }.join
86
+ "#{base}-#{Etc.getlogin}-#{Socket.gethostname}-#{rand_str}"
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Greg Fitzgerald (<greg@gregf.org>)
4
+ #
5
+ # Copyright (C) 2013, Greg Fitzgerald
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Kitchen
20
+ module Driver
21
+ # Version string for Digital Ocean Kitchen driver
22
+ DIGITALOCEAN_VERSION = '0.1.0'
23
+ end
24
+ end
25
+
26
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
@@ -0,0 +1,270 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Greg Fitzgerald (<greg@gregf.org>)
4
+ #
5
+ # Copyright (C) 2013, Greg Fitzgerald
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'logger'
20
+ require 'stringio'
21
+ require 'rspec'
22
+ require 'kitchen'
23
+ require_relative '../../spec_helper'
24
+
25
+ describe Kitchen::Driver::Digitalocean do
26
+ let(:logged_output) { StringIO.new }
27
+ let(:logger) { Logger.new(logged_output) }
28
+ let(:config) { Hash.new }
29
+ let(:state) { Hash.new }
30
+
31
+ let(:instance) do
32
+ stub(:name => 'potatoes', :logger => logger, :to_str => 'instance')
33
+ end
34
+
35
+ let(:driver) do
36
+ d = Kitchen::Driver::Digitalocean.new(config)
37
+ d.instance = instance
38
+ d
39
+ end
40
+
41
+ describe '#initialize'do
42
+ context 'default options' do
43
+ it 'defaults to a Ubuntu 12.10 image ID' do
44
+ expect(driver[:image_id]).to eq('25489')
45
+ end
46
+
47
+ it 'defaults to a 512MB flavor size' do
48
+ expect(driver[:flavor_id]).to eq('66')
49
+ end
50
+
51
+ it 'defaults to no SSH Key ID' do
52
+ expect(driver[:ssh_key_ids]).to eq(nil)
53
+ end
54
+
55
+ it 'defaults to SSH with root user on port 22' do
56
+ expect(driver[:username]).to eq('root')
57
+ expect(driver[:port]).to eq('22')
58
+ end
59
+
60
+ it 'defaults to no server name' do
61
+ expect(driver[:name]).to eq(nil)
62
+ end
63
+
64
+ it 'defaults to New York region id' do
65
+ expect(driver[:region_id]).to eq(1)
66
+ end
67
+ end
68
+
69
+ context 'overridden options' do
70
+ let(:config) do
71
+ {
72
+ :image_id => '2676',
73
+ :flavor_id => '63',
74
+ :ssh_key_ids => '1234',
75
+ :username => 'admin',
76
+ :port => '2222',
77
+ :name => 'puppy',
78
+ :region_id => '3'
79
+ }
80
+ end
81
+
82
+ it 'uses all the overridden options' do
83
+ drv = driver
84
+ config.each do |k, v|
85
+ expect(drv[k]).to eq(v)
86
+ end
87
+ end
88
+ end
89
+ end
90
+
91
+ describe '#create' do
92
+ let(:server) do
93
+ stub(:id => 'test123', :wait_for => true,
94
+ :ip_address => '1.2.3.4')
95
+ end
96
+ let(:driver) do
97
+ d = Kitchen::Driver::Digitalocean.new(config)
98
+ d.instance = instance
99
+ d.stub(:generate_name).with('potatoes').and_return('a_monkey!')
100
+ d.stub(:create_server).and_return(server)
101
+ d.stub(:wait_for_sshd).with('1.2.3.4').and_return(true)
102
+ d
103
+ end
104
+
105
+ context 'Client ID API key, and Region ID only provided' do
106
+ let(:config) do
107
+ {
108
+ :digitalocean_client_id => 'Quei4zaey9nijiexoong',
109
+ :digitalocean_api_key => 'Eep4eidaiz7chohd4cheyei9peigooyoa9Ek4sua',
110
+ :region_id => '1'
111
+ }
112
+ end
113
+
114
+ it 'generates a server name in the absence of one' do
115
+ driver.create(state)
116
+ expect(driver[:name]).to eq('a_monkey!')
117
+ end
118
+
119
+ it 'gets a proper server ID' do
120
+ driver.create(state)
121
+ expect(state[:server_id]).to eq('test123')
122
+ end
123
+
124
+ it 'gets a proper hostname (IP)' do
125
+ driver.create(state)
126
+ expect(state[:hostname]).to eq('1.2.3.4')
127
+ end
128
+ end
129
+ end
130
+
131
+ describe '#destroy' do
132
+ let(:server_id) { '12345' }
133
+ let(:hostname) { 'example.com' }
134
+ let(:state) { { :server_id => server_id, :hostname => hostname } }
135
+ let(:server) { stub(:nil? => false, :destroy => true) }
136
+ let(:servers) { stub(:get => server) }
137
+ let(:compute) { stub(:servers => servers) }
138
+
139
+ let(:driver) do
140
+ d = Kitchen::Driver::Digitalocean.new(config)
141
+ d.instance = instance
142
+ d.stub(:compute).and_return(compute)
143
+ d
144
+ end
145
+
146
+ context 'a live server that needs to be destroyed' do
147
+ it 'destroys the server' do
148
+ state.should_receive(:delete).with(:server_id)
149
+ state.should_receive(:delete).with(:hostname)
150
+ driver.destroy(state)
151
+ end
152
+ end
153
+
154
+ context 'no server ID present' do
155
+ let(:state) { Hash.new }
156
+
157
+ it 'does nothing' do
158
+ driver.stub(:compute)
159
+ driver.should_not_receive(:compute)
160
+ state.should_not_receive(:delete)
161
+ driver.destroy(state)
162
+ end
163
+ end
164
+
165
+ context 'a server that was already destroyed' do
166
+ let(:servers) do
167
+ s = double('servers')
168
+ s.stub(:get).with('12345').and_return(nil)
169
+ s
170
+ end
171
+ let(:compute) { stub(:servers => servers) }
172
+ let(:driver) do
173
+ d = Kitchen::Driver::Digitalocean.new(config)
174
+ d.instance = instance
175
+ d.stub(:compute).and_return(compute)
176
+ d
177
+ end
178
+
179
+ it 'does not try to destroy the server again' do
180
+ allow_message_expectations_on_nil
181
+ driver.destroy(state)
182
+ end
183
+ end
184
+ end
185
+
186
+ describe '#compute' do
187
+ let(:config) do
188
+ {
189
+ :digitalocean_client_id => 'Aife3ahkii4oot9oowai',
190
+ :digitalocean_api_key => 'yahsh4aesh3oov9daiWach'
191
+ }
192
+ end
193
+
194
+ context 'all requirements provided' do
195
+ it 'creates a new compute connection' do
196
+ Fog::Compute.stub(:new) { |arg| arg }
197
+ res = config.merge({ :provider => 'Digitalocean' })
198
+ expect(driver.send(:compute)).to eq(res)
199
+ end
200
+ end
201
+
202
+ context 'no client id provided' do
203
+ let(:config) { { :digitalocean_api_key => 'yahsh4aesh3oov9daiWach' } }
204
+
205
+ it 'raises an error' do
206
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
207
+ end
208
+ end
209
+
210
+ context 'no API key provided' do
211
+ let(:config) { { :digitalocean_client_id => 'Aife3ahkii4oot9oowai' } }
212
+
213
+ it 'raises an error' do
214
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
215
+ end
216
+ end
217
+
218
+ context 'no region id provided' do
219
+ let(:config) { { :region_id => '1' } }
220
+
221
+ it 'raises an error' do
222
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ describe '#create_server' do
229
+ let(:config) do
230
+ {
231
+ :name => 'hello',
232
+ :image_id => '2047',
233
+ :flavor_id => '66',
234
+ :ssh_key_ids => '1234',
235
+ :region_id => '1'
236
+ }
237
+ end
238
+ before(:each) { @config = config.dup }
239
+ let(:servers) do
240
+ s = double('servers')
241
+ s.stub(:create) { |arg| arg }
242
+ s
243
+ end
244
+ let(:compute) { stub(:servers => servers) }
245
+ let(:driver) do
246
+ d = Kitchen::Driver::Digitalocean.new(config)
247
+ d.instance = instance
248
+ d.stub(:compute).and_return(compute)
249
+ d
250
+ end
251
+
252
+ it 'creates the server using a compute connection' do
253
+ expect(driver.send(:create_server)).to eq(@config)
254
+ end
255
+ end
256
+
257
+ describe '#generate_name' do
258
+ before(:each) do
259
+ Etc.stub(:getlogin).and_return('user')
260
+ Socket.stub(:gethostname).and_return('host')
261
+ end
262
+
263
+ it 'generates a name' do
264
+ expect(driver.send(:generate_name, 'monkey')).to match(
265
+ /^monkey-user-host-/)
266
+ end
267
+ end
268
+ end
269
+
270
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Greg Fitzgerald (<greg@gregf.org>)
4
+ #
5
+ # Copyright (C) 2013, Greg Fitzgerald
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'rspec'
20
+ require 'rspec/autorun'
21
+ require_relative '../lib/kitchen/driver/digitalocean'
22
+
23
+ RSpec.configure do |config|
24
+ config.tty = true
25
+ config.color = true
26
+ end
27
+
28
+ # vim: ai et ts=2 sts=2 sw=2 ft=ruby
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-digitalocean
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Greg Fitzgerald
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0.alpha
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0.alpha
27
+ - !ruby/object:Gem::Dependency
28
+ name: fog
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tailor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: cane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: countloc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A Test Kitchen Digital Ocean driver
126
+ email:
127
+ - greg@gregf.org
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - .travis.yml
134
+ - CHANGELOG.md
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - kitchen-digitalocean.gemspec
140
+ - lib/kitchen/driver/digitalocean.rb
141
+ - lib/kitchen/driver/digitalocean_version.rb
142
+ - spec/kitchen/driver/digitalocean_spec.rb
143
+ - spec/spec_helper.rb
144
+ homepage: https://github.com/gregf/kitchen-digitalocean
145
+ licenses:
146
+ - Apache 2.0
147
+ metadata: {}
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 2.0.3
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: A Test Kitchen Digital Ocean driver
168
+ test_files:
169
+ - spec/kitchen/driver/digitalocean_spec.rb
170
+ - spec/spec_helper.rb