chef-provisioning-opennebula 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -3
  3. data/lib/chef/provisioning/opennebula_driver/driver.rb +7 -1
  4. data/lib/chef/provisioning/opennebula_driver/version.rb +1 -1
  5. data/spec/config_sample.rb +19 -18
  6. data/spec/integration/one_driver_spec.rb +84 -0
  7. data/spec/integration/one_flow_spec.rb +340 -0
  8. data/spec/recipes/OneDriver/{instantiate_one_template_vnet.rb → allocate_one_vm.rb} +6 -4
  9. data/spec/recipes/OneDriver/attach_one_image.rb +2 -2
  10. data/spec/recipes/OneDriver/converge_one_vm.rb +17 -0
  11. data/spec/recipes/OneDriver/create_one_image.rb +1 -1
  12. data/spec/recipes/OneDriver/create_one_template.rb +18 -0
  13. data/spec/recipes/OneDriver/create_one_vnet.rb +2 -2
  14. data/spec/recipes/OneDriver/{delete/OpenNebula-test-vm.rb → delete_one_img.rb} +1 -1
  15. data/spec/recipes/OneDriver/{delete/OpenNebula-test-img.rb → delete_one_snap-img.rb} +1 -1
  16. data/spec/recipes/{OneFlowService/delete/test_role_action.rb → OneDriver/delete_one_template.rb} +1 -1
  17. data/spec/recipes/OneDriver/{delete/OpenNebula-test-vm-vnet.rb → delete_one_vm.rb} +1 -1
  18. data/spec/recipes/OneDriver/{delete/OpenNebula-test-vnet.rb → delete_one_vnet.rb} +1 -1
  19. data/spec/recipes/OneDriver/ready_one_vm.rb +17 -0
  20. data/spec/recipes/OneDriver/snapshot_one_image.rb +3 -3
  21. data/spec/recipes/OneDriver/update_one_template.rb +20 -0
  22. data/spec/recipes/{OneFlowTemplate/create_branch_from_one_id.rb → OneFlow/branch_json_template_by_id.rb} +6 -6
  23. data/spec/recipes/OneFlow/branch_json_template_by_name.rb +42 -0
  24. data/spec/recipes/{OneFlowTemplate/chmod_simple_from_hash.rb → OneFlow/chmod_file_template.rb} +1 -1
  25. data/spec/recipes/{OneFlowService/chmod_simple_by_name_2.rb → OneFlow/chmod_json_service_by_id.rb} +2 -2
  26. data/spec/recipes/{OneFlowService/instance_simple_by_name.rb → OneFlow/chmod_json_service_by_name.rb} +2 -2
  27. data/spec/recipes/{OneDriver/delete/OpenNebula-test-snap-img.rb → OneFlow/chmod_json_template.rb} +2 -2
  28. data/spec/recipes/OneFlow/create_file_template.rb +18 -0
  29. data/spec/recipes/{OneFlowTemplate/create_tpl_opts_from_hash.rb → OneFlow/create_file_template_with_opts.rb} +8 -11
  30. data/spec/recipes/OneFlow/create_http_template.rb +17 -0
  31. data/spec/recipes/{OneFlowService/instance_simple_by_id.rb → OneFlow/create_json_service_by_id.rb} +4 -2
  32. data/spec/recipes/{OneFlowService/chmod_simple_by_name.rb → OneFlow/create_json_service_by_name.rb} +2 -2
  33. data/spec/recipes/{OneFlowService/instance_tpl_opts.rb → OneFlow/create_json_service_with_opts.rb} +8 -6
  34. data/spec/recipes/{OneFlowTemplate/create_simple_from_hash.rb → OneFlow/create_json_template.rb} +4 -3
  35. data/spec/recipes/{OneFlowTemplate/create_tpl_opts_from_file.rb → OneFlow/create_json_template_with_opts.rb} +15 -7
  36. data/spec/recipes/{OneFlowService/instance_role_action.rb → OneFlow/create_role_action_service.rb} +8 -8
  37. data/spec/recipes/OneFlow/create_role_action_template.rb +89 -0
  38. data/spec/recipes/OneFlow/delete_branched_template_by_id.rb +17 -0
  39. data/spec/recipes/OneFlow/delete_branched_template_by_name.rb +17 -0
  40. data/spec/recipes/{OneDriver/delete/OpenNebula-test-tpl-strings.rb → OneFlow/delete_file_template.rb} +1 -1
  41. data/spec/recipes/OneFlow/delete_file_template_with_opts.rb +17 -0
  42. data/spec/recipes/{OneDriver/delete/OpenNebula-test-tpl-ints.rb → OneFlow/delete_http_template.rb} +1 -1
  43. data/spec/recipes/{OneDriver/delete/OpenNebula-test-tpl-mix.rb → OneFlow/delete_json_service_by_id.rb} +1 -1
  44. data/spec/recipes/OneFlow/delete_json_service_by_name.rb +17 -0
  45. data/spec/recipes/OneFlow/delete_json_service_with_opts.rb +17 -0
  46. data/spec/recipes/OneFlow/delete_json_template.rb +17 -0
  47. data/spec/recipes/OneFlow/delete_json_template_with_opts.rb +17 -0
  48. data/spec/recipes/OneFlow/delete_role_action_service.rb +17 -0
  49. data/spec/recipes/OneFlow/delete_role_action_template.rb +17 -0
  50. data/spec/recipes/{OneFlowService/action/boot.rb → OneFlow/service_action_boot.rb} +4 -3
  51. data/spec/recipes/OneFlow/service_action_delete.rb +18 -0
  52. data/spec/recipes/{OneFlowService/action/delete_recreate.rb → OneFlow/service_action_delete_recreate.rb} +2 -2
  53. data/spec/recipes/{OneFlowService/action/hold.rb → OneFlow/service_action_hold.rb} +4 -3
  54. data/spec/recipes/{OneFlowService/action/poweroff.rb → OneFlow/service_action_poweroff.rb} +2 -2
  55. data/spec/recipes/{OneFlowService/action/poweroff_hard.rb → OneFlow/service_action_poweroff_hard.rb} +2 -2
  56. data/spec/recipes/{OneFlowService/action/reboot.rb → OneFlow/service_action_reboot.rb} +2 -2
  57. data/spec/recipes/{OneFlowService/action/reboot_hard.rb → OneFlow/service_action_reboot_hard.rb} +2 -2
  58. data/spec/recipes/{OneFlowService/action/release.rb → OneFlow/service_action_release.rb} +4 -3
  59. data/spec/recipes/OneFlow/service_action_resume_poweroff.rb +18 -0
  60. data/spec/recipes/OneFlow/service_action_resume_poweroff_hard.rb +18 -0
  61. data/spec/recipes/{OneFlowService/action/resume.rb → OneFlow/service_action_resume_stop.rb} +2 -2
  62. data/spec/recipes/OneFlow/service_action_resume_suspend.rb +18 -0
  63. data/spec/recipes/OneFlow/service_action_resume_undeploy.rb +18 -0
  64. data/spec/recipes/OneFlow/service_action_resume_undeploy_hard.rb +18 -0
  65. data/spec/recipes/{OneFlowService/action/scale.rb → OneFlow/service_action_scale.rb} +2 -2
  66. data/spec/recipes/{OneFlowService/action/shutdown.rb → OneFlow/service_action_shutdown.rb} +2 -2
  67. data/spec/recipes/{OneFlowService/action/shutdown_hard.rb → OneFlow/service_action_shutdown_hard.rb} +2 -2
  68. data/spec/recipes/{OneFlowService/action/snapshot_create.rb → OneFlow/service_action_snapshot_create.rb} +2 -2
  69. data/spec/recipes/{OneFlowService/action/stop.rb → OneFlow/service_action_stop.rb} +2 -2
  70. data/spec/recipes/{OneFlowService/action/suspend.rb → OneFlow/service_action_suspend.rb} +2 -2
  71. data/spec/recipes/{OneFlowService/action/undeploy.rb → OneFlow/service_action_undeploy.rb} +2 -2
  72. data/spec/recipes/{OneFlowService/action/undeploy_hard.rb → OneFlow/service_action_undeploy_hard.rb} +2 -2
  73. data/spec/recipes/{OneFlowService/action/shutdown_service.rb → OneFlow/shutdown_role_action_service.rb} +1 -1
  74. data/spec/recipes/{OneFlowTemplate/update_simple_from_hash.rb → OneFlow/update_json_template.rb} +17 -14
  75. data/spec/recipes/common.rb +0 -2
  76. data/spec/spec_helper.rb +97 -42
  77. metadata +86 -89
  78. data/spec/integration/test_all_integration_spec.rb +0 -21
  79. data/spec/integration/test_one_driver.rb +0 -177
  80. data/spec/integration/test_one_flow.rb +0 -546
  81. data/spec/recipes/OneDriver/allocate_change_profile.rb +0 -23
  82. data/spec/recipes/OneDriver/create_one_template_ints.rb +0 -38
  83. data/spec/recipes/OneDriver/create_one_template_mix.rb +0 -51
  84. data/spec/recipes/OneDriver/create_one_template_strings.rb +0 -34
  85. data/spec/recipes/OneDriver/instantiate_one_template.rb +0 -21
  86. data/spec/recipes/OneFlowService/action/delete.rb +0 -18
  87. data/spec/recipes/OneFlowService/chmod_tpl_opts.rb +0 -31
  88. data/spec/recipes/OneFlowService/delete/test_instance_template_options.rb +0 -17
  89. data/spec/recipes/OneFlowService/delete/test_simple_instance.rb +0 -17
  90. data/spec/recipes/OneFlowService/delete/test_simple_instance_by_id.rb +0 -17
  91. data/spec/recipes/OneFlowTemplate/chmod_update_simple_from_file.rb +0 -19
  92. data/spec/recipes/OneFlowTemplate/create_branch_from_one_name.rb +0 -20
  93. data/spec/recipes/OneFlowTemplate/create_role_action_instance.rb +0 -99
  94. data/spec/recipes/OneFlowTemplate/create_simple_from_file.rb +0 -18
  95. data/spec/recipes/OneFlowTemplate/create_simple_from_web.rb +0 -17
  96. data/spec/recipes/OneFlowTemplate/create_simple_instance_tpl.rb +0 -22
  97. data/spec/recipes/OneFlowTemplate/delete/branch_from_one_id.rb +0 -17
  98. data/spec/recipes/OneFlowTemplate/delete/branch_from_one_name.rb +0 -17
  99. data/spec/recipes/OneFlowTemplate/delete/role_action_instance.rb +0 -17
  100. data/spec/recipes/OneFlowTemplate/delete/simple_from_file.rb +0 -17
  101. data/spec/recipes/OneFlowTemplate/delete/simple_from_hash.rb +0 -17
  102. data/spec/recipes/OneFlowTemplate/delete/simple_from_web.rb +0 -17
  103. data/spec/recipes/OneFlowTemplate/delete/simple_instance_tpl.rb +0 -17
  104. data/spec/recipes/OneFlowTemplate/delete/tpl_opts_from_file.rb +0 -17
  105. data/spec/recipes/OneFlowTemplate/delete/tpl_opts_from_hash.rb +0 -17
  106. data/spec/support/opennebula_support.rb +0 -129
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 798eb6e4b57c623beb0ae99b82260ddcd73e31be
4
- data.tar.gz: 04bcf4eb734161c936cbfbd3a47c07ab1bb4f9d3
3
+ metadata.gz: 97b6c35107c1fcf3eb3f1714f1a84baff0ce0e32
4
+ data.tar.gz: 7441c00e0fbb8a7d11d0131f9aee244935afbfd2
5
5
  SHA512:
6
- metadata.gz: d24fd26f66e346ac1049f4c5b36c3197402629cc5a7906caf789ffcfd6514b176e9d36af65a2b47b97ab125255975533f7efb9f5fc199c71cf13509bd8d65d3a
7
- data.tar.gz: ce67ffb81da9cddb2dce49b5af2909562c870ecce4b5833fd7543883e0b9b85055498fc266d0458baa3979d3e667892bf4adc6231723315f59190e6556de226b
6
+ metadata.gz: be230ee76f579f79f259aaab07491bd168ae9c832cac374d1dfbdc07693e9791f7939e0397c5efe5df2e0a9796a3ff689329a2424c4905514fe3f943d7d5df8f
7
+ data.tar.gz: e0487cc227c47dc17440474588ae1c9392197a37b1980142d646dfd936ea6dca5092d4fd7ef8df746bd72455f8ff28e8486faec84d40cf68ed5521ecd835a551
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'bundler'
2
2
  require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
3
4
 
4
- task :spec do
5
- require File.expand_path('spec/run')
6
- end
5
+ RSpec::Core::RakeTask.new(:spec)
@@ -84,13 +84,19 @@ class Chef
84
84
  fail server_version unless server_version =~ /^\d+\.\d+(?:\.\d+)?$/
85
85
  begin
86
86
  gem 'opennebula', "~> #{server_version}"
87
+ rescue Gem::MissingSpecVersionError => e
88
+ Chef::Log.fatal("Gem not installed: opennebula #{server_version}")
89
+ raise e
90
+ end
91
+ begin
87
92
  require 'opennebula'
88
93
  rescue Gem::LoadError => e
89
94
  e_inspect = e.inspect
90
95
  unless e_inspect.include?('already activated')
91
96
  info_out, info_err = Open3.capture2e("gem environment")
92
97
  Chef::Log.fatal("Please check your environment settings")
93
- Chef::Log.fatal(info_out + "\n" + info_err)
98
+ Chef::Log.fatal("OnenNebula server API version #{server_version}")
99
+ Chef::Log.fatal(info_out.to_s + "\n" + info_err.to_s)
94
100
  raise e
95
101
  end
96
102
  end
@@ -24,7 +24,7 @@ class Chef
24
24
  # Extending module.
25
25
  #
26
26
  module OpenNebulaDriver
27
- VERSION = '0.4.8'.freeze
27
+ VERSION = '0.4.9'.freeze
28
28
  end
29
29
  end
30
30
  end
@@ -4,41 +4,38 @@
4
4
  #######################################################
5
5
 
6
6
  # your driver url, opennebula:<endpoint_url>:<profile>
7
- DRIVER_URL = 'opennebula:http://1.2.3.4:443/api:boggi'
8
-
9
- # test for profile moving, set nil to skip
10
- DRIVER_URL_2 = 'opennebula:http://1.2.3.4:443/api:gary'
7
+ DRIVER_URL = 'opennebula:http://api.opennebula/api:oneuser'
11
8
 
12
9
  # set this to nil if you do not want to test OneFlow
13
- ONE_FLOW_URL = 'http://gary.1.2.3.4:9876'
10
+ ONE_FLOW_URL = 'http://api.oneflow:2474'
14
11
 
15
12
  # the path to your local chef repo, an empty folder would work, if the folder does not exist, one will be automatically created
16
- CHEF_REPO_PATH = '/home/gary/test-repo'
13
+ CHEF_REPO_PATH = "#{ENV['HOME']}/test-repo"
17
14
 
18
15
  # required for recipes involving allocating datablocks
19
- DATASTORE_ID = 103
16
+ DATASTORE_ID = 123
20
17
 
21
18
  # required for recipes involving allocating vnets
22
- VNET_ID = 394
19
+ VNET_ID = 321
23
20
 
24
21
  VM_TEMPLATE = {
25
22
  # the base URL from which files are downloaded eg. chef-client.deb, init.sh, service.gz etc.
26
- 'HTTPBASE' => 'http://my.server.com',
23
+ 'HTTPBASE' => 'http://cli.opennebula/~oneuser',
27
24
  # it is highly recommended to keep resources low for these tests
28
- 'MEMORY' => '256',
25
+ 'MEMORY' => '1024',
29
26
  'CPU' => '1',
30
27
  'VCPU' => '1',
31
28
  'OS' => {
32
29
  'ARCH' => 'x86_64'
33
30
  },
34
31
  'DISK' => {
35
- 'IMAGE' => 'Ubuntu-14.04.1-pre-prod-201411201',
36
- 'IMAGE_UNAME' => 'my_user',
32
+ 'IMAGE' => 'Ubuntu-16.04-2017.10.10-b46',
33
+ 'IMAGE_UNAME' => 'oneuser',
37
34
  'DRIVER' => 'qcow2'
38
35
  },
39
36
  'NIC' => {
40
- 'NETWORK' => 'my_network',
41
- 'NETWORK_UNAME' => 'my_network_user'
37
+ 'NETWORK' => 'oneadmin-public-vnet',
38
+ 'NETWORK_UNAME' => 'oneadmin'
42
39
  },
43
40
  'GRAPHICS' => {
44
41
  'LISTEN' => '0.0.0.0',
@@ -47,10 +44,10 @@ VM_TEMPLATE = {
47
44
  'CONTEXT' => {
48
45
  'NETWORK' => 'YES',
49
46
  'HOSTNAME' => '$NAME',
50
- 'INSTALL_CHEF_CLIENT_COMMAND' => 'dpkg -E -i /mnt/chef-client.deb',
51
47
  'SSH_USERNAME' => 'local',
52
48
  'SSH_PUBLIC_KEY' => File.read("#{ENV['HOME']}/.ssh/id_rsa.pub").strip,
53
- 'FILES' => '$HTTPBASE/01_chef $HTTPBASE/../chef-client.deb'
49
+ 'INSTALL_CHEF_CLIENT_COMMAND' => 'dpkg -E -i /mnt/chef_12.21.4-1_amd64.deb',
50
+ 'FILES' => '$HTTPBASE/context/init.sh $HTTPBASE/chef_12.21.4-1_amd64.deb'
54
51
  }
55
52
  }
56
53
 
@@ -62,8 +59,12 @@ MACHINE_OPTIONS = {
62
59
  :use_agent => true,
63
60
  :user_known_hosts_file => '/dev/null'
64
61
  },
65
- :ssh_execute_options => {
66
- :prefix => 'sudo '
62
+ :convergence_options => {
63
+ :chef_version => '12.21.4'
67
64
  },
65
+ :sudo => true,
68
66
  :cached_installer => true
69
67
  }
68
+
69
+ # download URL for JSON template file
70
+ JSON_TEMPLATE_URL = 'http://cli.opennebula/~oneuser/RSpec-flow-http-template.json'
@@ -0,0 +1,84 @@
1
+ # Copyright 2016, BlackBerry Limited
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
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
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.
14
+
15
+ describe 'OneDriver/create_one_template.rb' do
16
+ it { is_expected.to converge_with_result(/create template 'RSpec-test-template'/) }
17
+ it { is_expected.to converge_with_result(/(up to date)/) }
18
+ end
19
+
20
+ describe 'OneDriver/update_one_template.rb' do
21
+ it { is_expected.to converge_with_result(/update template content on 'RSpec-test-template'/) }
22
+ it { is_expected.to converge_with_result(/(up to date)/) }
23
+ end
24
+
25
+ describe 'OneDriver/create_one_vnet.rb' do
26
+ it { is_expected.to converge_with_result(/reserved vnet 'RSpec-test-vnet'/) }
27
+ it { is_expected.to converge_with_result(/vnet 'RSpec-test-vnet' already exists/) }
28
+ end
29
+
30
+ describe 'OneDriver/allocate_one_vm.rb' do
31
+ it { is_expected.to converge_with_result(/created vm 'RSpec-test-vm'/,
32
+ /create node RSpec-test-vm/) }
33
+ end
34
+
35
+ describe 'OneDriver/ready_one_vm.rb' do
36
+ it { is_expected.to converge_with_result(/vm 'RSpec-test-vm' is ready/,
37
+ /update node RSpec-test-vm/) }
38
+ end
39
+
40
+ describe 'OneDriver/converge_one_vm.rb' do
41
+ it { is_expected.to converge_with_result(/vm 'RSpec-test-vm' is ready/,
42
+ /generate private key/,
43
+ /write file \/etc\/chef\/client.pem on RSpec-test-vm/,
44
+ /create client RSpec-test-vm at clients/,
45
+ /write file \/etc\/chef\/client.rb on RSpec-test-vm/,
46
+ /run 'chef-client -c \/etc\/chef\/client.rb -l info' on RSpec-test-vm/) }
47
+ end
48
+
49
+ describe 'OneDriver/create_one_image.rb' do
50
+ it { is_expected.to converge_with_result(/allocated image 'RSpec-test-img'/,
51
+ /wait for image 'RSpec-test-img' to be READY/) }
52
+ end
53
+
54
+ describe 'OneDriver/attach_one_image.rb' do
55
+ it { is_expected.to converge_with_result(/disk not attached, attaching/,
56
+ /attached disk RSpec-test-img to RSpec-test-vm/) }
57
+ end
58
+
59
+ describe 'OneDriver/snapshot_one_image.rb' do
60
+ it { is_expected.to converge_with_result(/created snapshot from 'RSpec-test-vm'/) }
61
+ it { is_expected.not_to converge_with_result(/snapshot 'RSpec-test-snap-img' already exists/) }
62
+ end
63
+
64
+ describe 'OneDriver/delete_one_snap-img.rb' do
65
+ it { is_expected.to converge_with_result(/deleted image 'RSpec-test-snap-img'/) }
66
+ end
67
+
68
+ describe 'OneDriver/delete_one_vm.rb' do
69
+ it { is_expected.to converge_with_result(/destroyed machine RSpec-test-vm/,
70
+ /delete node RSpec-test-vm/,
71
+ /delete client RSpec-test-vm/) }
72
+ end
73
+
74
+ describe 'OneDriver/delete_one_template.rb' do
75
+ it { is_expected.to converge_with_result(/delete template 'RSpec-test-template'/) }
76
+ end
77
+
78
+ describe 'OneDriver/delete_one_img.rb' do
79
+ it { is_expected.to converge_with_result(/deleted image 'RSpec-test-img'/) }
80
+ end
81
+
82
+ describe 'OneDriver/delete_one_vnet.rb' do
83
+ it { is_expected.to converge_with_result(/deleted vnet 'RSpec-test-vnet'/) }
84
+ end
@@ -0,0 +1,340 @@
1
+ # Copyright 2016, BlackBerry Limited
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
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
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.
14
+
15
+ # create/update OneFlow templates
16
+
17
+ describe 'OneDriver/create_one_template.rb' do
18
+ it { is_expected.to converge_with_result(/create template 'RSpec-test-template'/) }
19
+ end
20
+
21
+ describe 'OneFlow/create_json_template.rb' do
22
+ it { is_expected.to converge_with_result(/created template 'RSpec-flow-json-template'/) }
23
+ it { is_expected.to converge_with_result(/(up to date)/) }
24
+ end
25
+
26
+ describe 'OneFlow/update_json_template.rb' do
27
+ it { is_expected.to converge_with_result(/updated template 'RSpec-flow-json-template'/) }
28
+ it { is_expected.to converge_with_result(/(up to date)/) }
29
+ end
30
+
31
+ describe 'OneFlow/chmod_json_template.rb' do
32
+ it { is_expected.to converge_with_result(/updated template 'RSpec-flow-json-template'/) }
33
+ it { is_expected.to converge_with_result(/(up to date)/) }
34
+ end
35
+
36
+ describe 'OneFlow/create_http_template.rb' do
37
+ it { is_expected.to converge_with_result(/created template 'RSpec-flow-http-template'/) }
38
+ it { is_expected.to converge_with_result(/(up to date)/) }
39
+ end
40
+
41
+ describe 'OneFlow/create_file_template.rb' do
42
+ before(:context) do
43
+ File.open('/tmp/RSpec-flow-file-template.json', 'w') do |f|
44
+ f.write(
45
+ { :roles => [
46
+ {
47
+ :name => 'RSpecTest',
48
+ :cooldown => 2,
49
+ :vm_template => Chef::Provisioning::OpenNebulaDriver.get_onelib(:driver_url => DRIVER_URL)
50
+ .get_resource(:template, :name => 'RSpec-test-template').to_hash['VMTEMPLATE']['ID'].to_i
51
+ }
52
+ ]
53
+ }.to_json
54
+ )
55
+ end
56
+ end
57
+ it { is_expected.to converge_with_result(/created template 'RSpec-flow-file-template'/) }
58
+ it { is_expected.to converge_with_result(/(up to date)/) }
59
+ after(:context) do
60
+ File.delete('/tmp/RSpec-flow-file-template.json')
61
+ end
62
+ end
63
+
64
+ describe 'OneFlow/chmod_file_template.rb' do
65
+ it { is_expected.to converge_with_result(/updated template 'RSpec-flow-file-template'/) }
66
+ it { is_expected.to converge_with_result(/(up to date)/) }
67
+ end
68
+
69
+ describe 'OneFlow/create_json_template_with_opts.rb' do
70
+ it { is_expected.to converge_with_result(/created template 'RSpec-flow-json-template-with-opts'/) }
71
+ it { is_expected.to converge_with_result(/(up to date)/) }
72
+ end
73
+
74
+ describe 'OneFlow/create_file_template_with_opts.rb' do
75
+ before(:context) do
76
+ File.open('/tmp/RSpec-flow-file-template-with-opts.json', 'w') do |f|
77
+ f.write(
78
+ {
79
+ :deployment => 'none',
80
+ :ready_status_gate => false,
81
+ :roles => [
82
+ {
83
+ :name => 'RSpecTest',
84
+ :cooldown => 2,
85
+ :vm_template => Chef::Provisioning::OpenNebulaDriver.get_onelib(:driver_url => DRIVER_URL)
86
+ .get_resource(:template, :name => 'RSpec-test-template').to_hash['VMTEMPLATE']['ID'].to_i
87
+ }
88
+ ]
89
+ }.to_json
90
+ )
91
+ end
92
+ end
93
+ it { is_expected.to converge_with_result(/created template 'RSpec-flow-file-template-with-opts'/) }
94
+ it { is_expected.to converge_with_result(/(up to date)/) }
95
+ after(:context) do
96
+ File.delete('/tmp/RSpec-flow-file-template-with-opts.json')
97
+ end
98
+ end
99
+
100
+ describe 'OneFlow/branch_json_template_by_id.rb' do
101
+ it { is_expected.to converge_with_result(/created template 'RSpec-branch-json-template-by-id'/) }
102
+ it { is_expected.to converge_with_result(/(up to date)/) }
103
+ end
104
+
105
+ describe 'OneFlow/branch_json_template_by_name.rb' do
106
+ it { is_expected.to converge_with_result(/created template 'RSpec-branch-json-template-by-name'/) }
107
+ it { is_expected.to converge_with_result(/(up to date)/) }
108
+ end
109
+
110
+ describe 'OneFlow/create_role_action_template.rb' do
111
+ it { is_expected.to converge_with_result(/created template 'RSpec-role-action-template'/) }
112
+ it { is_expected.to converge_with_result(/(up to date)/) }
113
+ end
114
+
115
+ # instantiate OneFlow services
116
+
117
+ describe 'OneFlow/create_json_service_with_opts.rb' do
118
+ it { is_expected.to converge_with_result(/instantiated service 'RSpec-json-service-with-opts'/) }
119
+ it { is_expected.to converge_with_result(/(up to date)/) }
120
+ end
121
+
122
+ describe 'OneFlow/create_json_service_by_id.rb' do
123
+ it { is_expected.to converge_with_result(/instantiated service 'RSpec-json-service-by-id'/) }
124
+ it { is_expected.to converge_with_result(/(up to date)/) }
125
+ end
126
+
127
+ describe 'OneFlow/create_json_service_by_name.rb' do
128
+ it { is_expected.to converge_with_result(/instantiated service 'RSpec-json-service-by-name'/) }
129
+ it { is_expected.to converge_with_result(/(up to date)/) }
130
+ end
131
+
132
+ describe 'OneFlow/chmod_json_service_by_id.rb' do
133
+ it { is_expected.to converge_with_result(/updated service 'RSpec-json-service-by-id'/) }
134
+ it { is_expected.to converge_with_result(/(up to date)/) }
135
+ end
136
+
137
+ describe 'OneFlow/chmod_json_service_by_name.rb' do
138
+ it { is_expected.to converge_with_result(/updated service 'RSpec-json-service-by-name'/) }
139
+ it { is_expected.to converge_with_result(/(up to date)/) }
140
+ end
141
+
142
+ describe 'OneFlow/create_role_action_service.rb' do
143
+ it { is_expected.to converge_with_result(/instantiated service 'RSpec-role-action-service'/) }
144
+ it { is_expected.to converge_with_result(/(up to date)/) }
145
+ end
146
+
147
+ # action OneFlow services
148
+
149
+ describe 'OneFlow/service_action_delete_recreate.rb' do
150
+ it { is_expected.to converge_with_result(
151
+ /deleted and recreated role 'RSpec_delete_recreate' of service 'RSpec-role-action-service'/) }
152
+ end
153
+
154
+ describe 'OneFlow/service_action_snapshot_create.rb' do
155
+ it { is_expected.to converge_with_result(
156
+ /created a snapshot for role 'RSpec_snapshot_create' of service 'RSpec-role-action-service'/) }
157
+ end
158
+
159
+ describe 'OneFlow/service_action_scale.rb' do
160
+ it { is_expected.to converge_with_result(
161
+ /scaled role 'RSpec_scale' of service 'RSpec-role-action-service' to cardinality '2'/) }
162
+ it { is_expected.to converge_with_result(/(up to date)/) }
163
+ end
164
+
165
+ describe 'OneFlow/service_action_shutdown.rb' do
166
+ it { is_expected.to converge_with_result(
167
+ /shutdown role 'RSpec_shutdown' of service 'RSpec-role-action-service'/) }
168
+ it { is_expected.to converge_with_result(/(up to date)/) }
169
+ end
170
+
171
+ describe 'OneFlow/service_action_shutdown_hard.rb' do
172
+ it { is_expected.to converge_with_result(
173
+ /performed hard shutdown of role 'RSpec_shutdown_hard' of service 'RSpec-role-action-service'/) }
174
+ it { is_expected.to converge_with_result(/(up to date)/) }
175
+ end
176
+
177
+ describe 'OneFlow/service_action_poweroff.rb' do
178
+ it { is_expected.to converge_with_result(
179
+ /powered-off role 'RSpec_poweroff' of service 'RSpec-role-action-service'/) }
180
+ it { is_expected.to converge_with_result(/(up to date)/) }
181
+ end
182
+
183
+ describe 'OneFlow/service_action_poweroff_hard.rb' do
184
+ it { is_expected.to converge_with_result(
185
+ /hard powered-off role 'RSpec_poweroff_hard' of service 'RSpec-role-action-service'/) }
186
+ it { is_expected.to converge_with_result(/(up to date)/) }
187
+ end
188
+
189
+ describe 'OneFlow/service_action_stop.rb' do
190
+ it { is_expected.to converge_with_result(
191
+ /stopped role 'RSpec_stop' of service 'RSpec-role-action-service'/) }
192
+ it { is_expected.to converge_with_result(/(up to date)/) }
193
+ end
194
+
195
+ describe 'OneFlow/service_action_suspend.rb' do
196
+ it { is_expected.to converge_with_result(
197
+ /suspended role 'RSpec_suspend' of service 'RSpec-role-action-service'/) }
198
+ it { is_expected.to converge_with_result(/(up to date)/) }
199
+ end
200
+
201
+ describe 'OneFlow/service_action_undeploy.rb' do
202
+ it { is_expected.to converge_with_result(
203
+ /undeployed role 'RSpec_undeploy' of service 'RSpec-role-action-service'/) }
204
+ it { is_expected.to converge_with_result(/(up to date)/) }
205
+ end
206
+
207
+ describe 'OneFlow/service_action_undeploy_hard.rb' do
208
+ it { is_expected.to converge_with_result(
209
+ /hard undeployed role 'RSpec_undeploy_hard' of service 'RSpec-role-action-service'/) }
210
+ it { is_expected.to converge_with_result(/(up to date)/) }
211
+ end
212
+
213
+ describe 'OneFlow/service_action_resume_poweroff.rb' do
214
+ it { is_expected.to converge_with_result(
215
+ /resumed role 'RSpec_poweroff' of service 'RSpec-role-action-service'/) }
216
+ it { is_expected.to converge_with_result(/(up to date)/) }
217
+ end
218
+
219
+ describe 'OneFlow/service_action_resume_poweroff_hard.rb' do
220
+ it { is_expected.to converge_with_result(
221
+ /resumed role 'RSpec_poweroff_hard' of service 'RSpec-role-action-service'/) }
222
+ it { is_expected.to converge_with_result(/(up to date)/) }
223
+ end
224
+
225
+ describe 'OneFlow/service_action_resume_stop.rb' do
226
+ it { is_expected.to converge_with_result(
227
+ /resumed role 'RSpec_stop' of service 'RSpec-role-action-service'/) }
228
+ it { is_expected.to converge_with_result(/(up to date)/) }
229
+ end
230
+
231
+ describe 'OneFlow/service_action_resume_suspend.rb' do
232
+ it { is_expected.to converge_with_result(
233
+ /resumed role 'RSpec_suspend' of service 'RSpec-role-action-service'/) }
234
+ it { is_expected.to converge_with_result(/(up to date)/) }
235
+ end
236
+
237
+ describe 'OneFlow/service_action_resume_undeploy.rb' do
238
+ it { is_expected.to converge_with_result(
239
+ /resumed role 'RSpec_undeploy' of service 'RSpec-role-action-service'/) }
240
+ it { is_expected.to converge_with_result(/(up to date)/) }
241
+ end
242
+
243
+ describe 'OneFlow/service_action_resume_undeploy_hard.rb' do
244
+ it { is_expected.to converge_with_result(
245
+ /resumed role 'RSpec_undeploy_hard' of service 'RSpec-role-action-service'/) }
246
+ it { is_expected.to converge_with_result(/(up to date)/) }
247
+ end
248
+
249
+ describe 'OneFlow/service_action_hold.rb' do
250
+ it { is_expected.not_to converge_with_result(
251
+ /UNTESTED \/ PARTIALLY IMPLEMENTED/) }
252
+ end
253
+
254
+ describe 'OneFlow/service_action_release.rb' do
255
+ it { is_expected.not_to converge_with_result(
256
+ /UNTESTED \/ PARTIALLY IMPLEMENTED/) }
257
+ end
258
+
259
+ describe 'OneFlow/service_action_boot.rb' do
260
+ it { is_expected.not_to converge_with_result(
261
+ /UNTESTED \/ PARTIALLY IMPLEMENTED/) }
262
+ end
263
+
264
+ describe 'OneFlow/service_action_reboot.rb' do
265
+ it { is_expected.to converge_with_result(
266
+ /rebooted role 'RSpec_reboot' of service 'RSpec-role-action-service'/) }
267
+ end
268
+
269
+ describe 'OneFlow/service_action_reboot_hard.rb' do
270
+ it { is_expected.to converge_with_result(
271
+ /hard rebooted role 'RSpec_reboot_hard' of service 'RSpec-role-action-service'/) }
272
+ end
273
+
274
+ describe 'OneFlow/service_action_delete.rb' do
275
+ it { is_expected.to converge_with_result(
276
+ /deleted role 'RSpec_delete_recreate' of service 'RSpec-role-action-service'/) }
277
+ end
278
+
279
+ describe 'OneFlow/shutdown_role_action_service.rb' do
280
+ it { is_expected.to converge_with_result(/shutdown service 'RSpec-role-action-service'/) }
281
+ it { is_expected.to converge_with_result(/(up to date)/) }
282
+ end
283
+
284
+ # delete OneFlow services
285
+
286
+ describe 'OneFlow/delete_json_service_with_opts.rb' do
287
+ it { is_expected.to converge_with_result(/deleted service 'RSpec-json-service-with-opts'/) }
288
+ end
289
+
290
+ describe 'OneFlow/delete_json_service_by_id.rb' do
291
+ it { is_expected.to converge_with_result(/deleted service 'RSpec-json-service-by-id'/) }
292
+ end
293
+
294
+ describe 'OneFlow/delete_json_service_by_name.rb' do
295
+ it { is_expected.to converge_with_result(/deleted service 'RSpec-json-service-by-name'/) }
296
+ end
297
+
298
+ describe 'OneFlow/delete_role_action_service.rb' do
299
+ it { is_expected.to converge_with_result(/deleted service 'RSpec-role-action-service'/) }
300
+ end
301
+
302
+ # delete OneFlow templates
303
+
304
+ describe 'OneFlow/delete_json_template.rb' do
305
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-flow-json-template'/) }
306
+ end
307
+
308
+ describe 'OneFlow/delete_http_template.rb' do
309
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-flow-http-template'/) }
310
+ end
311
+
312
+ describe 'OneFlow/delete_file_template.rb' do
313
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-flow-file-template'/) }
314
+ end
315
+
316
+ describe 'OneFlow/delete_json_template_with_opts.rb' do
317
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-flow-json-template-with-opts'/) }
318
+ end
319
+
320
+ describe 'OneFlow/delete_file_template_with_opts.rb' do
321
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-flow-file-template-with-opts'/) }
322
+ end
323
+
324
+ describe 'OneFlow/delete_branched_template_by_id.rb' do
325
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-branch-json-template-by-id'/) }
326
+ end
327
+
328
+ describe 'OneFlow/delete_branched_template_by_name.rb' do
329
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-branch-json-template-by-name'/) }
330
+ end
331
+
332
+ describe 'OneFlow/delete_role_action_template.rb' do
333
+ it { is_expected.to converge_with_result(/deleted template 'RSpec-role-action-template'/) }
334
+ end
335
+
336
+ # delete One template
337
+
338
+ describe 'OneDriver/delete_one_template.rb' do
339
+ it { is_expected.to converge_with_result(/delete template 'RSpec-test-template'/) }
340
+ end