chef-provisioning-opennebula 0.4.3 → 0.4.4

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -18
  3. data/lib/chef/provider/one_template.rb +19 -3
  4. data/lib/chef/provisioning/opennebula_driver/one_lib.rb +11 -4
  5. data/lib/chef/provisioning/opennebula_driver/version.rb +1 -1
  6. data/spec/config_sample.rb +60 -0
  7. data/spec/integration/test_all_integration_spec.rb +264 -79
  8. data/spec/recipes/OneDriver/attach_back_one_vm_spec.rb +20 -0
  9. data/spec/recipes/OneDriver/attach_back_two_vm_spec.rb +20 -0
  10. data/spec/recipes/OneDriver/attach_one_image_spec.rb +20 -0
  11. data/spec/recipes/OneDriver/converge_back_one_vm_spec.rb +19 -0
  12. data/spec/recipes/OneDriver/converge_back_two_vm_spec.rb +19 -0
  13. data/spec/recipes/OneDriver/converge_bootstrap_vm_spec.rb +26 -0
  14. data/spec/recipes/OneDriver/create_back_one_vm_spec.rb +20 -0
  15. data/spec/recipes/OneDriver/create_back_two_vm_spec.rb +20 -0
  16. data/spec/recipes/OneDriver/create_bootstrap_vm_spec.rb +26 -0
  17. data/spec/recipes/OneDriver/create_one_image_spec.rb +23 -0
  18. data/spec/recipes/OneDriver/create_one_template_int_spec.rb +21 -0
  19. data/spec/recipes/OneDriver/create_one_template_spec.rb +21 -0
  20. data/spec/recipes/OneDriver/delete/OpenNebula-back-1-vm.rb +19 -0
  21. data/spec/recipes/OneDriver/delete/OpenNebula-back-2-vm.rb +19 -0
  22. data/spec/recipes/OneDriver/delete/OpenNebula-bootstrap-img.rb +19 -0
  23. data/spec/recipes/OneDriver/delete/OpenNebula-bootstrap-vm.rb +19 -0
  24. data/spec/recipes/OneDriver/delete/OpenNebula-snap-1-img.rb +19 -0
  25. data/spec/recipes/OneDriver/delete/OpenNebula-snap-2-img.rb +19 -0
  26. data/spec/recipes/OneDriver/delete/OpenNebula-test-tpl-ints.rb +19 -0
  27. data/spec/recipes/OneDriver/delete/OpenNebula-test-tpl.rb +19 -0
  28. data/spec/recipes/OneDriver/delete/OpenNebula-tpl-1-vm.rb +19 -0
  29. data/spec/recipes/OneDriver/instantiate_one_template_spec.rb +25 -0
  30. data/spec/recipes/OneDriver/snapshot_one_image_spec.rb +21 -0
  31. data/spec/recipes/OneDriver/snapshot_two_image_spec.rb +21 -0
  32. data/spec/recipes/driver_options_spec.rb +19 -62
  33. data/spec/spec_helper.rb +42 -14
  34. data/spec/support/opennebula_support.rb +69 -34
  35. metadata +27 -17
  36. data/spec/recipes/attach_back_one_vm_spec.rb +0 -20
  37. data/spec/recipes/attach_back_two_vm_spec.rb +0 -20
  38. data/spec/recipes/attach_one_image_spec.rb +0 -20
  39. data/spec/recipes/converge_back_one_vm_spec.rb +0 -19
  40. data/spec/recipes/converge_back_two_vm_spec.rb +0 -19
  41. data/spec/recipes/converge_bootstrap_vm_spec.rb +0 -34
  42. data/spec/recipes/create_back_one_vm_spec.rb +0 -20
  43. data/spec/recipes/create_back_two_vm_spec.rb +0 -20
  44. data/spec/recipes/create_bootstrap_vm_spec.rb +0 -34
  45. data/spec/recipes/create_one_image_spec.rb +0 -21
  46. data/spec/recipes/create_one_template_spec.rb +0 -52
  47. data/spec/recipes/delete_all_spec.rb +0 -47
  48. data/spec/recipes/instantiate_one_template_spec.rb +0 -35
  49. data/spec/recipes/snapshot_one_image_spec.rb +0 -21
  50. data/spec/recipes/snapshot_two_image_spec.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8609a2bdd368fd8004c7451eec93e7f4801cae99
4
- data.tar.gz: bb88358b632d8f75e45ed1d3e6f0719302428499
3
+ metadata.gz: f967f28103c43f8a53e87e54eddd0de8fd1f9af1
4
+ data.tar.gz: cbb861a93ed158a967a661937c9ac3576ad9c66a
5
5
  SHA512:
6
- metadata.gz: 0c6633a838fb95a2d98183088b7e1c64939cf1efd4f5f161937dd74fd46472b4fb4a15ef6127be71ce0a039d3397b3f534b755cfcebbfedb60608fd3327ae31e
7
- data.tar.gz: 6932c9456a158bd2b32a805462b25037f54889399e1941779e8a2f17e08f8846195066701d37a55f46280728519506a687e4d0040113868b556527735d754379
6
+ metadata.gz: 0d755e26ff9c70c4b08615f051d25747d0f9268bf9c14cd2ef62261161a63d759e65d44045a9ec52ee373fd0ed2cb0c39d1eef54fa382570f94d6e205387df94
7
+ data.tar.gz: 4eeb678cf8030a172988142c77ec676ad9ebfc3944a548069f29c6c59398caaf9d7a0b8ca2a0955b00610e82734d6056045afb428dc4f22d217d8798d7573891
data/README.md CHANGED
@@ -3,7 +3,7 @@ chef-provisioning-opennebula
3
3
 
4
4
  This is the implementation of the OpenNebula driver for chef-provisioning. It also comes with additional chef resources to manage OpenNebula:
5
5
 
6
- * Template (one_template)
6
+ * Template (one_template)
7
7
  * Image (one_image)
8
8
  * VNET (one_vnet)
9
9
  * Lease (one_vnet_lease)
@@ -480,17 +480,8 @@ end
480
480
 
481
481
  ## Rspec Integration tests
482
482
 
483
- Run 'bundle exec rspec ./spec/integration/test_all_integration_spec.rb' in your chef-provisioning-opennebula folder
484
-
485
- Set the following environment variables according to your needs:
486
-
487
- ```ruby
488
- ENV['HOME'] - your home directory
489
- ENV['ONE_XMLRPC'] - this is the OpenNebula endpoint url
490
- ENV['ONE_AUTH'] - the path to your one_auth file
491
- ENV['ONE_HTTPBASE'] - the base URL from which files are downloaded eg. chef-client.deb, init.sh, service.gz etc.
492
- ENV['CHEF_REPO_PATH'] - the path to your local chef repo
493
- ```
483
+ - Create and configure `spec/config.rb` from `spec/config_sample.rb`, be sure to **read the comments**
484
+ - Run `bundle exec rspec ./spec/integration/test_all_integration_spec.rb` from your chef-provisioning-opennebula folder
494
485
 
495
486
  ## <a name="development"></a> Development
496
487
 
@@ -513,12 +504,11 @@ Created by [Bogdan Buczynski](https://github.com/bbuczynski) (<pikus1@gmail.com>
513
504
 
514
505
  ## <a name="maintainers"></a> Maintainers
515
506
 
516
- Maintained by
517
- * [Andrew J. Brown](https://github.com/andrewjamesbrown) (<anbrown@blackberry.com>)
518
- * [Bogdan Buczynski](https://github.com/bbuczynski) (<pikus1@gmail.com>)
519
- * [Dongyu 'Gary' Zheng](https://github.com/dongyuzheng) (<garydzheng@gmail.com>)
520
- * [Evgeny Yurchenko](https://github.com/EYurchenko) (<eyurchenko@blackberry.com>)
521
- * [Phil Oliva](https://github.com/poliva83) (<philoliva8@gmail.com>)
507
+ * [Andrew J. Brown](https://github.com/andrewjamesbrown) (<anbrown@blackberry.com>)
508
+ * [Bogdan Buczynski](https://github.com/bbuczynski) (<pikus1@gmail.com>)
509
+ * [Dongyu 'Gary' Zheng](https://github.com/dongyuzheng) (<garydzheng@gmail.com>)
510
+ * [Evgeny Yurchenko](https://github.com/EYurchenko) (<eyurchenko@blackberry.com>)
511
+ * [Phil Oliva](https://github.com/poliva83) (<philoliva8@gmail.com>)
522
512
 
523
513
  ## <a name="license"></a> License
524
514
 
@@ -50,9 +50,11 @@ class Chef
50
50
 
51
51
  return unless @current_resource.exists
52
52
 
53
- new_resource_template = @new_resource.template_file.nil? ?
54
- @new_resource.template :
55
- driver.one.template_from_file(@new_resource.template_file)
53
+ new_resource_template = if @new_resource.template_file.nil?
54
+ convert_types(@new_resource.template)
55
+ else
56
+ driver.one.template_from_file(@new_resource.template_file)
57
+ end
56
58
 
57
59
  @current_id = template.to_hash['VMTEMPLATE']['ID'].to_i
58
60
  @current_resource.template(template.to_hash['VMTEMPLATE']['TEMPLATE'])
@@ -150,6 +152,20 @@ class Chef
150
152
  end
151
153
  end
152
154
 
155
+ def convert_types(hash)
156
+ tpl_str = driver.one.create_template(hash)
157
+ t_hash = nil
158
+ doc = OpenNebula::CustomObject.new(OpenNebula::CustomObject.build_xml, driver.one.client)
159
+ unless OpenNebula.is_error?(doc)
160
+ rc = doc.allocate(tpl_str)
161
+ fail "Failed to allocate OpenNebula document: #{rc.message}" if OpenNebula.is_error?(rc)
162
+ doc.info!
163
+ t_hash = doc.to_hash['DOCUMENT']['TEMPLATE']
164
+ doc.delete
165
+ end
166
+ t_hash
167
+ end
168
+
153
169
  def get_mode(template)
154
170
  perms = template.to_hash['VMTEMPLATE']['PERMISSIONS']
155
171
  mode = 0
@@ -470,10 +470,17 @@ DEV_PREFIX = #{img_config[:prefix]}
470
470
  else
471
471
  comma = (index < count) && level > 0
472
472
  level.times { tpl << " " }
473
- # Escape quotation marks to fix MAND-1394:
474
- # template does not support embedded quotation marks
475
- # Escaping of " only happens if " is not already escaped, preceded by \\
476
- tpl << "#{k} = \"#{v.gsub(/(?<!\\)\"/, '\"')}\"" << (comma ? ",\n" : "\n")
473
+ if v.is_a?(Integer)
474
+ tpl << "#{k} = \"#{v}\""
475
+ elsif v.is_a?(String)
476
+ # Fix for: template does not support embedded quotation marks
477
+ # Escaping of " only happens if " is not already escaped, preceded by \\
478
+ tpl << "#{k} = \"#{v.gsub(/(?<!\\)\"/, '\"')}\""
479
+ else # any other type
480
+ # convert to string and print it
481
+ tpl << "#{k} = \"#{v}\""
482
+ end
483
+ tpl << (comma ? ",\n" : "\n")
477
484
  index += 1
478
485
  end
479
486
  end
@@ -24,7 +24,7 @@ class Chef
24
24
  # Extending module.
25
25
  #
26
26
  module OpenNebulaDriver
27
- VERSION = '0.4.3'
27
+ VERSION = '0.4.4'
28
28
  end
29
29
  end
30
30
  end
@@ -0,0 +1,60 @@
1
+ #######################################################
2
+ ## This is the config file used for the RSpec tests. ##
3
+ ## Feel free to modify any variables to your needs. ##
4
+ #######################################################
5
+
6
+ # this is the OpenNebula endpoint url
7
+ ONE_XMLRPC = 'http://1.2.3.4:443/api:boggi'
8
+
9
+ # the path to your local chef repo, an empty folder would work, if the folder does not exist, one will be automatically created
10
+ CHEF_REPO_PATH = '/home/gary/test-repo'
11
+
12
+ # required for recipes/OneDriver/create_one_image_spec.rb
13
+ DATASTORE_ID = 103
14
+
15
+ VM_TEMPLATE = {
16
+ # the base URL from which files are downloaded eg. chef-client.deb, init.sh, service.gz etc.
17
+ 'HTTPBASE' => 'http://my.server.com',
18
+ # it is highly recommended to keep resources low for these tests
19
+ 'MEMORY' => '256',
20
+ 'CPU' => '1',
21
+ 'VCPU' => '1',
22
+ 'OS' => {
23
+ 'ARCH' => 'x86_64'
24
+ },
25
+ 'DISK' => {
26
+ 'IMAGE' => 'Ubuntu-14.04.1-pre-prod-201411201',
27
+ 'IMAGE_UNAME' => 'my_user',
28
+ 'DRIVER' => 'qcow2'
29
+ },
30
+ 'NIC' => {
31
+ 'NETWORK' => 'my_network',
32
+ 'NETWORK_UNAME' => 'my_network_user'
33
+ },
34
+ 'GRAPHICS' => {
35
+ 'LISTEN' => '0.0.0.0',
36
+ 'TYPE' => 'vnc'
37
+ },
38
+ 'CONTEXT' => {
39
+ 'NETWORK' => 'YES',
40
+ 'HOSTNAME' => '$NAME',
41
+ 'INSTALL_CHEF_CLIENT_COMMAND' => 'dpkg -E -i /mnt/chef-client.deb',
42
+ 'SSH_USERNAME' => 'local',
43
+ 'SSH_PUBLIC_KEY' => File.read("#{ENV['HOME']}/.ssh/id_rsa.pub").strip,
44
+ 'FILES' => '$HTTPBASE/01_chef $HTTPBASE/../chef-client.deb'
45
+ }
46
+ }
47
+
48
+ MACHINE_OPTIONS = {
49
+ :ssh_username => 'local',
50
+ :ssh_options => {
51
+ :keys_only => false,
52
+ :forward_agent => true,
53
+ :use_agent => true,
54
+ :user_known_hosts_file => '/dev/null'
55
+ },
56
+ :ssh_execute_options => {
57
+ :prefix => 'sudo '
58
+ },
59
+ :cached_installer => true
60
+ }
@@ -1,102 +1,287 @@
1
- # Copyright 2015, BlackBerry, Inc.
1
+ # Copyright 2016, BlackBerry, Inc.
2
2
  #
3
- #Licensed under the Apache License, Version 2.0 (the "License");
4
- #you may not use this file except in compliance with the License.
5
- #You may obtain a copy of the License at
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
6
  #
7
7
  # http://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
- #Unless required by applicable law or agreed to in writing, software
10
- #distributed under the License is distributed on an "AS IS" BASIS,
11
- #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- #See the License for the specific language governing permissions and
13
- #limitations under the License.
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
14
 
15
15
  require 'spec_helper'
16
16
  require 'chef/provisioning/opennebula_driver'
17
17
 
18
- describe "create_one_template_spec.rb", :type => :recipe do
19
- it { is_expected.to converge_test_recipe("create_one_template_spec.rb",
20
- "Creating template OpenNebula-test-tpl",
21
- "Template OpenNebula-test-tpl already exists") }
22
- end
18
+ describe 'OneDriver' do
19
+ describe 'create_one_template_spec.rb' do
20
+ test_helper(
21
+ 'create_one_template_spec.rb',
22
+ 'OneDriver/create_one_template_spec.rb',
23
+ "create template 'OpenNebula-test-tpl'"
24
+ )
25
+ end
23
26
 
24
- describe "instantiate_one_template_spec.rb", :type => :recipe do
25
- it { is_expected.to converge_test_recipe("instantiate_one_template_spec.rb",
26
- "Creating instances from template",
27
- "Instance with name 'OpenNebula-test-1-vm' already exists") }
28
- end
27
+ describe 'create_one_template_int_spec.rb' do
28
+ test_helper(
29
+ 'create_one_template_int_spec.rb',
30
+ 'OneDriver/create_one_template_int_spec.rb',
31
+ "create template 'OpenNebula-test-tpl-ints'"
32
+ )
33
+ end
29
34
 
30
- describe "create_bootstrap_vm_spec.rb", :type => :recipe do
31
- it { is_expected.to converge_test_recipe("create_bootstrap_vm_spec.rb",
32
- "Creating VM OpenNebula-bootstrap-vm",
33
- "VM OpenNebula-bootstrap-vm exists. Rebooting...") }
34
- end
35
+ describe 'instantiate_one_template_spec.rb' do
36
+ it do
37
+ is_expected.to converge_test_recipe(
38
+ 'OneDriver/instantiate_one_template_spec.rb',
39
+ "created vm 'OpenNebula-tpl-1-vm'"
40
+ )
41
+ end
42
+ end
35
43
 
36
- describe "create_one_image_spec.rb", :type => :recipe do
37
- it { is_expected.to converge_test_recipe("create_one_image_spec.rb",
38
- "Waiting for image 'OpenNebula-bootstrap-img' to be READY",
39
- "Image 'OpenNebula-bootstrap-img' is already in READY state") }
40
- end
44
+ describe 'create_bootstrap_vm_spec.rb' do
45
+ it do
46
+ is_expected.to converge_test_recipe(
47
+ 'OneDriver/create_bootstrap_vm_spec.rb',
48
+ "created vm 'OpenNebula-bootstrap-vm'"
49
+ )
50
+ end
51
+ end
41
52
 
42
- describe "attach_one_image_spec.rb", :type => :recipe do
43
- it { is_expected.to converge_test_recipe("attach_one_image_spec.rb",
44
- "Disk not attached. Attaching...",
45
- "Disk is already attached") }
46
- end
53
+ describe 'create_one_image_spec.rb' do
54
+ it do
55
+ is_expected.to converge_test_recipe(
56
+ 'OneDriver/create_one_image_spec.rb',
57
+ /allocated image 'OpenNebula-bootstrap-img'.*?wait for image 'OpenNebula-bootstrap-img' to be READY/m
58
+ )
59
+ end
60
+ end
61
+ describe 'create_one_image_spec.rb' do
62
+ it do
63
+ is_expected.to converge_test_recipe(
64
+ 'OneDriver/create_one_image_spec.rb',
65
+ /image 'OpenNebula-bootstrap-img' already exists - nothing to do.*?image 'OpenNebula-bootstrap-img' is already in READY state - nothing to do/m
66
+ )
67
+ end
68
+ end
47
69
 
48
- describe "snapshot_one_image_spec.rb", :type => :recipe do
49
- it { is_expected.to converge_test_recipe("snapshot_one_image_spec.rb",
50
- "Creating snapshot from 'OpenNebula-bootstrap-vm'",
51
- "Snapshot image 'OpenNebula-snap-1-img' already exists") }
52
- end
70
+ describe 'attach_one_image_spec.rb' do
71
+ it do
72
+ is_expected.to converge_test_recipe(
73
+ 'OneDriver/attach_one_image_spec.rb',
74
+ /disk not attached, attaching.*?attached disk OpenNebula-bootstrap-img to OpenNebula-bootstrap-vm/m
75
+ )
76
+ end
77
+ end
78
+ describe 'attach_one_image_spec.rb' do
79
+ it do
80
+ is_expected.to converge_test_recipe(
81
+ 'OneDriver/attach_one_image_spec.rb',
82
+ /disk is already attached.*?attached disk OpenNebula-bootstrap-img to OpenNebula-bootstrap-vm/m
83
+ )
84
+ end
85
+ end
53
86
 
54
- describe "converge_bootstrap_vm_spec.rb", :type => :recipe do
55
- it { is_expected.to converge_test_recipe("converge_bootstrap_vm_spec.rb") }
56
- end
87
+ describe 'snapshot_one_image_spec.rb' do
88
+ it do
89
+ is_expected.to converge_test_recipe(
90
+ 'OneDriver/snapshot_one_image_spec.rb',
91
+ "created snapshot from 'OpenNebula-bootstrap-vm'"
92
+ )
93
+ end
94
+ end
57
95
 
58
- # deploys two test backend VM's
59
- describe "snapshot_two_image_spec.rb", :type => :recipe do
60
- it { is_expected.to converge_test_recipe("snapshot_two_image_spec.rb",
61
- "Creating snapshot from 'OpenNebula-bootstrap-vm'",
62
- "Snapshot image 'OpenNebula-snap-1-img' already exists") }
63
- end
96
+ describe 'converge_bootstrap_vm_spec.rb' do
97
+ it do
98
+ is_expected.to converge_test_recipe(
99
+ 'OneDriver/converge_bootstrap_vm_spec.rb',
100
+ /vm 'OpenNebula-bootstrap-vm' is ready.*?create client OpenNebula-bootstrap-vm at clients.*?run 'chef-client -l info' on OpenNebula-bootstrap-vm/m
101
+ )
102
+ end
103
+ end
64
104
 
65
- describe "create_back_one_vm_spec.rb", :type => :recipe do
66
- it { is_expected.to converge_test_recipe("create_back_one_vm_spec.rb",
67
- "Creating VM OpenNebula-back-1-vm",
68
- "VM OpenNebula-back-1-vm exists. Rebooting...") }
69
- end
105
+ # deploys two test backend VM's
106
+ describe 'snapshot_two_image_spec.rb' do
107
+ it do
108
+ is_expected.to converge_test_recipe(
109
+ 'OneDriver/snapshot_two_image_spec.rb',
110
+ "created snapshot from 'OpenNebula-bootstrap-vm'"
111
+ )
112
+ end
113
+ end
70
114
 
71
- describe "attach_back_one_vm_spec.rb", :type => :recipe do
72
- it { is_expected.to converge_test_recipe("attach_back_one_vm_spec.rb",
73
- "Disk not attached. Attaching...",
74
- "Disk is already attached") }
75
- end
115
+ describe 'create_back_one_vm_spec.rb' do
116
+ it do
117
+ is_expected.to converge_test_recipe(
118
+ 'OneDriver/create_back_one_vm_spec.rb',
119
+ /created vm 'OpenNebula-back-1-vm'.*?create node OpenNebula-back-1-vm.*?vm 'OpenNebula-back-1-vm' is ready.*?update node OpenNebula-back-1-vm/m
120
+ )
121
+ end
122
+ end
76
123
 
77
- describe "converge_back_one_vm_spec.rb", :type => :recipe do
78
- it { is_expected.to converge_test_recipe("converge_back_one_vm_spec.rb") }
79
- end
124
+ describe 'attach_back_one_vm_spec.rb' do
125
+ it do
126
+ is_expected.to converge_test_recipe(
127
+ 'OneDriver/attach_back_one_vm_spec.rb',
128
+ /disk not attached, attaching.*?attached disk OpenNebula-snap-1-img to OpenNebula-back-1-vm/m
129
+ )
130
+ end
131
+ end
132
+ describe 'attach_back_one_vm_spec.rb' do
133
+ it do
134
+ is_expected.to converge_test_recipe(
135
+ 'OneDriver/attach_back_one_vm_spec.rb',
136
+ /disk is already attached.*?attached disk OpenNebula-snap-1-img to OpenNebula-back-1-vm/m
137
+ )
138
+ end
139
+ end
80
140
 
81
- describe "create_back_two_vm_spec.rb", :type => :recipe do
82
- it { is_expected.to converge_test_recipe("create_back_two_vm_spec.rb",
83
- "Creating VM OpenNebula-back-2-vm",
84
- "VM OpenNebula-back-2-vm exists. Rebooting...") }
85
- end
141
+ describe 'converge_back_one_vm_spec.rb' do
142
+ it do
143
+ is_expected.to converge_test_recipe(
144
+ 'OneDriver/converge_back_one_vm_spec.rb',
145
+ /vm 'OpenNebula-back-1-vm' is ready.*?create client OpenNebula-back-1-vm at clients.*?run 'chef-client -l info' on OpenNebula-back-1-vm/m
146
+ )
147
+ end
148
+ end
86
149
 
87
- describe "attach_back_two_vm_spec.rb", :type => :recipe do
88
- it { is_expected.to converge_test_recipe("attach_back_two_vm_spec.rb",
89
- "Disk not attached. Attaching...",
90
- "Disk is already attached") }
91
- end
150
+ describe 'create_back_two_vm_spec.rb' do
151
+ it do
152
+ is_expected.to converge_test_recipe(
153
+ 'OneDriver/create_back_two_vm_spec.rb',
154
+ /created vm 'OpenNebula-back-2-vm'.*?create node OpenNebula-back-2-vm.*?vm 'OpenNebula-back-2-vm' is ready.*?update node OpenNebula-back-2-vm/m
155
+ )
156
+ end
157
+ end
92
158
 
93
- describe "converge_back_two_vm_spec.rb", :type => :recipe do
94
- it { is_expected.to converge_test_recipe("converge_back_two_vm_spec.rb") }
95
- end
159
+ describe 'attach_back_two_vm_spec.rb' do
160
+ it do
161
+ is_expected.to converge_test_recipe(
162
+ 'OneDriver/attach_back_two_vm_spec.rb',
163
+ /disk not attached, attaching.*?attached disk OpenNebula-snap-2-img to OpenNebula-back-2-vm/m
164
+ )
165
+ end
166
+ end
167
+ describe 'attach_back_two_vm_spec.rb' do
168
+ it do
169
+ is_expected.to converge_test_recipe(
170
+ 'OneDriver/attach_back_two_vm_spec.rb',
171
+ /disk is already attached.*?attached disk OpenNebula-snap-2-img to OpenNebula-back-2-vm/m
172
+ )
173
+ end
174
+ end
175
+
176
+ describe 'converge_back_two_vm_spec.rb' do
177
+ it do
178
+ is_expected.to converge_test_recipe(
179
+ 'OneDriver/converge_back_two_vm_spec.rb',
180
+ /vm 'OpenNebula-back-2-vm' is ready.*?create client OpenNebula-back-2-vm at clients.*?run 'chef-client -l info' on OpenNebula-back-2-vm/m
181
+ )
182
+ end
183
+ end
184
+
185
+ #############
186
+ ## CLEANUP ##
187
+ #############
188
+
189
+ describe 'delete OpenNebula-test-tpl' do
190
+ test_helper(
191
+ 'delete OpenNebula-test-tpl',
192
+ 'OneDriver/delete/OpenNebula-test-tpl.rb',
193
+ "delete template 'OpenNebula-test-tpl'"
194
+ )
195
+ end
196
+
197
+ describe 'delete OpenNebula-test-tpl-ints' do
198
+ test_helper(
199
+ 'delete OpenNebula-test-tpl-ints',
200
+ 'OneDriver/delete/OpenNebula-test-tpl-ints.rb',
201
+ "delete template 'OpenNebula-test-tpl-ints'"
202
+ )
203
+ end
204
+
205
+ describe 'delete OpenNebula-tpl-1-vm' do
206
+ test_helper(
207
+ 'delete OpenNebula-tpl-1-vm',
208
+ 'OneDriver/delete/OpenNebula-tpl-1-vm.rb',
209
+ /destroyed machine OpenNebula-tpl-1-vm.*?delete node OpenNebula-tpl-1-vm.*?delete client OpenNebula-tpl-1-vm at clients/m
210
+ )
211
+ end
212
+
213
+ describe 'delete OpenNebula-bootstrap-vm' do
214
+ test_helper(
215
+ 'delete OpenNebula-bootstrap-vm',
216
+ 'OneDriver/delete/OpenNebula-bootstrap-vm.rb',
217
+ /destroyed machine OpenNebula-bootstrap-vm.*?delete node OpenNebula-bootstrap-vm.*?delete client OpenNebula-bootstrap-vm at clients/m
218
+ )
219
+ end
220
+
221
+ describe 'delete OpenNebula-bootstrap-img' do
222
+ it do
223
+ is_expected.to converge_test_recipe(
224
+ 'OneDriver/delete/OpenNebula-bootstrap-img.rb',
225
+ "deleted image 'OpenNebula-bootstrap-img'"
226
+ )
227
+ end
228
+ end
229
+ describe 'delete OpenNebula-bootstrap-img' do
230
+ it do
231
+ is_expected.to converge_test_recipe(
232
+ 'OneDriver/delete/OpenNebula-bootstrap-img.rb',
233
+ "image 'OpenNebula-bootstrap-img' does not exist - nothing to do"
234
+ )
235
+ end
236
+ end
237
+
238
+ describe 'delete OpenNebula-back-1-vm' do
239
+ test_helper(
240
+ 'delete OpenNebula-back-1-vm',
241
+ 'OneDriver/delete/OpenNebula-back-1-vm.rb',
242
+ /destroyed machine OpenNebula-back-1-vm.*?delete node OpenNebula-back-1-vm.*?delete client OpenNebula-back-1-vm at clients/m
243
+ )
244
+ end
245
+
246
+ describe 'delete OpenNebula-back-2-vm' do
247
+ test_helper(
248
+ 'delete OpenNebula-back-2-vm',
249
+ 'OneDriver/delete/OpenNebula-back-2-vm.rb',
250
+ /destroyed machine OpenNebula-back-2-vm.*?delete node OpenNebula-back-2-vm.*?delete client OpenNebula-back-2-vm at clients/m
251
+ )
252
+ end
253
+
254
+ describe 'delete OpenNebula-snap-1-img' do
255
+ it do
256
+ is_expected.to converge_test_recipe(
257
+ 'OneDriver/delete/OpenNebula-snap-1-img.rb',
258
+ "deleted image 'OpenNebula-snap-1-img'"
259
+ )
260
+ end
261
+ end
262
+ describe 'delete OpenNebula-snap-1-img' do
263
+ it do
264
+ is_expected.to converge_test_recipe(
265
+ 'OneDriver/delete/OpenNebula-snap-1-img.rb',
266
+ "image 'OpenNebula-snap-1-img' does not exist - nothing to do"
267
+ )
268
+ end
269
+ end
96
270
 
97
- # cleans up all test VMs/templates/images after testing
98
- # assuming all other tests work as intended, this test will pass
99
- # in the event a previous test failed, this test will also fail
100
- describe "delete_all_spec.rb", :type => :recipe do
101
- it { is_expected.to converge_test_recipe("delete_all_spec.rb", nil, "does not exist") }
271
+ describe 'delete OpenNebula-snap-2-img' do
272
+ it do
273
+ is_expected.to converge_test_recipe(
274
+ 'OneDriver/delete/OpenNebula-snap-2-img.rb',
275
+ "deleted image 'OpenNebula-snap-2-img'"
276
+ )
277
+ end
278
+ end
279
+ describe 'delete OpenNebula-snap-2-img' do
280
+ it do
281
+ is_expected.to converge_test_recipe(
282
+ 'OneDriver/delete/OpenNebula-snap-2-img.rb',
283
+ "image 'OpenNebula-snap-2-img' does not exist - nothing to do"
284
+ )
285
+ end
286
+ end
102
287
  end