chef-provisioning-vsphere 0.8.2 → 0.8.3.dev

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.
@@ -1,132 +1,132 @@
1
- require 'chef/provisioning/vsphere_driver'
2
-
3
- describe ChefProvisioningVsphere::VsphereDriver do
4
- subject do
5
- Chef::Provisioning.driver_for_url(
6
- 'vsphere://3.3.3.3:999/crazyapi?use_ssl=false&insecure=true',
7
- metal_config
8
- )
9
- end
10
-
11
- context "when config does not include the properties included in the url" do
12
- let(:metal_config) do
13
- {
14
- :driver_options => {
15
- :user => 'vmapi',
16
- :password => '<password>'
17
- },
18
- :machine_options => {
19
- :ssh => {
20
- :password => '<password>',
21
- :paranoid => false
22
- },
23
- :bootstrap_options => {
24
- :datacenter => 'QA1',
25
- :template_name => 'UBUNTU-12-64-TEMPLATE',
26
- :vm_folder => 'DLAB',
27
- :num_cpus => 2,
28
- :memory_mb => 4096,
29
- :resource_pool => 'CLSTR02/DLAB'
30
- }
31
- },
32
- :log_level => :debug
33
- }
34
- end
35
-
36
- it "populates the connect options with correct host from the driver url" do
37
- expect(subject.connect_options[:host]).to eq('3.3.3.3')
38
- end
39
- it "populates the connect options with correct port from the driver url" do
40
- expect(subject.connect_options[:port]).to eq(999)
41
- end
42
- it "populates the connect options with correct path from the driver url" do
43
- expect(subject.connect_options[:path]).to eq('/crazyapi')
44
- end
45
- it "populates the connect options with correct use_ssl setting from the driver url" do
46
- expect(subject.connect_options[:use_ssl]).to eq(false)
47
- end
48
- it "populates the connect options with correct insecure setting from the driver url" do
49
- expect(subject.connect_options[:insecure]).to eq(true)
50
- end
51
- end
52
-
53
- context "when config keys are stringified" do
54
- let(:metal_config) do
55
- {
56
- 'driver_options' => {
57
- 'user' => 'vmapi',
58
- 'password' => '<driver_password>'
59
- },
60
- 'bootstrap_options' => {
61
- 'machine_options' => {
62
- 'datacenter' => 'QA1',
63
- 'ssh' => {
64
- 'password' => '<machine_password>'
65
- }
66
- }
67
- }
68
- }
69
- end
70
-
71
- it "will symbolize user" do
72
- expect(subject.connect_options[:user]).to eq('vmapi')
73
- end
74
- it "will symbolize password" do
75
- expect(subject.connect_options[:password]).to eq('<driver_password>')
76
- end
77
- it "will symbolize ssh password" do
78
- expect(subject.config[:bootstrap_options][:machine_options][:ssh][:password]).to eq('<machine_password>')
79
- end
80
- it "will symbolize ssh bootstrap options" do
81
- expect(subject.config[:bootstrap_options][:machine_options][:datacenter]).to eq('QA1')
82
- end
83
- end
84
-
85
- describe 'canonicalize_url' do
86
- context "when no url is in the config" do
87
- let(:metal_config) do
88
- {
89
- :user => 'vmapi',
90
- :password => '<password>',
91
- :host => '4.4.4.4',
92
- :port => 888,
93
- :path => '/yoda',
94
- :use_ssl => false,
95
- :insecure => true
96
- }
97
- end
98
-
99
- subject do
100
- ChefProvisioningVsphere::VsphereDriver.canonicalize_url(
101
- nil,
102
- metal_config
103
- )
104
- end
105
-
106
- it "creates the correct driver url from config settings" do
107
- expect(subject[0]).to eq('vsphere://4.4.4.4:888/yoda?use_ssl=false&insecure=true')
108
- end
109
- end
110
-
111
- context "when no url is in the config and config is missing defaulted values" do
112
- let(:metal_config) do
113
- {
114
- :user => 'vmapi',
115
- :password => '<password>',
116
- :host => '4.4.4.4'
117
- }
118
- end
119
-
120
- subject do
121
- ChefProvisioningVsphere::VsphereDriver.canonicalize_url(
122
- nil,
123
- metal_config
124
- )
125
- end
126
-
127
- it "creates the correct driver url from default settings" do
128
- expect(subject[0]).to eq('vsphere://4.4.4.4/sdk?use_ssl=true&insecure=false')
129
- end
130
- end
131
- end
132
- end
1
+ require 'chef/provisioning/vsphere_driver'
2
+
3
+ describe ChefProvisioningVsphere::VsphereDriver do
4
+ subject do
5
+ Chef::Provisioning.driver_for_url(
6
+ 'vsphere://3.3.3.3:999/crazyapi?use_ssl=false&insecure=true',
7
+ metal_config
8
+ )
9
+ end
10
+
11
+ context "when config does not include the properties included in the url" do
12
+ let(:metal_config) do
13
+ {
14
+ :driver_options => {
15
+ :user => 'vmapi',
16
+ :password => '<password>'
17
+ },
18
+ :machine_options => {
19
+ :ssh => {
20
+ :password => '<password>',
21
+ :paranoid => false
22
+ },
23
+ :bootstrap_options => {
24
+ :datacenter => 'QA1',
25
+ :template_name => 'UBUNTU-12-64-TEMPLATE',
26
+ :vm_folder => 'DLAB',
27
+ :num_cpus => 2,
28
+ :memory_mb => 4096,
29
+ :resource_pool => 'CLSTR02/DLAB'
30
+ }
31
+ },
32
+ :log_level => :debug
33
+ }
34
+ end
35
+
36
+ it "populates the connect options with correct host from the driver url" do
37
+ expect(subject.connect_options[:host]).to eq('3.3.3.3')
38
+ end
39
+ it "populates the connect options with correct port from the driver url" do
40
+ expect(subject.connect_options[:port]).to eq(999)
41
+ end
42
+ it "populates the connect options with correct path from the driver url" do
43
+ expect(subject.connect_options[:path]).to eq('/crazyapi')
44
+ end
45
+ it "populates the connect options with correct use_ssl setting from the driver url" do
46
+ expect(subject.connect_options[:use_ssl]).to eq(false)
47
+ end
48
+ it "populates the connect options with correct insecure setting from the driver url" do
49
+ expect(subject.connect_options[:insecure]).to eq(true)
50
+ end
51
+ end
52
+
53
+ context "when config keys are stringified" do
54
+ let(:metal_config) do
55
+ {
56
+ 'driver_options' => {
57
+ 'user' => 'vmapi',
58
+ 'password' => '<driver_password>'
59
+ },
60
+ 'bootstrap_options' => {
61
+ 'machine_options' => {
62
+ 'datacenter' => 'QA1',
63
+ 'ssh' => {
64
+ 'password' => '<machine_password>'
65
+ }
66
+ }
67
+ }
68
+ }
69
+ end
70
+
71
+ it "will symbolize user" do
72
+ expect(subject.connect_options[:user]).to eq('vmapi')
73
+ end
74
+ it "will symbolize password" do
75
+ expect(subject.connect_options[:password]).to eq('<driver_password>')
76
+ end
77
+ it "will symbolize ssh password" do
78
+ expect(subject.config[:bootstrap_options][:machine_options][:ssh][:password]).to eq('<machine_password>')
79
+ end
80
+ it "will symbolize ssh bootstrap options" do
81
+ expect(subject.config[:bootstrap_options][:machine_options][:datacenter]).to eq('QA1')
82
+ end
83
+ end
84
+
85
+ describe 'canonicalize_url' do
86
+ context "when no url is in the config" do
87
+ let(:metal_config) do
88
+ {
89
+ :user => 'vmapi',
90
+ :password => '<password>',
91
+ :host => '4.4.4.4',
92
+ :port => 888,
93
+ :path => '/yoda',
94
+ :use_ssl => false,
95
+ :insecure => true
96
+ }
97
+ end
98
+
99
+ subject do
100
+ ChefProvisioningVsphere::VsphereDriver.canonicalize_url(
101
+ nil,
102
+ metal_config
103
+ )
104
+ end
105
+
106
+ it "creates the correct driver url from config settings" do
107
+ expect(subject[0]).to eq('vsphere://4.4.4.4:888/yoda?use_ssl=false&insecure=true')
108
+ end
109
+ end
110
+
111
+ context "when no url is in the config and config is missing defaulted values" do
112
+ let(:metal_config) do
113
+ {
114
+ :user => 'vmapi',
115
+ :password => '<password>',
116
+ :host => '4.4.4.4'
117
+ }
118
+ end
119
+
120
+ subject do
121
+ ChefProvisioningVsphere::VsphereDriver.canonicalize_url(
122
+ nil,
123
+ metal_config
124
+ )
125
+ end
126
+
127
+ it "creates the correct driver url from default settings" do
128
+ expect(subject[0]).to eq('vsphere://4.4.4.4/sdk?use_ssl=true&insecure=false')
129
+ end
130
+ end
131
+ end
132
+ end
@@ -1,66 +1,66 @@
1
- require_relative '../../lib/chef/provisioning/vsphere_driver/vsphere_url.rb'
2
-
3
- describe 'VsphereUrl' do
4
- expected_host='1.1.1.1'
5
- expected_port=1818
6
- expected_path='/path'
7
-
8
- let(:url) {URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}")}
9
-
10
- it "has the vsphere scheme" do
11
- expect(url.scheme).to eq('vsphere')
12
- end
13
- it "has the expected host" do
14
- expect(url.host).to eq(expected_host)
15
- end
16
- it "has the expected port" do
17
- expect(url.port).to eq(expected_port)
18
- end
19
- it "has the expected path" do
20
- expect(url.path).to eq(expected_path)
21
- end
22
- it "has the the default ssl setting" do
23
- expect(url.use_ssl).to eq(true)
24
- end
25
- it "has the the default insecure setting" do
26
- expect(url.insecure).to eq(false)
27
- end
28
-
29
- context "when setting from a hash" do
30
- let(:url) { URI::VsphereUrl.from_config({
31
- :host => '2.2.2.2',
32
- :port => 2345,
33
- :path => "/hoooo",
34
- :use_ssl => false,
35
- :insecure => true
36
- }) }
37
-
38
- it "asigns the correct url" do
39
- expect(url.to_s).to eq('vsphere://2.2.2.2:2345/hoooo?use_ssl=false&insecure=true')
40
- end
41
- end
42
- context "when ssl is enabled" do
43
- it "retuns an ssl value of true" do
44
- url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=true")
45
- expect(url.use_ssl).to eq(true)
46
- end
47
- end
48
- context "when ssl is disabled" do
49
- it "retuns an ssl value of true" do
50
- url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=false")
51
- expect(url.use_ssl).to eq(false)
52
- end
53
- end
54
- context "when insecure is enabled" do
55
- it "retuns an insecure value of true" do
56
- url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=true")
57
- expect(url.insecure).to eq(true)
58
- end
59
- end
60
- context "when insecure is disabled" do
61
- it "retuns an insecure value of true" do
62
- url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=false")
63
- expect(url.insecure).to eq(false)
64
- end
65
- end
1
+ require_relative '../../lib/chef/provisioning/vsphere_driver/vsphere_url.rb'
2
+
3
+ describe 'VsphereUrl' do
4
+ expected_host='1.1.1.1'
5
+ expected_port=1818
6
+ expected_path='/path'
7
+
8
+ let(:url) {URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}")}
9
+
10
+ it "has the vsphere scheme" do
11
+ expect(url.scheme).to eq('vsphere')
12
+ end
13
+ it "has the expected host" do
14
+ expect(url.host).to eq(expected_host)
15
+ end
16
+ it "has the expected port" do
17
+ expect(url.port).to eq(expected_port)
18
+ end
19
+ it "has the expected path" do
20
+ expect(url.path).to eq(expected_path)
21
+ end
22
+ it "has the the default ssl setting" do
23
+ expect(url.use_ssl).to eq(true)
24
+ end
25
+ it "has the the default insecure setting" do
26
+ expect(url.insecure).to eq(false)
27
+ end
28
+
29
+ context "when setting from a hash" do
30
+ let(:url) { URI::VsphereUrl.from_config({
31
+ :host => '2.2.2.2',
32
+ :port => 2345,
33
+ :path => "/hoooo",
34
+ :use_ssl => false,
35
+ :insecure => true
36
+ }) }
37
+
38
+ it "asigns the correct url" do
39
+ expect(url.to_s).to eq('vsphere://2.2.2.2:2345/hoooo?use_ssl=false&insecure=true')
40
+ end
41
+ end
42
+ context "when ssl is enabled" do
43
+ it "retuns an ssl value of true" do
44
+ url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=true")
45
+ expect(url.use_ssl).to eq(true)
46
+ end
47
+ end
48
+ context "when ssl is disabled" do
49
+ it "retuns an ssl value of true" do
50
+ url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=false")
51
+ expect(url.use_ssl).to eq(false)
52
+ end
53
+ end
54
+ context "when insecure is enabled" do
55
+ it "retuns an insecure value of true" do
56
+ url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=true")
57
+ expect(url.insecure).to eq(true)
58
+ end
59
+ end
60
+ context "when insecure is disabled" do
61
+ it "retuns an insecure value of true" do
62
+ url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=false")
63
+ expect(url.insecure).to eq(false)
64
+ end
65
+ end
66
66
  end