kitchen-rackspace 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8ccd25a789a37c85ac075132f6e3d337469efbe
4
- data.tar.gz: 40110dcc2c8348d269e9fb431a2509cfdc7cf9c7
3
+ metadata.gz: b38ffcc8eb26f872550c5ec737ed5066857fb6c4
4
+ data.tar.gz: 68bdd5ae2e14296e510c3459441e1ad898c1ec38
5
5
  SHA512:
6
- metadata.gz: 1f154376c3eb72b7e6a88366865b42e62e7d0ecd604e9b63f3e600a89805eea7e8d3006c34337ed51368709afaa4af9146f2deda7cc4c312b4695624b053f869
7
- data.tar.gz: d9e441d9540f0f30cdf34ab71e8e247ef5caadade73ddf6f5691a7525ef6d368c59084549646916a7a25d04b3a78eeda6812f7050d89971bd387c9eef7563677
6
+ metadata.gz: bf5a93011bdb76cf76162077670dc66c6db8a0dd41c91a00d8bcc394c0b99ae8fd5a079b5652af8c39d7a1fe73ceadf337c9864c05fb06d8829bbe4b92e74bf9
7
+ data.tar.gz: 1402487a8c35aacbd2189b1e020fe5c9c23bc3fc549137e80267313eef581e03f354fa0fdc83bffdf07647a966ba9ddb1fa5e32e5e736a2e6bb744fe3f140f4c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.11.0 / 2014-09-04
2
+
3
+ ### Improvements
4
+
5
+ * PR [#40][] - Port the server name generator from the OpenStack/DigitalOcean
6
+ drivers, with all its bug fixes; update image IDs
7
+
1
8
  # 0.10.0 / 2014-08-28
2
9
 
3
10
  ### Improvements
@@ -90,6 +97,7 @@ boot times, via [@coderanger][]
90
97
 
91
98
  * Initial release! Woo!
92
99
 
100
+ [#40]: https://github.com/test-kitchen/kitchen-rackspace/pull/40
93
101
  [#39]: https://github.com/test-kitchen/kitchen-rackspace/pull/39
94
102
  [#38]: https://github.com/test-kitchen/kitchen-rackspace/pull/38
95
103
  [#37]: https://github.com/test-kitchen/kitchen-rackspace/pull/37
data/data/images.json CHANGED
@@ -2,20 +2,20 @@
2
2
  "arch": "88928a0a-f94c-47e3-ad7d-27b735af1a15",
3
3
  "arch-2014": "88928a0a-f94c-47e3-ad7d-27b735af1a15",
4
4
  "arch-2014.8": "88928a0a-f94c-47e3-ad7d-27b735af1a15",
5
- "centos": "76016123-eed4-4666-aea9-651fd26ee13c",
6
- "centos-7": "76016123-eed4-4666-aea9-651fd26ee13c",
7
- "centos-7.0": "76016123-eed4-4666-aea9-651fd26ee13c",
5
+ "centos": "4da79ffd-46f0-4f7c-9ade-490f04cc8994",
6
+ "centos-7": "4da79ffd-46f0-4f7c-9ade-490f04cc8994",
7
+ "centos-7.0": "4da79ffd-46f0-4f7c-9ade-490f04cc8994",
8
8
  "centos-6": "a84b1592-6817-42da-a57c-3c13f3cfc1da",
9
9
  "centos-6.5": "a84b1592-6817-42da-a57c-3c13f3cfc1da",
10
10
  "centos-5": "1078244e-5906-4faf-b88a-a4202889dc00",
11
11
  "centos-5.10": "1078244e-5906-4faf-b88a-a4202889dc00",
12
12
  "coreos": "4ca73331-5063-429f-8a27-70de5099e747",
13
13
  "coreos-stable": "4ca73331-5063-429f-8a27-70de5099e747",
14
- "coreos-beta": "746ba067-035c-4dbb-91f6-39300a7f8a03",
14
+ "coreos-beta": "b782d604-4f2e-48b1-a184-fb99b19889b4",
15
15
  "coreos-alpha": "78a24bc3-2545-433b-8067-a5143c04a3c3",
16
- "debian": "3e1c00f6-bcbb-4590-903a-c39662bdbc3d",
17
- "debian-7": "3e1c00f6-bcbb-4590-903a-c39662bdbc3d",
18
- "debian-7.6": "3e1c00f6-bcbb-4590-903a-c39662bdbc3d",
16
+ "debian": "06cbc0a2-a906-4e6a-8ed7-bd7c952c9f81",
17
+ "debian-7": "06cbc0a2-a906-4e6a-8ed7-bd7c952c9f81",
18
+ "debian-7.6": "06cbc0a2-a906-4e6a-8ed7-bd7c952c9f81",
19
19
  "debian-6": "695ca76e-fc0d-4e36-82e0-8ed66480a999",
20
20
  "debian-6.06": "695ca76e-fc0d-4e36-82e0-8ed66480a999",
21
21
  "debian-testing": "ed2dd345-b0a5-42aa-b061-a153c91e2c6d",
@@ -95,10 +95,21 @@ module Kitchen
95
95
  images[instance.platform.name]
96
96
  end
97
97
 
98
+ # Generate what should be a unique server name up to 63 total chars
99
+ # Base name: 15
100
+ # Username: 15
101
+ # Hostname: 23
102
+ # Random string: 7
103
+ # Separators: 3
104
+ # ================
105
+ # Total: 63
98
106
  def default_name
99
- # Generate what should be a unique server name
100
- rand_str = Array.new(8) { rand(36).to_s(36) }.join
101
- "#{instance.name}-#{Etc.getlogin}-#{Socket.gethostname}-#{rand_str}"
107
+ [
108
+ instance.name.gsub(/\W/, '')[0..14],
109
+ (Etc.getlogin || 'nologin').gsub(/\W/, '')[0..14],
110
+ Socket.gethostname.gsub(/\W/, '')[0..22],
111
+ Array.new(7) { rand(36).to_s(36) }.join
112
+ ].join('-')
102
113
  end
103
114
 
104
115
  private
@@ -21,6 +21,6 @@ module Kitchen
21
21
  #
22
22
  # @author Jonathan Hartman <j@p4nt5.com>
23
23
  module Driver
24
- RACKSPACE_VERSION = '0.10.0'
24
+ RACKSPACE_VERSION = '0.11.0'
25
25
  end
26
26
  end
@@ -30,10 +30,11 @@ describe Kitchen::Driver::Rackspace do
30
30
  let(:state) { Hash.new }
31
31
  let(:platform_name) { 'ubuntu' }
32
32
  let(:default_networks) { nil }
33
+ let(:instance_name) { 'potatoes' }
33
34
 
34
35
  let(:instance) do
35
36
  double(
36
- name: 'potatoes',
37
+ name: instance_name,
37
38
  logger: logger,
38
39
  to_str: 'instance',
39
40
  platform: double(name: platform_name)
@@ -120,7 +121,7 @@ describe Kitchen::Driver::Rackspace do
120
121
  'ubuntu' => '255df5fb-e3d4-45a3-9a07-c976debf7c14',
121
122
  'centos-5.10' => '1078244e-5906-4faf-b88a-a4202889dc00',
122
123
  'centos-5' => '1078244e-5906-4faf-b88a-a4202889dc00',
123
- 'centos' => '76016123-eed4-4666-aea9-651fd26ee13c'
124
+ 'centos' => '4da79ffd-46f0-4f7c-9ade-490f04cc8994'
124
125
  }
125
126
  platforms.each do |platform, id|
126
127
  context "name is #{platform}" do
@@ -387,14 +388,56 @@ describe Kitchen::Driver::Rackspace do
387
388
  end
388
389
 
389
390
  describe '#default_name' do
391
+ let(:login) { 'user' }
392
+ let(:hostname) { 'host' }
393
+
390
394
  before(:each) do
391
- allow(Etc).to receive(:getlogin).and_return('user')
392
- allow(Socket).to receive(:gethostname).and_return('host')
395
+ allow(Etc).to receive(:getlogin).and_return(login)
396
+ allow(Socket).to receive(:gethostname).and_return(hostname)
393
397
  end
394
398
 
395
399
  it 'generates a name' do
396
- expect(driver.default_name).to match(
397
- /^potatoes-user-host-/)
400
+ expect(driver.send(:default_name)).to match(/^potatoes-user-host-(\S*)/)
401
+ end
402
+
403
+ context 'local node with a long hostname' do
404
+ let(:hostname) { 'ab.c' * 20 }
405
+
406
+ it 'limits the generated name to 63 characters' do
407
+ expect(driver.send(:default_name).length).to be <= (63)
408
+ end
409
+ end
410
+
411
+ context 'node with a long hostname, username, and base name' do
412
+ let(:login) { 'abcd' * 20 }
413
+ let(:hostname) { 'efgh' * 20 }
414
+ let(:instance_name) { 'ijkl' * 20 }
415
+
416
+ it 'limits the generated name to 63 characters' do
417
+ expect(driver.send(:default_name).length).to eq(63)
418
+ end
419
+ end
420
+
421
+ context 'a login and hostname with punctuation in them' do
422
+ let(:login) { 'some.u-se-r' }
423
+ let(:hostname) { 'a.host-name' }
424
+ let(:instance_name) { 'a.instance-name' }
425
+
426
+ it 'strips out the dots to prevent bad server names' do
427
+ expect(driver.send(:default_name)).to_not include('.')
428
+ end
429
+
430
+ it 'strips out all but the three hyphen separators' do
431
+ expect(driver.send(:default_name).count('-')).to eq(3)
432
+ end
433
+ end
434
+
435
+ context 'a non-login shell' do
436
+ let(:login) { nil }
437
+
438
+ it 'subs in a placeholder login string' do
439
+ expect(driver.send(:default_name)).to match(/^potatoes-nologin-/)
440
+ end
398
441
  end
399
442
  end
400
443
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  requirements: []
222
222
  rubyforge_project:
223
- rubygems_version: 2.2.2
223
+ rubygems_version: 2.4.1
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: A Test Kitchen Rackspace driver