kitchen-gce 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/CHANGELOG.md +12 -0
- data/LICENSE +1 -1
- data/README.md +22 -7
- data/Rakefile +8 -0
- data/kitchen-gce.gemspec +6 -4
- data/lib/kitchen/driver/gce.rb +35 -14
- data/spec/kitchen/driver/gce_spec.rb +306 -0
- data/spec/spec_helper.rb +21 -0
- metadata +43 -10
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.1.0 / 2014-03-29
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* PR #7: Add support for specifying SSH keys in public_key_path, via @someara
|
6
|
+
* Add support for setting username
|
7
|
+
* Support GCE v1 API, including persistent disks.
|
8
|
+
|
9
|
+
### Improvements
|
10
|
+
|
11
|
+
* Add rspec tests and Travis support.
|
12
|
+
|
1
13
|
## 0.0.6 / 2014-02-23:
|
2
14
|
|
3
15
|
* Require Ruby 1.9 or greater.
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Author:: Andrew Leonard (<andy@hurricane-ridge.com>)
|
2
2
|
|
3
|
-
Copyright (C) 2013, Andrew Leonard
|
3
|
+
Copyright (C) 2013-2014, Andrew Leonard
|
4
4
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Kitchen::Gce - A Test Kitchen Driver for Google Compute Engine
|
2
2
|
|
3
|
-
[![Code Climate](https://codeclimate.com/github/anl/kitchen-gce.png)](https://codeclimate.com/github/anl/kitchen-gce)
|
3
|
+
[![Build Status](https://travis-ci.org/anl/kitchen-gce.png?branch=master)](https://travis-ci.org/anl/kitchen-gce) [![Code Climate](https://codeclimate.com/github/anl/kitchen-gce.png)](https://codeclimate.com/github/anl/kitchen-gce)
|
4
4
|
|
5
5
|
This is a [Test Kitchen](https://github.com/opscode/test-kitchen/)
|
6
6
|
driver for Google Compute Engine. While similar to EC2 and other IaaS
|
@@ -23,11 +23,12 @@ file, and note the email address associated with the service account
|
|
23
23
|
(e.g. 123456789012@developer.gserviceaccount.com - not the project
|
24
24
|
owner's email address).
|
25
25
|
|
26
|
-
If you
|
26
|
+
If you are not using the `public_key_path` setting (see below) and
|
27
|
+
have not [set up SSH keys for your GCE
|
27
28
|
environment](https://developers.google.com/compute/docs/instances#sshkeys),
|
28
29
|
you must also do that prior to using kitchen-gce. Also, you will
|
29
|
-
likely want to add your
|
30
|
-
|
30
|
+
likely want to add your SSH keys to ssh-agent prior to converging any
|
31
|
+
instances.
|
31
32
|
|
32
33
|
## Installation
|
33
34
|
|
@@ -58,6 +59,15 @@ launching instances into a zone that is down for maintenance. If
|
|
58
59
|
"any" is specified, kitchen-gce will select a zone from all areas.
|
59
60
|
Default: `us` (lowest cost area); valid values: `any`, `europe`, `us`
|
60
61
|
|
62
|
+
### autodelete_disk
|
63
|
+
|
64
|
+
Boolean specifying whether or not to automatically delete boot disk
|
65
|
+
for test instance. Default: true
|
66
|
+
|
67
|
+
### disk_size
|
68
|
+
|
69
|
+
Size, in gigabytes of boot disk. Default: 10.
|
70
|
+
|
61
71
|
### google_client_email
|
62
72
|
|
63
73
|
**Required** Email address associated with your GCE service account.
|
@@ -94,14 +104,18 @@ GCE instance type (size) to launch; default: `n1-standard-1`
|
|
94
104
|
|
95
105
|
GCE network that instance will be attached to; default: `default`
|
96
106
|
|
107
|
+
### public_key_path
|
108
|
+
|
109
|
+
Path to the public half of the ssh key that will be deployed to
|
110
|
+
`~username/.ssh/authorized_keys`; see also "username" below.
|
111
|
+
|
97
112
|
### tags
|
98
113
|
|
99
114
|
Array of tags to associate with instance; default: `[]`
|
100
115
|
|
101
116
|
### username
|
102
117
|
|
103
|
-
Username
|
104
|
-
to the appropriate SSH keys. Default: `ENV['USER']`
|
118
|
+
Username test-kitchen will log into instance as; default: `ENV['USER']`
|
105
119
|
|
106
120
|
### zone_name
|
107
121
|
|
@@ -126,8 +140,9 @@ driver_config:
|
|
126
140
|
platforms:
|
127
141
|
- name: debian-7
|
128
142
|
driver_config:
|
129
|
-
image_name: debian-7-wheezy-
|
143
|
+
image_name: debian-7-wheezy-v20140318
|
130
144
|
require_chef_omnibus: true
|
145
|
+
public_key_path: '/home/alice/.ssh/google_compute_engine.pub'
|
131
146
|
tags: ["somerole"]
|
132
147
|
|
133
148
|
suites:
|
data/Rakefile
ADDED
data/kitchen-gce.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'kitchen-gce'
|
4
|
-
s.version = '0.0
|
5
|
-
s.date = '2014-
|
4
|
+
s.version = '0.1.0'
|
5
|
+
s.date = '2014-03-29'
|
6
6
|
s.summary = 'Kitchen::Driver::Gce'
|
7
7
|
s.description = 'A Test-Kitchen driver for Google Compute Engine'
|
8
8
|
s.authors = ['Andrew Leonard']
|
@@ -12,11 +12,13 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.license = 'Apache 2.0'
|
13
13
|
|
14
14
|
s.add_dependency 'test-kitchen'
|
15
|
-
s.add_dependency 'faraday', '~> 0.8.9'
|
16
|
-
s.add_dependency 'fog', '1.
|
15
|
+
s.add_dependency 'faraday', '~> 0.8.9' # See GH issue RiotGames/ridley#239
|
16
|
+
s.add_dependency 'fog', '>= 1.20.0'
|
17
17
|
s.add_dependency 'google-api-client'
|
18
18
|
|
19
19
|
s.add_development_dependency 'bundler'
|
20
|
+
s.add_development_dependency 'pry'
|
21
|
+
s.add_development_dependency 'rake'
|
20
22
|
s.add_development_dependency 'rspec'
|
21
23
|
s.add_development_dependency 'rubocop'
|
22
24
|
|
data/lib/kitchen/driver/gce.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Author:: Andrew Leonard (<andy@hurricane-ridge.com>)
|
4
4
|
#
|
5
|
-
# Copyright (C) 2013, Andrew Leonard
|
5
|
+
# Copyright (C) 2013-2014, Andrew Leonard
|
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.
|
@@ -28,6 +28,8 @@ module Kitchen
|
|
28
28
|
# @author Andrew Leonard <andy@hurricane-ridge.com>
|
29
29
|
class Gce < Kitchen::Driver::SSHBase
|
30
30
|
default_config :area, 'us'
|
31
|
+
default_config :autodelete_disk, true
|
32
|
+
default_config :disk_size, 10
|
31
33
|
default_config :machine_type, 'n1-standard-1'
|
32
34
|
default_config :network, 'default'
|
33
35
|
default_config :inst_name, nil
|
@@ -43,12 +45,12 @@ module Kitchen
|
|
43
45
|
def create(state)
|
44
46
|
return if state[:server_id]
|
45
47
|
|
46
|
-
|
47
|
-
state[:server_id] =
|
48
|
+
instance = create_instance
|
49
|
+
state[:server_id] = instance.identity
|
48
50
|
|
49
51
|
info("GCE instance <#{state[:server_id]}> created.")
|
50
52
|
|
51
|
-
wait_for_up_instance(
|
53
|
+
wait_for_up_instance(instance, state)
|
52
54
|
|
53
55
|
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
54
56
|
raise ActionFailed, ex.message
|
@@ -57,8 +59,8 @@ module Kitchen
|
|
57
59
|
def destroy(state)
|
58
60
|
return if state[:server_id].nil?
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
+
instance = connection.servers.get(state[:server_id])
|
63
|
+
instance.destroy unless instance.nil?
|
62
64
|
info("GCE instance <#{state[:server_id]}> destroyed.")
|
63
65
|
state.delete(:server_id)
|
64
66
|
state.delete(:hostname)
|
@@ -75,21 +77,40 @@ module Kitchen
|
|
75
77
|
)
|
76
78
|
end
|
77
79
|
|
80
|
+
def create_disk
|
81
|
+
disk = connection.disks.create(
|
82
|
+
name: config[:inst_name],
|
83
|
+
size_gb: config[:disk_size],
|
84
|
+
zone_name: config[:zone_name],
|
85
|
+
source_image: config[:image_name]
|
86
|
+
)
|
87
|
+
|
88
|
+
disk.wait_for { disk.ready? }
|
89
|
+
disk
|
90
|
+
end
|
91
|
+
|
78
92
|
def create_instance
|
79
|
-
config[:inst_name] ||=
|
93
|
+
config[:inst_name] ||= generate_inst_name
|
80
94
|
config[:zone_name] ||= select_zone
|
81
95
|
|
96
|
+
disk = create_disk
|
97
|
+
create_server(disk)
|
98
|
+
end
|
99
|
+
|
100
|
+
def create_server(disk)
|
82
101
|
connection.servers.create(
|
83
102
|
name: config[:inst_name],
|
84
|
-
|
103
|
+
disks: [disk.get_as_boot_disk(true, config[:autodelete_disk])],
|
85
104
|
machine_type: config[:machine_type],
|
86
105
|
network: config[:network],
|
87
106
|
tags: config[:tags],
|
88
|
-
zone_name: config[:zone_name]
|
107
|
+
zone_name: config[:zone_name],
|
108
|
+
public_key_path: config[:public_key_path],
|
109
|
+
username: config[:username]
|
89
110
|
)
|
90
111
|
end
|
91
112
|
|
92
|
-
def
|
113
|
+
def generate_inst_name
|
93
114
|
# Inspired by generate_name from kitchen-rackspace
|
94
115
|
base_name = instance.name[0..26] # UUID is 36 chars, max name length 63
|
95
116
|
"#{base_name}-#{SecureRandom.uuid}"
|
@@ -108,14 +129,14 @@ module Kitchen
|
|
108
129
|
zones.sample.name
|
109
130
|
end
|
110
131
|
|
111
|
-
def wait_for_up_instance(
|
112
|
-
|
132
|
+
def wait_for_up_instance(instance, state)
|
133
|
+
instance.wait_for do
|
113
134
|
print '.'
|
114
135
|
ready?
|
115
136
|
end
|
116
137
|
print '(server ready)'
|
117
|
-
state[:hostname] =
|
118
|
-
|
138
|
+
state[:hostname] = instance.public_ip_address ||
|
139
|
+
instance.private_ip_address
|
119
140
|
wait_for_sshd(state[:hostname], config[:username])
|
120
141
|
puts '(ssh ready)'
|
121
142
|
end
|
@@ -0,0 +1,306 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Andrew Leonard (<andy@hurricane-ridge.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2013-2014, Andrew Leonard
|
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_relative '../../spec_helper.rb'
|
20
|
+
|
21
|
+
require 'resolv'
|
22
|
+
|
23
|
+
describe Kitchen::Driver::Gce do
|
24
|
+
|
25
|
+
let(:config) do
|
26
|
+
{ google_client_email: '123456789012@developer.gserviceaccount.com',
|
27
|
+
google_key_location: '/home/user/gce/123456-privatekey.p12',
|
28
|
+
google_project: 'alpha-bravo-123'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:state) { Hash.new }
|
33
|
+
|
34
|
+
let(:logged_output) { StringIO.new }
|
35
|
+
let(:logger) { Logger.new(logged_output) }
|
36
|
+
|
37
|
+
let(:instance) do
|
38
|
+
double(
|
39
|
+
logger: logger,
|
40
|
+
name: 'default-distro-12'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:driver) do
|
45
|
+
d = Kitchen::Driver::Gce.new(config)
|
46
|
+
d.instance = instance
|
47
|
+
d.stub(:wait_for_sshd).and_return(true)
|
48
|
+
d
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:fog) do
|
52
|
+
Fog::Compute::Google::Mock.new
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:disk) do
|
56
|
+
fog.disks.create(
|
57
|
+
name: 'rspec-test-disk',
|
58
|
+
size_gb: 10,
|
59
|
+
zone_name: 'us-central1-b',
|
60
|
+
source_image: 'debian-7-wheezy-v20131120'
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:server) do
|
65
|
+
fog.servers.create(
|
66
|
+
name: 'rspec-test-instance',
|
67
|
+
disks: [disk],
|
68
|
+
machine_type: 'n1-standard-1',
|
69
|
+
zone_name: 'us-central1-b'
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
before(:each) do
|
74
|
+
Fog.mock!
|
75
|
+
Fog::Mock.reset
|
76
|
+
Fog::Mock.delay = 0
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#initialize' do
|
80
|
+
context 'with default options' do
|
81
|
+
|
82
|
+
defaults = {
|
83
|
+
area: 'us',
|
84
|
+
autodelete_disk: true,
|
85
|
+
disk_size: 10,
|
86
|
+
inst_name: nil,
|
87
|
+
machine_type: 'n1-standard-1',
|
88
|
+
network: 'default',
|
89
|
+
tags: [],
|
90
|
+
username: ENV['USER'],
|
91
|
+
zone_name: nil }
|
92
|
+
|
93
|
+
defaults.each do |k, v|
|
94
|
+
it "sets the correct default for #{k}" do
|
95
|
+
expect(driver[k]).to eq(v)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'with overriden options' do
|
101
|
+
overrides = {
|
102
|
+
area: 'europe',
|
103
|
+
autodelete_disk: false,
|
104
|
+
disk_size: 15,
|
105
|
+
inst_name: 'ci-instance',
|
106
|
+
machine_type: 'n1-highmem-8',
|
107
|
+
network: 'dev-net',
|
108
|
+
tags: %w(qa integration),
|
109
|
+
username: 'root',
|
110
|
+
zone_name: 'europe-west1-a'
|
111
|
+
}
|
112
|
+
|
113
|
+
let(:config) { overrides }
|
114
|
+
|
115
|
+
overrides.each do |k, v|
|
116
|
+
it "overrides the default value for #{k}" do
|
117
|
+
expect(driver[k]).to eq(v)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#connection' do
|
124
|
+
context 'with required variables set' do
|
125
|
+
it 'returns a Fog Compute object' do
|
126
|
+
expect(driver.send(:connection)).to be_a(Fog::Compute::Google::Mock)
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'uses the v1 api version' do
|
130
|
+
conn = driver.send(:connection)
|
131
|
+
expect(conn.api_version).to eq('v1')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'without required variables set' do
|
136
|
+
let(:config) { Hash.new }
|
137
|
+
|
138
|
+
it 'raises an error' do
|
139
|
+
expect { driver.send(:connection) }.to raise_error(ArgumentError)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe '#create' do
|
145
|
+
context 'with an existing server' do
|
146
|
+
let(:state) do
|
147
|
+
s = Hash.new
|
148
|
+
s[:server_id] = 'default-distro-12345678'
|
149
|
+
s
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'returns if server_id already exists' do
|
153
|
+
expect(driver.create(state)).to equal nil
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
context 'when an instance is successfully created' do
|
158
|
+
|
159
|
+
let(:driver) do
|
160
|
+
d = Kitchen::Driver::Gce.new(config)
|
161
|
+
d.stub(create_instance: server)
|
162
|
+
d.stub(:wait_for_up_instance).and_return(nil)
|
163
|
+
d
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'sets a value for server_id in the state hash' do
|
167
|
+
driver.send(:create, state)
|
168
|
+
expect(state[:server_id]).to eq('rspec-test-instance')
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'returns nil' do
|
172
|
+
expect(driver.send(:create, state)).to equal(nil)
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '#create_disk' do
|
180
|
+
context 'with defaults and required options' do
|
181
|
+
it 'returns a Google Disk object' do
|
182
|
+
config[:image_name] = 'debian-7-wheezy-v20131120'
|
183
|
+
config[:inst_name] = 'rspec-disk'
|
184
|
+
config[:zone_name] = 'us-central1-a'
|
185
|
+
expect(driver.send(:create_disk)).to be_a(Fog::Compute::Google::Disk)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'without required options' do
|
190
|
+
it 'returns a Fog NotFound Error' do
|
191
|
+
expect { driver.send(:create_disk) }.to raise_error(
|
192
|
+
Fog::Errors::NotFound)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe '#create_instance' do
|
198
|
+
context 'with default options' do
|
199
|
+
it 'returns a Fog Compute Server object' do
|
200
|
+
expect(driver.send(:create_instance)).to be_a(
|
201
|
+
Fog::Compute::Google::Server)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe '#create_server' do
|
207
|
+
context 'with default options' do
|
208
|
+
it 'returns a Fog Compute Server object' do
|
209
|
+
expect(driver.send(:create_instance)).to be_a(
|
210
|
+
Fog::Compute::Google::Server)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe '#destroy' do
|
216
|
+
let(:state) do
|
217
|
+
s = Hash.new
|
218
|
+
s[:server_id] = 'rspec-test-instance'
|
219
|
+
s[:hostname] = '198.51.100.17'
|
220
|
+
s
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'returns if server_id does not exist' do
|
224
|
+
expect(driver.destroy({})).to equal nil
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'removes the server state information' do
|
228
|
+
driver.destroy(state)
|
229
|
+
expect(state[:hostname]).to equal(nil)
|
230
|
+
expect(state[:server_id]).to equal(nil)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe '#generate_inst_name' do
|
235
|
+
context 'with a name less than 28 characters' do
|
236
|
+
it 'concatenates the name and a UUID' do
|
237
|
+
expect(driver.send(:generate_inst_name)).to match(
|
238
|
+
/^default-distro-12-[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
context 'with a name 28 characters or longer' do
|
243
|
+
let(:instance) do
|
244
|
+
double(name: '1234567890123456789012345678')
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'shortens the base name and appends a UUID' do
|
248
|
+
expect(driver.send(:generate_inst_name)).to match(
|
249
|
+
/^123456789012345678901234567
|
250
|
+
-[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/x)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
describe '#select_zone' do
|
256
|
+
context 'when choosing from any area' do
|
257
|
+
let(:config) do
|
258
|
+
{ area: 'any',
|
259
|
+
google_client_email: '123456789012@developer.gserviceaccount.com',
|
260
|
+
google_key_location: '/home/user/gce/123456-privatekey.p12',
|
261
|
+
google_project: 'alpha-bravo-123'
|
262
|
+
}
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'chooses from all zones' do
|
266
|
+
expect(driver.send(:select_zone)).to satisfy do |zone|
|
267
|
+
%w(europe-west1-a us-central1-a us-central1-b
|
268
|
+
us-central2-a).include?(zone)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
context 'when choosing from the "europe" area' do
|
274
|
+
let(:config) do
|
275
|
+
{ area: 'europe',
|
276
|
+
google_client_email: '123456789012@developer.gserviceaccount.com',
|
277
|
+
google_key_location: '/home/user/gce/123456-privatekey.p12',
|
278
|
+
google_project: 'alpha-bravo-123'
|
279
|
+
}
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'chooses a zone in europe' do
|
283
|
+
expect(driver.send(:select_zone)).to satisfy do |zone|
|
284
|
+
%w(europe-west1-a).include?(zone)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
context 'when choosing from the default "us" area' do
|
290
|
+
it 'chooses a zone in the us' do
|
291
|
+
expect(driver.send(:select_zone)).to satisfy do |zone|
|
292
|
+
%w(us-central1-a us-central1-b us-central2-a).include?(zone)
|
293
|
+
end
|
294
|
+
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
describe '#wait_for_up_instance' do
|
300
|
+
it 'sets the hostname' do
|
301
|
+
driver.send(:wait_for_up_instance, server, state)
|
302
|
+
# Mock instance gives us a random IP each time:
|
303
|
+
expect(state[:hostname]).to match(Resolv::IPv4::Regex)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Andrew Leonard (<andy@hurricane-ridge.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2013-2014, Andrew Leonard
|
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
|
+
|
21
|
+
require_relative '../lib/kitchen/driver/gce'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-gce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-kitchen
|
@@ -48,17 +48,17 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- - '
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 1.20.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- - '
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.20.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: google-api-client
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +91,38 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: pry
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
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
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
94
126
|
- !ruby/object:Gem::Dependency
|
95
127
|
name: rspec
|
96
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,12 +162,16 @@ extensions: []
|
|
130
162
|
extra_rdoc_files: []
|
131
163
|
files:
|
132
164
|
- .gitignore
|
165
|
+
- .travis.yml
|
133
166
|
- CHANGELOG.md
|
134
167
|
- Gemfile
|
135
168
|
- LICENSE
|
136
169
|
- README.md
|
170
|
+
- Rakefile
|
137
171
|
- kitchen-gce.gemspec
|
138
172
|
- lib/kitchen/driver/gce.rb
|
173
|
+
- spec/kitchen/driver/gce_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
139
175
|
homepage: https://github.com/anl/kitchen-gce
|
140
176
|
licenses:
|
141
177
|
- Apache 2.0
|
@@ -155,12 +191,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
191
|
- - ! '>='
|
156
192
|
- !ruby/object:Gem::Version
|
157
193
|
version: '0'
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
hash: 134419407739648312
|
161
194
|
requirements: []
|
162
195
|
rubyforge_project:
|
163
|
-
rubygems_version: 1.8.23
|
196
|
+
rubygems_version: 1.8.23.2
|
164
197
|
signing_key:
|
165
198
|
specification_version: 3
|
166
199
|
summary: Kitchen::Driver::Gce
|