vagrant-smartos-zones 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile +4 -3
- data/lib/vagrant/smartos/zones/models/config.rb +1 -1
- data/lib/vagrant/smartos/zones/models/network.rb +5 -5
- data/lib/vagrant/smartos/zones/version.rb +1 -1
- data/spec/fixtures/config/default/smartos/config.yml +0 -0
- data/spec/fixtures/config/network/smartos/config.yml +2 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/vagrant/smartos/zones/models/network_spec.rb +50 -0
- data/vagrant-smartos-zones.gemspec +1 -1
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017d81d8ef59ed8fe4f8ffdbe557a987ed8b4ada
|
4
|
+
data.tar.gz: ad0ce0a88a2debd443641eb771916ad74ac4936e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de14a90d5cf2d8a26badff84b4682b0b875be92c61405c0777012d699b73cdf0e85b6416ae2c8183cf09a8d92424b6f44d02deb6f2a1d7a3a864db05a168f50
|
7
|
+
data.tar.gz: bd39add13ae466896d6061a670f41eb8e76a8c905b9b2f5a63171c61f6189b54e21a4da6d09ce30ea8ecf17c1a62c0f9a34cb2ba424043e89f63ab05f1fe88a9
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/Gemfile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
group :development do
|
4
|
+
gem 'pry-nav'
|
5
|
+
gem 'rake'
|
6
|
+
gem 'rspec'
|
4
7
|
gem 'rubocop'
|
5
8
|
gem 'vagrant'
|
6
|
-
gem 'rake'
|
7
|
-
gem 'pry-nav'
|
8
9
|
end
|
9
10
|
|
10
11
|
group :plugins do
|
@@ -12,6 +13,6 @@ group :plugins do
|
|
12
13
|
end
|
13
14
|
|
14
15
|
group :integration do
|
15
|
-
gem 'test-kitchen'
|
16
16
|
gem 'kitchen-vagrant'
|
17
|
+
gem 'test-kitchen'
|
17
18
|
end
|
@@ -17,25 +17,25 @@ module Vagrant
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def zone_network
|
20
|
-
[cidr.network, cidr.
|
20
|
+
[cidr.network, cidr.netmask].join
|
21
21
|
end
|
22
22
|
|
23
23
|
def gz_addr
|
24
|
-
[gz_stub_ip, cidr.
|
24
|
+
[gz_stub_ip, cidr.netmask].join
|
25
25
|
end
|
26
26
|
|
27
27
|
def gz_stub_ip
|
28
|
-
cidr
|
28
|
+
cidr.nth(1).to_s
|
29
29
|
end
|
30
30
|
|
31
31
|
def zone_ip
|
32
|
-
cidr
|
32
|
+
cidr.nth(2).to_s
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def cidr
|
38
|
-
@cidr ||= NetAddr::
|
38
|
+
@cidr ||= NetAddr::IPv4Net.parse(network)
|
39
39
|
end
|
40
40
|
|
41
41
|
def plugin_config
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.expect_with :rspec do |expectations|
|
3
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
4
|
+
end
|
5
|
+
|
6
|
+
config.mock_with :rspec do |mocks|
|
7
|
+
mocks.verify_partial_doubles = true
|
8
|
+
end
|
9
|
+
|
10
|
+
config.disable_monkey_patching!
|
11
|
+
config.order = :random
|
12
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
13
|
+
|
14
|
+
if config.files_to_run.one?
|
15
|
+
# Use the documentation formatter for detailed output,
|
16
|
+
# unless a formatter has already been configured
|
17
|
+
# (e.g. via a command-line flag).
|
18
|
+
config.default_formatter = "doc"
|
19
|
+
end
|
20
|
+
|
21
|
+
Kernel.srand config.seed
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'pathname'
|
3
|
+
require 'vagrant/smartos/zones/models/network'
|
4
|
+
|
5
|
+
RSpec.describe Vagrant::Smartos::Zones::Models::Network do
|
6
|
+
subject(:network) { described_class.new(env) }
|
7
|
+
|
8
|
+
let(:env) { default_env }
|
9
|
+
let(:default_env) { { home_path: pwd.join(home_path) } }
|
10
|
+
let(:pwd) { Pathname.new(ENV['PWD']) }
|
11
|
+
let(:home_path) { 'spec/fixtures/config/default' }
|
12
|
+
|
13
|
+
describe 'network' do
|
14
|
+
it 'defaults to 172.16.0.0/24' do
|
15
|
+
expect(network.network).to eq('172.16.0.0/24')
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'with a network specified in the plugin configuration' do
|
19
|
+
let(:home_path) { 'spec/fixtures/config/network' }
|
20
|
+
|
21
|
+
it 'uses the value' do
|
22
|
+
expect(network.network).to eq('10.16.0.0/16')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'zone_network' do
|
28
|
+
it 'is a CIDR of the network' do
|
29
|
+
expect(network.zone_network).to eq('172.16.0.0/24')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'gz_addr' do
|
34
|
+
it 'is a CIDR of the first IP on the network' do
|
35
|
+
expect(network.gz_addr).to eq('172.16.0.1/24')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'gz_stub_ip' do
|
40
|
+
it 'is the first IP on the network' do
|
41
|
+
expect(network.gz_stub_ip).to eq('172.16.0.1')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'zone_ip' do
|
46
|
+
it 'is the second IP on the network' do
|
47
|
+
expect(network.zone_ip).to eq('172.16.0.2')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'netaddr', '~>
|
21
|
+
spec.add_dependency 'netaddr', '~> 2.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
24
24
|
spec.add_development_dependency 'pry-nav'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-smartos-zones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Saxby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".kitchen.yml"
|
78
|
+
- ".rspec"
|
78
79
|
- ".rubocop.yml"
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
@@ -156,6 +157,10 @@ files:
|
|
156
157
|
- lib/vagrant/smartos/zones/util/zone_user.rb
|
157
158
|
- lib/vagrant/smartos/zones/util/zones.rb
|
158
159
|
- lib/vagrant/smartos/zones/version.rb
|
160
|
+
- spec/fixtures/config/default/smartos/config.yml
|
161
|
+
- spec/fixtures/config/network/smartos/config.yml
|
162
|
+
- spec/spec_helper.rb
|
163
|
+
- spec/vagrant/smartos/zones/models/network_spec.rb
|
159
164
|
- test/integration/default/serverspec/group_spec.rb
|
160
165
|
- test/integration/default/serverspec/spec_helper.rb
|
161
166
|
- test/integration/default/serverspec/user_spec.rb
|
@@ -187,6 +192,10 @@ signing_key:
|
|
187
192
|
specification_version: 4
|
188
193
|
summary: Manage SmartOS zones in Vagrant
|
189
194
|
test_files:
|
195
|
+
- spec/fixtures/config/default/smartos/config.yml
|
196
|
+
- spec/fixtures/config/network/smartos/config.yml
|
197
|
+
- spec/spec_helper.rb
|
198
|
+
- spec/vagrant/smartos/zones/models/network_spec.rb
|
190
199
|
- test/integration/default/serverspec/group_spec.rb
|
191
200
|
- test/integration/default/serverspec/spec_helper.rb
|
192
201
|
- test/integration/default/serverspec/user_spec.rb
|