tengine_resource 0.5.15 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/Gemfile +1 -27
  2. data/Gemfile.lock +60 -73
  3. data/README.rdoc +2 -2
  4. data/bin/create_indexes_for_tengine_resource +18 -0
  5. data/lib/tengine/resource/config/resource.rb +0 -3
  6. data/lib/tengine/resource/credential.rb +16 -17
  7. data/lib/tengine/resource/net_ssh.rb +22 -10
  8. data/lib/tengine/resource/physical_server.rb +8 -0
  9. data/lib/tengine/resource/provider.rb +206 -35
  10. data/lib/tengine/resource/server.rb +3 -3
  11. data/lib/tengine/resource/virtual_server.rb +1 -1
  12. data/lib/tengine/resource/virtual_server_image.rb +8 -8
  13. data/lib/tengine/resource/virtual_server_type.rb +2 -2
  14. data/lib/tengine/resource/watcher.rb +39 -9
  15. data/tmp/.gitkeep +0 -0
  16. metadata +92 -141
  17. data/.document +0 -5
  18. data/.rspec +0 -1
  19. data/Rakefile +0 -42
  20. data/VERSION +0 -1
  21. data/config/.gitignore +0 -2
  22. data/lib/tengine/resource/credential/ec2.rb +0 -5
  23. data/lib/tengine/resource/credential/ec2/dummy.rb +0 -148
  24. data/lib/tengine/resource/credential/ec2/launch_options.rb +0 -179
  25. data/lib/tengine/resource/provider/ec2.rb +0 -187
  26. data/lib/tengine/resource/provider/wakame.rb +0 -638
  27. data/spec/fixtures/goku_at_ec2_ap_northeast.rb +0 -177
  28. data/spec/mongoid.yml +0 -35
  29. data/spec/mongoid_en.yml +0 -48
  30. data/spec/spec_helper.rb +0 -43
  31. data/spec/support/ec2.rb +0 -129
  32. data/spec/support/mongo_index_key_log.rb +0 -91
  33. data/spec/tengine/resource/bugfix/watcher_for_wakame_spec.rb +0 -232
  34. data/spec/tengine/resource/credential_spec.rb +0 -205
  35. data/spec/tengine/resource/drivers/resource_control_driver_spec.rb +0 -84
  36. data/spec/tengine/resource/net_ssh_spec.rb +0 -148
  37. data/spec/tengine/resource/physical_server_spec.rb +0 -47
  38. data/spec/tengine/resource/provider/ec2_spec.rb +0 -473
  39. data/spec/tengine/resource/provider/test_files/describe_host_nodes.json +0 -22
  40. data/spec/tengine/resource/provider/test_files/describe_images.json +0 -23
  41. data/spec/tengine/resource/provider/test_files/describe_instance_specs.json +0 -23
  42. data/spec/tengine/resource/provider/test_files/describe_instances.json +0 -56
  43. data/spec/tengine/resource/provider/test_files/run_instances.json +0 -30
  44. data/spec/tengine/resource/provider/test_files/terminate_instances.json +0 -3
  45. data/spec/tengine/resource/provider/wakame/00_describe_host_nodes_0_physical_servers.json +0 -8
  46. data/spec/tengine/resource/provider/wakame/01_describe_host_nodes_10_physical_servers.json +0 -139
  47. data/spec/tengine/resource/provider/wakame/02_describe_host_nodes_60_physical_servers.json +0 -795
  48. data/spec/tengine/resource/provider/wakame/10_describe_instances_0_virtual_servers.json +0 -8
  49. data/spec/tengine/resource/provider/wakame/11_describe_instances_10_virtual_servers.json +0 -469
  50. data/spec/tengine/resource/provider/wakame/12_describe_instances_after_run_instances.json +0 -280
  51. data/spec/tengine/resource/provider/wakame/13_describe_instances_after_terminate_instances.json +0 -279
  52. data/spec/tengine/resource/provider/wakame/20_describe_images_0_virtual_server_images.json +0 -8
  53. data/spec/tengine/resource/provider/wakame/21_describe_images_5_virtual_server_images.json +0 -84
  54. data/spec/tengine/resource/provider/wakame/22_describe_images_60_virtual_server_images.json +0 -856
  55. data/spec/tengine/resource/provider/wakame/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
  56. data/spec/tengine/resource/provider/wakame/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
  57. data/spec/tengine/resource/provider/wakame/40_run_instances_0_virtual_servers.json +0 -1
  58. data/spec/tengine/resource/provider/wakame/41_run_instances_1_virtual_servers.json +0 -22
  59. data/spec/tengine/resource/provider/wakame/42_run_instances_5_virtual_servers.json +0 -106
  60. data/spec/tengine/resource/provider/wakame/50_terminate_instances_0_virtual_servers.json +0 -1
  61. data/spec/tengine/resource/provider/wakame/51_terminate_instances_3_virtual_servers.json +0 -5
  62. data/spec/tengine/resource/provider/wakame/sync_physical_servers_spec.rb +0 -114
  63. data/spec/tengine/resource/provider/wakame/sync_virtual_server_images_spec.rb +0 -116
  64. data/spec/tengine/resource/provider/wakame/sync_virtual_server_types_spec.rb +0 -116
  65. data/spec/tengine/resource/provider/wakame/sync_virtual_servers_spec.rb +0 -216
  66. data/spec/tengine/resource/provider/wakame_api_spec.rb +0 -319
  67. data/spec/tengine/resource/provider/wakame_spec.rb +0 -339
  68. data/spec/tengine/resource/provider_spec.rb +0 -252
  69. data/spec/tengine/resource/server_spec.rb +0 -195
  70. data/spec/tengine/resource/test_files/.gitignore +0 -6
  71. data/spec/tengine/resource/test_files/00_describe_host_nodes_0_physical_servers.json +0 -8
  72. data/spec/tengine/resource/test_files/01_describe_host_nodes_10_physical_servers.json +0 -139
  73. data/spec/tengine/resource/test_files/02_describe_host_nodes_60_physical_servers.json +0 -795
  74. data/spec/tengine/resource/test_files/10_describe_instances_0_virtual_servers.json +0 -8
  75. data/spec/tengine/resource/test_files/11_describe_instances_10_virtual_servers.json +0 -469
  76. data/spec/tengine/resource/test_files/12_describe_instances_after_run_instances.json +0 -280
  77. data/spec/tengine/resource/test_files/13_describe_instances_after_terminate_instances.json +0 -279
  78. data/spec/tengine/resource/test_files/14_describe_instances_after_run_1_instance.json +0 -55
  79. data/spec/tengine/resource/test_files/20_describe_images_0_virtual_server_images.json +0 -8
  80. data/spec/tengine/resource/test_files/21_describe_images_5_virtual_server_images.json +0 -84
  81. data/spec/tengine/resource/test_files/22_describe_images_60_virtual_server_images.json +0 -856
  82. data/spec/tengine/resource/test_files/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
  83. data/spec/tengine/resource/test_files/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
  84. data/spec/tengine/resource/test_files/40_run_instances_0_virtual_servers.json +0 -1
  85. data/spec/tengine/resource/test_files/41_run_instances_1_virtual_servers.json +0 -22
  86. data/spec/tengine/resource/test_files/42_run_instances_5_virtual_servers.json +0 -106
  87. data/spec/tengine/resource/test_files/43_run_instances_1_virtual_servers_without_aws_availability_zone.json +0 -22
  88. data/spec/tengine/resource/test_files/50_terminate_instances_0_virtual_servers.json +0 -1
  89. data/spec/tengine/resource/test_files/51_terminate_instances_3_virtual_servers.json +0 -5
  90. data/spec/tengine/resource/virtual_server_image_spec.rb +0 -94
  91. data/spec/tengine/resource/virtual_server_spec.rb +0 -116
  92. data/spec/tengine/resource/virtual_server_type_spec.rb +0 -4
  93. data/spec/tengine/resource/watcher_spec.rb +0 -1027
  94. data/spec/tengine_resource_spec.rb +0 -5
  95. data/tengine_resource.gemspec +0 -172
  96. data/tmp/log/.gitignore +0 -1
@@ -1,116 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe Tengine::Resource::Provider::Wakame do
5
- subject do
6
- Tengine::Resource::Provider::Wakame.delete_all
7
- Tengine::Resource::Provider::Wakame.create!(
8
- :name => "tama_test_001",
9
- :connection_settings => { :test => true }
10
- )
11
- end
12
-
13
- context :virtual_server_type_watch do
14
- def setup_describe_instance_specs_file(filename)
15
- subject.connection_settings[:options] = {
16
- :describe_instance_specs_file => File.expand_path(filename, File.dirname(__FILE__))
17
- }
18
- end
19
-
20
-
21
- context "初期登録時" do
22
- before{ Tengine::Resource::VirtualServerType.delete_all }
23
-
24
- context "Wakameが0件返す場合" do
25
- before{ setup_describe_instance_specs_file("30_describe_instance_specs_0_virtual_server_specs.json")}
26
- it "件数は増えない" do
27
- expect{
28
- subject.virtual_server_type_watch
29
- }.to_not change(Tengine::Resource::VirtualServerType, :count)
30
- end
31
- end
32
-
33
- context "Wakameが4件返す場合" do
34
- before{ setup_describe_instance_specs_file("31_describe_instance_specs_4_virtual_server_specs.json")}
35
- it "4件増える" do
36
- expect{
37
- subject.virtual_server_type_watch
38
- }.to change(Tengine::Resource::VirtualServerType, :count).by(4)
39
- Tengine::Resource::VirtualServerType.all.each do |server|
40
- server.provided_id.should_not == nil
41
- server.caption.should_not == nil
42
- server.cpu_cores.should_not == nil
43
- server.memory_size.should_not == nil
44
- server.provider_id.should == subject.id
45
- end
46
- end
47
- end
48
- end
49
-
50
- context "4件登録されているとき" do
51
- context "テスト用JSONと同じIDのデータが登録されている" do
52
- before do
53
- Tengine::Resource::VirtualServerType.delete_all
54
- subject.virtual_server_types.tap do |servers|
55
- (1..4).each do |idx|
56
- servers.create!(:provided_id => "virtual_server_spec_id_%02d" % idx, :name => "virtual_server_type_id_%02d" % idx)
57
- end
58
- end
59
- end
60
-
61
- context "Wakameが0件返す場合" do
62
- before{ setup_describe_instance_specs_file("30_describe_instance_specs_0_virtual_server_specs.json")}
63
- it "4件削除される" do
64
- expect{
65
- subject.virtual_server_type_watch
66
- }.to change(Tengine::Resource::VirtualServerType, :count).by(-4)
67
- end
68
- end
69
-
70
- context "Wakameが同じ4件返す場合" do
71
- before{ setup_describe_instance_specs_file("31_describe_instance_specs_4_virtual_server_specs.json")}
72
- it "件数もデータも変わらず" do
73
- ids = Tengine::Resource::VirtualServerType.all.map(&:id).map(&:to_s).sort
74
- expect{
75
- subject.virtual_server_type_watch
76
- }.to_not change(Tengine::Resource::VirtualServerType, :count)
77
- Tengine::Resource::VirtualServerType.all.map(&:id).map(&:to_s).sort.should == ids
78
- end
79
- end
80
- end
81
-
82
- context "テスト用JSONと異なるIDのデータが登録されている" do
83
- before do
84
- Tengine::Resource::VirtualServerType.delete_all
85
- subject.virtual_server_types.tap do |servers|
86
- (11..14).each do |idx|
87
- servers.create!(:provided_id => "virtual_server_spec_id_%02d" % idx, :name => "virtual_server_type_name_%02d" % idx)
88
- end
89
- end
90
- end
91
-
92
- context "Wakameが0件返す場合" do
93
- before{ setup_describe_instance_specs_file("30_describe_instance_specs_0_virtual_server_specs.json")}
94
- it "4件削除される" do
95
- expect{
96
- subject.virtual_server_type_watch
97
- }.to change(Tengine::Resource::VirtualServerType, :count).by(-4)
98
- end
99
- end
100
-
101
- context "Wakameが登録されているものとは異なる4件返す場合" do
102
- before{ setup_describe_instance_specs_file("31_describe_instance_specs_4_virtual_server_specs.json")}
103
- it "件数は変わらないが、データは変わっている" do
104
- ids = Tengine::Resource::VirtualServerType.all.map(&:id).map(&:to_s).sort
105
- expect{
106
- subject.virtual_server_type_watch
107
- }.to_not change(Tengine::Resource::VirtualServerType, :count)
108
- Tengine::Resource::VirtualServerType.all.map(&:id).map(&:to_s).sort.should_not == ids
109
- end
110
- end
111
- end
112
- end
113
-
114
- end
115
-
116
- end
@@ -1,216 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe Tengine::Resource::Provider::Wakame do
5
- subject do
6
- Tengine::Resource::Provider::Wakame.delete_all
7
- Tengine::Resource::Provider::Wakame.create!(
8
- :name => "tama_test_001",
9
- :connection_settings => {
10
- :test => true,
11
- :options => {
12
- :describe_host_nodes_file => File.expand_path("01_describe_host_nodes_10_physical_servers.json", File.dirname(__FILE__)),
13
- :describe_images_file => File.expand_path("21_describe_images_5_virtual_server_images.json", File.dirname(__FILE__)),
14
- :describe_instance_specs_file => File.expand_path("31_describe_instance_specs_4_virtual_server_specs.json", File.dirname(__FILE__)),
15
- }
16
- })
17
- end
18
-
19
- before do
20
- Tengine::Resource::PhysicalServer.delete_all
21
- Tengine::Resource::VirtualServerImage.delete_all
22
- Tengine::Resource::VirtualServerType.delete_all
23
- subject.physical_server_watch
24
- subject.virtual_server_image_watch
25
- subject.virtual_server_type_watch
26
- end
27
-
28
- virtual_server_attrs = {
29
- "virtual_server_id_01" => {
30
- :provided_physical_server_id => "physical_server_id_01",
31
- :provided_image_id => "virtual_server_image_uuid_01",
32
- :provided_type_id => "virtual_server_spec_id_01",
33
- :name => "virtual_server_id_01"
34
- },
35
- "virtual_server_id_02" => {
36
- :provided_physical_server_id => "physical_server_id_01",
37
- :provided_image_id => "virtual_server_image_uuid_01",
38
- :provided_type_id => "virtual_server_spec_id_01",
39
- :name => "virtual_server_id_02"
40
- },
41
- "virtual_server_id_03" => {
42
- :provided_physical_server_id => "physical_server_id_01",
43
- :provided_image_id => "virtual_server_image_uuid_01",
44
- :provided_type_id => "virtual_server_spec_id_01",
45
- :name => "virtual_server_id_03"
46
- },
47
- "virtual_server_id_04" => {
48
- :provided_physical_server_id => "physical_server_id_01",
49
- :provided_image_id => "virtual_server_image_uuid_01",
50
- :provided_type_id => "virtual_server_spec_id_01",
51
- :name => "virtual_server_id_04"
52
- },
53
- "virtual_server_id_05" => {
54
- :provided_physical_server_id => "physical_server_id_01",
55
- :provided_image_id => "virtual_server_image_uuid_01",
56
- :provided_type_id => "virtual_server_spec_id_01",
57
- :name => "virtual_server_id_05"
58
- },
59
-
60
- "virtual_server_id_06" => {
61
- :provided_physical_server_id => "physical_server_id_02",
62
- :provided_image_id => "virtual_server_image_uuid_02",
63
- :provided_type_id => "virtual_server_spec_id_02",
64
- :name => "virtual_server_id_06"
65
- },
66
- "virtual_server_id_07" => {
67
- :provided_physical_server_id => "physical_server_id_02",
68
- :provided_image_id => "virtual_server_image_uuid_02",
69
- :provided_type_id => "virtual_server_spec_id_02",
70
- :name => "virtual_server_id_07"
71
- },
72
- "virtual_server_id_08" => {
73
- :provided_physical_server_id => "physical_server_id_02",
74
- :provided_image_id => "virtual_server_image_uuid_02",
75
- :provided_type_id => "virtual_server_spec_id_02",
76
- :name => "virtual_server_id_08"
77
- },
78
-
79
- "virtual_server_id_09" => {
80
- :provided_physical_server_id => "physical_server_id_03",
81
- :provided_image_id => "virtual_server_image_uuid_01",
82
- :provided_type_id => "virtual_server_spec_id_01",
83
- :name => "virtual_server_id_09"
84
- },
85
-
86
- "virtual_server_id_10" => {
87
- :provided_physical_server_id => "physical_server_id_03",
88
- :provided_image_id => "virtual_server_image_uuid_02",
89
- :provided_type_id => "virtual_server_spec_id_02",
90
- :name => "virtual_server_id_10"
91
- },
92
- }
93
-
94
-
95
- context :virtual_server_watch do
96
- def setup_describe_instances_file(filename)
97
- subject.connection_settings[:options] = {
98
- :describe_instances_file => File.expand_path(filename, File.dirname(__FILE__))
99
- }
100
- end
101
-
102
- context "初期登録時" do
103
- before{ Tengine::Resource::VirtualServer.delete_all }
104
-
105
- context "Wakameが0件返す場合" do
106
- before{ setup_describe_instances_file("10_describe_instances_0_virtual_servers.json")}
107
- it "件数は増えない" do
108
- expect{
109
- subject.virtual_server_watch
110
- }.to_not change(Tengine::Resource::VirtualServer, :count)
111
- end
112
- end
113
-
114
- context "Wakameが10件返す場合" do
115
- before{ setup_describe_instances_file("11_describe_instances_10_virtual_servers.json")}
116
- it "10件増える" do
117
- expect{
118
- subject.virtual_server_watch
119
- }.to change(Tengine::Resource::VirtualServer, :count).by(10)
120
- Tengine::Resource::VirtualServer.all(:sort => [:_id, :asc]).each_with_index do |server, idx|
121
- provided_id = "virtual_server_id_%02d" % (idx + 1)
122
- server.provided_id.should == provided_id
123
- expectations = virtual_server_attrs[provided_id].dup
124
-
125
- server.name.should == expectations[:name]
126
- server.provided_image_id.should == expectations[:provided_image_id]
127
- server.provided_type_id.should == expectations[:provided_type_id]
128
- server.provider_id.should == subject.id
129
-
130
- provided_physical_server_id = expectations.delete(:provided_physical_server_id)
131
- physical_server = Tengine::Resource::PhysicalServer.first(:conditions => {:provided_id => provided_physical_server_id})
132
- server.host_server_id.should == physical_server.id
133
- end
134
- end
135
- end
136
- end
137
-
138
- context "10件登録されているとき" do
139
- context "テスト用JSONと同じIDのデータが登録されている" do
140
- before do
141
- Tengine::Resource::VirtualServer.delete_all
142
- subject.virtual_servers.tap do |servers|
143
- (1..10).each do |idx|
144
- provided_id = "virtual_server_id_%02d" % idx
145
- attrs = virtual_server_attrs[provided_id].dup
146
- attrs.update(:provided_id => provided_id)
147
-
148
-
149
- provided_physical_server_id = attrs.delete(:provided_physical_server_id)
150
- raise ":provided_physical_server_id not found for #{provided_id}" unless provided_physical_server_id
151
- physical_server = Tengine::Resource::PhysicalServer.first(:conditions => {:provided_id => provided_physical_server_id})
152
- raise "physical_server not found for #{provided_physical_server_id}" unless physical_server
153
- attrs.update(:host_server_id => physical_server.id)
154
-
155
- servers.create!(attrs)
156
- end
157
- end
158
- end
159
-
160
- context "Wakameが0件返す場合" do
161
- before{ setup_describe_instances_file("10_describe_instances_0_virtual_servers.json")}
162
- it "10件削除される" do
163
- Tengine::Resource::VirtualServer.count.should == 10
164
- expect{
165
- subject.virtual_server_watch
166
- }.to change(Tengine::Resource::VirtualServer, :count).by(-10)
167
- end
168
- end
169
-
170
- context "Wakameが同じ10件返す場合" do
171
- before{ setup_describe_instances_file("11_describe_instances_10_virtual_servers.json")}
172
- it "件数もデータも変わらず" do
173
- ids = Tengine::Resource::VirtualServer.all.map(&:id).map(&:to_s).sort
174
- expect{
175
- subject.virtual_server_watch
176
- }.to_not change(Tengine::Resource::VirtualServer, :count)
177
- Tengine::Resource::VirtualServer.all.map(&:id).map(&:to_s).sort.should == ids
178
- end
179
- end
180
- end
181
-
182
- context "テスト用JSONと異なるIDのデータが登録されている" do
183
- before do
184
- Tengine::Resource::VirtualServer.delete_all
185
- subject.virtual_servers.tap do |servers|
186
- (11..20).each do |idx|
187
- servers.create!(:provided_id => "virtual_server_image_uuid_%02d" % idx, :name => "virtual_server_image_name_%02d" % idx)
188
- end
189
- end
190
- end
191
-
192
- context "Wakameが0件返す場合" do
193
- before{ setup_describe_instances_file("10_describe_instances_0_virtual_servers.json")}
194
- it "10件削除される" do
195
- expect{
196
- subject.virtual_server_watch
197
- }.to change(Tengine::Resource::VirtualServer, :count).by(-10)
198
- end
199
- end
200
-
201
- context "Wakameが登録されているものとは異なる10件返す場合" do
202
- before{ setup_describe_instances_file("11_describe_instances_10_virtual_servers.json")}
203
- it "件数は変わらないが、データは変わっている" do
204
- ids = Tengine::Resource::VirtualServer.all.map(&:id).map(&:to_s).sort
205
- expect{
206
- subject.virtual_server_watch
207
- }.to_not change(Tengine::Resource::VirtualServer, :count)
208
- Tengine::Resource::VirtualServer.all.map(&:id).map(&:to_s).sort.should_not == ids
209
- end
210
- end
211
- end
212
- end
213
-
214
- end
215
-
216
- end
@@ -1,319 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
- require 'apis/wakame'
4
-
5
- describe Tengine::Resource::Provider::Wakame do
6
-
7
- subject {
8
- Tengine::Resource::Provider::Wakame.delete_all
9
- Tengine::Resource::Provider::Wakame.create(
10
- :name => "wakameTest1",
11
- :description => "provided by wakame / tama",
12
- :connection_settings => {
13
- :test => true,
14
- :options => {
15
- # 仮想サーバの状態
16
- :describe_instances_file => File.join(
17
- File.dirname(__FILE__), "./test_files/describe_instances.json"),
18
- # 仮想サーバイメージの状態
19
- :describe_images_file => File.join(
20
- File.dirname(__FILE__), "./test_files/describe_images.json"),
21
- # 仮想サーバ起動時
22
- :run_instances_file => File.join(
23
- File.dirname(__FILE__), "./test_files/run_instances.json"),
24
- # 仮想サーバ停止時
25
- :terminate_instances_file => File.join(
26
- File.dirname(__FILE__), "./test_files/terminate_instances.json"),
27
- # 物理サーバの状態
28
- :describe_host_nodes_file => File.join(
29
- File.dirname(__FILE__), "./test_files/describe_host_nodes.json"),
30
- # 仮想サーバスペックの状態
31
- :describe_instance_specs_file => File.join(
32
- File.dirname(__FILE__), "./test_files/describe_instance_specs.json"),
33
- }
34
- })
35
- }
36
-
37
- describe "test mode" do
38
- context "to_string" do
39
- it "仮想サーバの状態" do
40
- subject.describe_instances_for_api([], :convert => :string).should == [{
41
- "aws_kernel_id" => "",
42
- "aws_launch_time" => "2011-10-18T06:48:47Z",
43
- "tags" => {},
44
- "aws_reservation_id" => "",
45
- "aws_owner" => "a-shpoolxx",
46
- "instance_lifecycle" => "",
47
- "block_device_mappings" => [{
48
- "ebs_volume_id" => "",
49
- "ebs_status" => "",
50
- "ebs_attach_time" => "",
51
- "ebs_delete_on_termination" => false,
52
- "device_name" => ""
53
- }],
54
- "ami_launch_index" => "",
55
- "root_device_name" => "",
56
- "aws_ramdisk_id" => "",
57
- "aws_availability_zone" => "hp-testhost",
58
- "aws_groups" => nil,
59
- "spot_instance_request_id" => "",
60
- "ssh_key_name" => nil,
61
- "virtualization_type" => "",
62
- "placement_group_name" => "",
63
- "requester_id" => "",
64
- "aws_instance_id" => "i-9pia8e7p",
65
- "aws_product_codes" => [],
66
- "client_token" => "",
67
- "private_ip_address" => "192.168.2.95",
68
- "architecture" => "x86_64",
69
- "aws_state_code" => 0,
70
- "aws_image_id" => "wmi-lucid4",
71
- "root_device_type" => "",
72
- "ip_address" => "nw-data=192.168.2.95",
73
- "dns_name" => "nw-data=9pia8e7p.shpoolzz.vdc.local",
74
- "monitoring_state" => "",
75
- "aws_instance_type" => "is-testspec",
76
- "aws_state" => "running",
77
- "private_dns_name" => "9pia8e7p.shpoolzz.vdc.local",
78
- "aws_reason" => ""
79
- }]
80
- end
81
-
82
- it "仮想サーバイメージの状態" do
83
- subject.describe_images_for_api([], :convert => :string).should == [{
84
- "root_device_name" => "",
85
- "aws_ramdisk_id" => "",
86
- "block_device_mappings" => [{
87
- "ebs_snapshot_id" => "",
88
- "ebs_volume_size" => 0,
89
- "ebs_delete_on_termination" => false,
90
- "device_name" => ""
91
- }],
92
- "aws_is_public" => false,
93
- "virtualization_type" => "",
94
- "image_owner_alias" => "",
95
- "aws_id" => "wmi-lucid4",
96
- "aws_architecture" => "x86",
97
- "root_device_type" => "",
98
- "aws_location" => "--- \n:snapshot_id: snap-lucid4\n",
99
- "aws_image_type" => "",
100
- "name" => "",
101
- "aws_state" => "init",
102
- "description" => "ubuntu-10.04_with-metadata_kvm_i386.raw volume",
103
- "aws_kernel_id" => "",
104
- "tags" => {},
105
- "aws_owner" => "a-shpoolzz"
106
- }]
107
- end
108
-
109
- it "仮想サーバの起動" do
110
- subject.run_instances_for_api([], :convert => :string).should == [{
111
- "aws_launch_time" => "2011-10-18T06:48:47Z",
112
- "tags" => {},
113
- "aws_reservation_id" => "",
114
- "aws_owner" => "a-shpoolxx",
115
- "ami_launch_index" => "",
116
- "aws_availability_zone" => "",
117
- "aws_groups" => ["ng-demofgr"],
118
- "ssh_key_name" => nil,
119
- "virtualization_type" => "",
120
- "placement_group_name" => "",
121
- "aws_instance_id" => "i-9pia8e7g",
122
- "aws_product_codes" => [],
123
- "client_token" => "",
124
- "aws_state_code" => 0,
125
- "aws_image_id" => "wmi-lucid4",
126
- "dns_name" => nil,
127
- "aws_instance_type" => "is-testspec",
128
- "aws_state" => "scheduling",
129
- "private_dns_name" => nil,
130
- "aws_reason" => ""
131
- }]
132
- end
133
-
134
- it "仮想サーバの停止" do
135
- subject.terminate_instances_for_api([], :convert => :string).should == [{
136
- "aws_current_state_name" => "",
137
- "aws_prev_state_name" => "",
138
- "aws_prev_state_code" => 0,
139
- "aws_current_state_code" => 0,
140
- "aws_instance_id" => "i-9pia8e7g"
141
- }]
142
- end
143
-
144
- it "物理サーバの状態" do
145
- subject.describe_host_nodes_for_api([], :convert => :string).should == [{
146
- "status" => "online",
147
- "updated_at" => "2011-10-18T03:53:24Z",
148
- "account_id" => "a-shpoolzz",
149
- "offering_cpu_cores" => 120,
150
- "offering_memory_size" => 350000,
151
- "arch" => "x86_64",
152
- "hypervisor" => "kvm",
153
- "created_at" => "2011-10-18T03:53:24Z",
154
- "name" => "testhost",
155
- "uuid" => "hp-testhost",
156
- "id" => "hp-testhost"
157
- }]
158
- end
159
-
160
- it "仮想サーバスペックの状態" do
161
- subject.describe_instance_specs_for_api([], :convert => :string).should == [{
162
- "cpu_cores" => 2,
163
- "memory_size" => 512,
164
- "arch" => "x86_64",
165
- "hypervisor" => "kvm",
166
- "updated_at" => "2011-10-28T02:58:57Z",
167
- "account_id" => "a-shpoolzz",
168
- "vifs" => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
169
- "quota_weight" => 1.0,
170
- "id" => "is-testspec",
171
- "created_at" => "2011-10-28T02:58:57Z",
172
- "drives" => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
173
- "uuid" => "is-testspec"
174
- }]
175
- end
176
- end
177
-
178
- context "to_symbol" do
179
- it "仮想サーバの状態" do
180
- subject.describe_instances_for_api([], :convert => :symbol).should == [{
181
- :aws_kernel_id => "",
182
- :aws_launch_time => "2011-10-18T06:48:47Z",
183
- :tags => {},
184
- :aws_reservation_id => "",
185
- :aws_owner => "a-shpoolxx",
186
- :instance_lifecycle => "",
187
- :block_device_mappings => [{
188
- :ebs_volume_id => "",
189
- :ebs_status => "",
190
- :ebs_attach_time => "",
191
- :ebs_delete_on_termination => false,
192
- :device_name => ""
193
- }],
194
- :ami_launch_index => "",
195
- :root_device_name => "",
196
- :aws_ramdisk_id => "",
197
- :aws_availability_zone => "hp-testhost",
198
- :aws_groups => nil,
199
- :spot_instance_request_id => "",
200
- :ssh_key_name => nil,
201
- :virtualization_type => "",
202
- :placement_group_name => "",
203
- :requester_id => "",
204
- :aws_instance_id => "i-9pia8e7p",
205
- :aws_product_codes => [],
206
- :client_token => "",
207
- :private_ip_address => "192.168.2.95",
208
- :architecture => "x86_64",
209
- :aws_state_code => 0,
210
- :aws_image_id => "wmi-lucid4",
211
- :root_device_type => "",
212
- :ip_address => "nw-data=192.168.2.95",
213
- :dns_name => "nw-data=9pia8e7p.shpoolzz.vdc.local",
214
- :monitoring_state => "",
215
- :aws_instance_type => "is-testspec",
216
- :aws_state => "running",
217
- :private_dns_name => "9pia8e7p.shpoolzz.vdc.local",
218
- :aws_reason => ""
219
- }]
220
- end
221
-
222
- it "仮想サーバイメージの状態" do
223
- subject.describe_images_for_api([], :convert => :symbol).should == [{
224
- :root_device_name => "",
225
- :aws_ramdisk_id => "",
226
- :block_device_mappings => [{
227
- :ebs_snapshot_id => "",
228
- :ebs_volume_size => 0,
229
- :ebs_delete_on_termination => false,
230
- :device_name => ""
231
- }],
232
- :aws_is_public => false,
233
- :virtualization_type => "",
234
- :image_owner_alias => "",
235
- :aws_id => "wmi-lucid4",
236
- :aws_architecture => "x86",
237
- :root_device_type => "",
238
- :aws_location => "--- \n:snapshot_id: snap-lucid4\n",
239
- :aws_image_type => "",
240
- :name => "",
241
- :aws_state => "init",
242
- :description => "ubuntu-10.04_with-metadata_kvm_i386.raw volume",
243
- :aws_kernel_id => "",
244
- :tags => {},
245
- :aws_owner => "a-shpoolzz"
246
- }]
247
- end
248
-
249
- it "仮想サーバの起動" do
250
- subject.run_instances_for_api([], :convert => :symbol).should == [{
251
- :aws_launch_time => "2011-10-18T06:48:47Z",
252
- :tags => {},
253
- :aws_reservation_id => "",
254
- :aws_owner => "a-shpoolxx",
255
- :ami_launch_index => "",
256
- :aws_availability_zone => "",
257
- :aws_groups => ["ng-demofgr"],
258
- :ssh_key_name => nil,
259
- :virtualization_type => "",
260
- :placement_group_name => "",
261
- :aws_instance_id => "i-9pia8e7g",
262
- :aws_product_codes => [],
263
- :client_token => "",
264
- :aws_state_code => 0,
265
- :aws_image_id => "wmi-lucid4",
266
- :dns_name => nil,
267
- :aws_instance_type => "is-testspec",
268
- :aws_state => "scheduling",
269
- :private_dns_name => nil,
270
- :aws_reason => ""
271
- }]
272
- end
273
-
274
- it "仮想サーバの停止" do
275
- subject.terminate_instances_for_api([], :convert => :symbol).should == [{
276
- :aws_current_state_name => "",
277
- :aws_prev_state_name => "",
278
- :aws_prev_state_code => 0,
279
- :aws_current_state_code => 0,
280
- :aws_instance_id => "i-9pia8e7g"
281
- }]
282
- end
283
-
284
- it "物理サーバの状態" do
285
- subject.describe_host_nodes_for_api([], :convert => :symbol).should == [{
286
- :status => "online",
287
- :updated_at => "2011-10-18T03:53:24Z",
288
- :account_id => "a-shpoolzz",
289
- :offering_cpu_cores => 120,
290
- :offering_memory_size => 350000,
291
- :arch => "x86_64",
292
- :hypervisor => "kvm",
293
- :created_at => "2011-10-18T03:53:24Z",
294
- :name => "testhost",
295
- :uuid => "hp-testhost",
296
- :id => "hp-testhost"
297
- }]
298
- end
299
-
300
- it "仮想サーバスペックの状態" do
301
- subject.describe_instance_specs_for_api([], :convert => :symbol).should == [{
302
- :cpu_cores => 2,
303
- :memory_size => 512,
304
- :arch => "x86_64",
305
- :hypervisor => "kvm",
306
- :updated_at => "2011-10-28T02:58:57Z",
307
- :account_id => "a-shpoolzz",
308
- :vifs => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
309
- :quota_weight => 1.0,
310
- :id => "is-testspec",
311
- :created_at => "2011-10-28T02:58:57Z",
312
- :drives => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
313
- :uuid => "is-testspec"
314
- }]
315
- end
316
- end
317
-
318
- end
319
- end