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.
- data/Gemfile +1 -27
- data/Gemfile.lock +60 -73
- data/README.rdoc +2 -2
- data/bin/create_indexes_for_tengine_resource +18 -0
- data/lib/tengine/resource/config/resource.rb +0 -3
- data/lib/tengine/resource/credential.rb +16 -17
- data/lib/tengine/resource/net_ssh.rb +22 -10
- data/lib/tengine/resource/physical_server.rb +8 -0
- data/lib/tengine/resource/provider.rb +206 -35
- data/lib/tengine/resource/server.rb +3 -3
- data/lib/tengine/resource/virtual_server.rb +1 -1
- data/lib/tengine/resource/virtual_server_image.rb +8 -8
- data/lib/tengine/resource/virtual_server_type.rb +2 -2
- data/lib/tengine/resource/watcher.rb +39 -9
- data/tmp/.gitkeep +0 -0
- metadata +92 -141
- data/.document +0 -5
- data/.rspec +0 -1
- data/Rakefile +0 -42
- data/VERSION +0 -1
- data/config/.gitignore +0 -2
- data/lib/tengine/resource/credential/ec2.rb +0 -5
- data/lib/tengine/resource/credential/ec2/dummy.rb +0 -148
- data/lib/tengine/resource/credential/ec2/launch_options.rb +0 -179
- data/lib/tengine/resource/provider/ec2.rb +0 -187
- data/lib/tengine/resource/provider/wakame.rb +0 -638
- data/spec/fixtures/goku_at_ec2_ap_northeast.rb +0 -177
- data/spec/mongoid.yml +0 -35
- data/spec/mongoid_en.yml +0 -48
- data/spec/spec_helper.rb +0 -43
- data/spec/support/ec2.rb +0 -129
- data/spec/support/mongo_index_key_log.rb +0 -91
- data/spec/tengine/resource/bugfix/watcher_for_wakame_spec.rb +0 -232
- data/spec/tengine/resource/credential_spec.rb +0 -205
- data/spec/tengine/resource/drivers/resource_control_driver_spec.rb +0 -84
- data/spec/tengine/resource/net_ssh_spec.rb +0 -148
- data/spec/tengine/resource/physical_server_spec.rb +0 -47
- data/spec/tengine/resource/provider/ec2_spec.rb +0 -473
- data/spec/tengine/resource/provider/test_files/describe_host_nodes.json +0 -22
- data/spec/tengine/resource/provider/test_files/describe_images.json +0 -23
- data/spec/tengine/resource/provider/test_files/describe_instance_specs.json +0 -23
- data/spec/tengine/resource/provider/test_files/describe_instances.json +0 -56
- data/spec/tengine/resource/provider/test_files/run_instances.json +0 -30
- data/spec/tengine/resource/provider/test_files/terminate_instances.json +0 -3
- data/spec/tengine/resource/provider/wakame/00_describe_host_nodes_0_physical_servers.json +0 -8
- data/spec/tengine/resource/provider/wakame/01_describe_host_nodes_10_physical_servers.json +0 -139
- data/spec/tengine/resource/provider/wakame/02_describe_host_nodes_60_physical_servers.json +0 -795
- data/spec/tengine/resource/provider/wakame/10_describe_instances_0_virtual_servers.json +0 -8
- data/spec/tengine/resource/provider/wakame/11_describe_instances_10_virtual_servers.json +0 -469
- data/spec/tengine/resource/provider/wakame/12_describe_instances_after_run_instances.json +0 -280
- data/spec/tengine/resource/provider/wakame/13_describe_instances_after_terminate_instances.json +0 -279
- data/spec/tengine/resource/provider/wakame/20_describe_images_0_virtual_server_images.json +0 -8
- data/spec/tengine/resource/provider/wakame/21_describe_images_5_virtual_server_images.json +0 -84
- data/spec/tengine/resource/provider/wakame/22_describe_images_60_virtual_server_images.json +0 -856
- data/spec/tengine/resource/provider/wakame/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
- data/spec/tengine/resource/provider/wakame/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
- data/spec/tengine/resource/provider/wakame/40_run_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/provider/wakame/41_run_instances_1_virtual_servers.json +0 -22
- data/spec/tengine/resource/provider/wakame/42_run_instances_5_virtual_servers.json +0 -106
- data/spec/tengine/resource/provider/wakame/50_terminate_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/provider/wakame/51_terminate_instances_3_virtual_servers.json +0 -5
- data/spec/tengine/resource/provider/wakame/sync_physical_servers_spec.rb +0 -114
- data/spec/tengine/resource/provider/wakame/sync_virtual_server_images_spec.rb +0 -116
- data/spec/tengine/resource/provider/wakame/sync_virtual_server_types_spec.rb +0 -116
- data/spec/tengine/resource/provider/wakame/sync_virtual_servers_spec.rb +0 -216
- data/spec/tengine/resource/provider/wakame_api_spec.rb +0 -319
- data/spec/tengine/resource/provider/wakame_spec.rb +0 -339
- data/spec/tengine/resource/provider_spec.rb +0 -252
- data/spec/tengine/resource/server_spec.rb +0 -195
- data/spec/tengine/resource/test_files/.gitignore +0 -6
- data/spec/tengine/resource/test_files/00_describe_host_nodes_0_physical_servers.json +0 -8
- data/spec/tengine/resource/test_files/01_describe_host_nodes_10_physical_servers.json +0 -139
- data/spec/tengine/resource/test_files/02_describe_host_nodes_60_physical_servers.json +0 -795
- data/spec/tengine/resource/test_files/10_describe_instances_0_virtual_servers.json +0 -8
- data/spec/tengine/resource/test_files/11_describe_instances_10_virtual_servers.json +0 -469
- data/spec/tengine/resource/test_files/12_describe_instances_after_run_instances.json +0 -280
- data/spec/tengine/resource/test_files/13_describe_instances_after_terminate_instances.json +0 -279
- data/spec/tengine/resource/test_files/14_describe_instances_after_run_1_instance.json +0 -55
- data/spec/tengine/resource/test_files/20_describe_images_0_virtual_server_images.json +0 -8
- data/spec/tengine/resource/test_files/21_describe_images_5_virtual_server_images.json +0 -84
- data/spec/tengine/resource/test_files/22_describe_images_60_virtual_server_images.json +0 -856
- data/spec/tengine/resource/test_files/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
- data/spec/tengine/resource/test_files/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
- data/spec/tengine/resource/test_files/40_run_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/test_files/41_run_instances_1_virtual_servers.json +0 -22
- data/spec/tengine/resource/test_files/42_run_instances_5_virtual_servers.json +0 -106
- data/spec/tengine/resource/test_files/43_run_instances_1_virtual_servers_without_aws_availability_zone.json +0 -22
- data/spec/tengine/resource/test_files/50_terminate_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/test_files/51_terminate_instances_3_virtual_servers.json +0 -5
- data/spec/tengine/resource/virtual_server_image_spec.rb +0 -94
- data/spec/tengine/resource/virtual_server_spec.rb +0 -116
- data/spec/tengine/resource/virtual_server_type_spec.rb +0 -4
- data/spec/tengine/resource/watcher_spec.rb +0 -1027
- data/spec/tengine_resource_spec.rb +0 -5
- data/tengine_resource.gemspec +0 -172
- data/tmp/log/.gitignore +0 -1
data/spec/tengine/resource/provider/wakame/31_describe_instance_specs_4_virtual_server_specs.json
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"owner_total": 2,
|
4
|
-
"start": 0,
|
5
|
-
"results": [
|
6
|
-
{
|
7
|
-
"id": "virtual_server_spec_id_01",
|
8
|
-
"uuid": "virtual_server_spec_name_01",
|
9
|
-
"cpu_cores": 1,
|
10
|
-
"memory_size": 256,
|
11
|
-
"arch": "x86_64",
|
12
|
-
"hypervisor": "kvm",
|
13
|
-
"updated_at": "2011-10-28T02:58:57Z",
|
14
|
-
"account_id": "a-shpoolxx",
|
15
|
-
"vifs": "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
16
|
-
"quota_weight": 1.0,
|
17
|
-
"created_at": "2011-10-28T02:58:57Z",
|
18
|
-
"drives": "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n"
|
19
|
-
},
|
20
|
-
{
|
21
|
-
"id": "virtual_server_spec_id_02",
|
22
|
-
"uuid": "virtual_server_spec_name_02",
|
23
|
-
"cpu_cores": 2,
|
24
|
-
"memory_size": 512,
|
25
|
-
"arch": "x86_64",
|
26
|
-
"hypervisor": "kvm",
|
27
|
-
"updated_at": "2011-10-28T02:58:57Z",
|
28
|
-
"account_id": "a-shpoolxx",
|
29
|
-
"vifs": "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
30
|
-
"quota_weight": 1.0,
|
31
|
-
"created_at": "2011-10-28T02:58:57Z",
|
32
|
-
"drives": "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n"
|
33
|
-
},
|
34
|
-
{
|
35
|
-
"id": "virtual_server_spec_id_03",
|
36
|
-
"uuid": "virtual_server_spec_name_03",
|
37
|
-
"cpu_cores": 5,
|
38
|
-
"memory_size": 1,
|
39
|
-
"arch": "x86_64",
|
40
|
-
"hypervisor": "kvm",
|
41
|
-
"updated_at": "2011-10-28T02:58:57Z",
|
42
|
-
"account_id": "a-shpoolxx",
|
43
|
-
"vifs": "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
44
|
-
"quota_weight": 1.0,
|
45
|
-
"created_at": "2011-10-28T02:58:57Z",
|
46
|
-
"drives": "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n"
|
47
|
-
},
|
48
|
-
{
|
49
|
-
"id": "virtual_server_spec_id_04",
|
50
|
-
"uuid": "virtual_server_spec_name_04",
|
51
|
-
"cpu_cores": 1,
|
52
|
-
"memory_size": 1500,
|
53
|
-
"arch": "x86_64",
|
54
|
-
"hypervisor": "kvm",
|
55
|
-
"updated_at": "2011-10-28T02:58:57Z",
|
56
|
-
"account_id": "a-shpoolxx",
|
57
|
-
"vifs": "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
58
|
-
"quota_weight": 1.0,
|
59
|
-
"created_at": "2011-10-28T02:58:57Z",
|
60
|
-
"drives": "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n"
|
61
|
-
}
|
62
|
-
|
63
|
-
],
|
64
|
-
"limit": null
|
65
|
-
}
|
66
|
-
]
|
@@ -1 +0,0 @@
|
|
1
|
-
[]
|
@@ -1,22 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"id": "virtual_server_id_91",
|
4
|
-
"state": "scheduling",
|
5
|
-
"image_id": "vertual_server_iamge_id_01",
|
6
|
-
"hostname": "physical_server_name_01",
|
7
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
8
|
-
"vif": [],
|
9
|
-
"status": "init",
|
10
|
-
"memory_size": 256,
|
11
|
-
"ha_enabled": 0,
|
12
|
-
"network": [],
|
13
|
-
"arch": "x86_64",
|
14
|
-
"host_node": null,
|
15
|
-
"created_at": "2011-10-18T06:48:47Z",
|
16
|
-
"netfilter_group_id": ["ng-demofgr"],
|
17
|
-
"ssh_key_pair": null,
|
18
|
-
"volume": [],
|
19
|
-
"netfilter_group": ["default"],
|
20
|
-
"cpu_cores": 1
|
21
|
-
}
|
22
|
-
]
|
@@ -1,106 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"id": "virtual_server_id_92",
|
4
|
-
"state": "scheduling",
|
5
|
-
"image_id": "vertual_server_iamge_id_01",
|
6
|
-
"hostname": "physical_server_name_01",
|
7
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
8
|
-
"vif": [],
|
9
|
-
"status": "init",
|
10
|
-
"memory_size": 256,
|
11
|
-
"ha_enabled": 0,
|
12
|
-
"network": [],
|
13
|
-
"arch": "x86_64",
|
14
|
-
"host_node": null,
|
15
|
-
"created_at": "2011-10-18T06:48:47Z",
|
16
|
-
"netfilter_group_id": ["ng-demofgr"],
|
17
|
-
"ssh_key_pair": null,
|
18
|
-
"volume": [],
|
19
|
-
"netfilter_group": ["default"],
|
20
|
-
"cpu_cores": 1
|
21
|
-
},
|
22
|
-
|
23
|
-
{
|
24
|
-
"id": "virtual_server_id_93",
|
25
|
-
"state": "scheduling",
|
26
|
-
"image_id": "vertual_server_iamge_id_01",
|
27
|
-
"hostname": "physical_server_name_01",
|
28
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
29
|
-
"vif": [],
|
30
|
-
"status": "init",
|
31
|
-
"memory_size": 256,
|
32
|
-
"ha_enabled": 0,
|
33
|
-
"network": [],
|
34
|
-
"arch": "x86_64",
|
35
|
-
"host_node": null,
|
36
|
-
"created_at": "2011-10-18T06:48:47Z",
|
37
|
-
"netfilter_group_id": ["ng-demofgr"],
|
38
|
-
"ssh_key_pair": null,
|
39
|
-
"volume": [],
|
40
|
-
"netfilter_group": ["default"],
|
41
|
-
"cpu_cores": 1
|
42
|
-
},
|
43
|
-
|
44
|
-
{
|
45
|
-
"id": "virtual_server_id_94",
|
46
|
-
"state": "scheduling",
|
47
|
-
"image_id": "vertual_server_iamge_id_01",
|
48
|
-
"hostname": "physical_server_name_01",
|
49
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
50
|
-
"vif": [],
|
51
|
-
"status": "init",
|
52
|
-
"memory_size": 256,
|
53
|
-
"ha_enabled": 0,
|
54
|
-
"network": [],
|
55
|
-
"arch": "x86_64",
|
56
|
-
"host_node": null,
|
57
|
-
"created_at": "2011-10-18T06:48:47Z",
|
58
|
-
"netfilter_group_id": ["ng-demofgr"],
|
59
|
-
"ssh_key_pair": null,
|
60
|
-
"volume": [],
|
61
|
-
"netfilter_group": ["default"],
|
62
|
-
"cpu_cores": 1
|
63
|
-
},
|
64
|
-
|
65
|
-
{
|
66
|
-
"id": "virtual_server_id_95",
|
67
|
-
"state": "scheduling",
|
68
|
-
"image_id": "vertual_server_iamge_id_01",
|
69
|
-
"hostname": "physical_server_name_01",
|
70
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
71
|
-
"vif": [],
|
72
|
-
"status": "init",
|
73
|
-
"memory_size": 256,
|
74
|
-
"ha_enabled": 0,
|
75
|
-
"network": [],
|
76
|
-
"arch": "x86_64",
|
77
|
-
"host_node": null,
|
78
|
-
"created_at": "2011-10-18T06:48:47Z",
|
79
|
-
"netfilter_group_id": ["ng-demofgr"],
|
80
|
-
"ssh_key_pair": null,
|
81
|
-
"volume": [],
|
82
|
-
"netfilter_group": ["default"],
|
83
|
-
"cpu_cores": 1
|
84
|
-
},
|
85
|
-
|
86
|
-
{
|
87
|
-
"id": "virtual_server_id_96",
|
88
|
-
"state": "scheduling",
|
89
|
-
"image_id": "vertual_server_iamge_id_01",
|
90
|
-
"hostname": "physical_server_name_01",
|
91
|
-
"instance_spec_id": "virtual_server_spec_id_01",
|
92
|
-
"vif": [],
|
93
|
-
"status": "init",
|
94
|
-
"memory_size": 256,
|
95
|
-
"ha_enabled": 0,
|
96
|
-
"network": [],
|
97
|
-
"arch": "x86_64",
|
98
|
-
"host_node": null,
|
99
|
-
"created_at": "2011-10-18T06:48:47Z",
|
100
|
-
"netfilter_group_id": ["ng-demofgr"],
|
101
|
-
"ssh_key_pair": null,
|
102
|
-
"volume": [],
|
103
|
-
"netfilter_group": ["default"],
|
104
|
-
"cpu_cores": 1
|
105
|
-
}
|
106
|
-
]
|
@@ -1 +0,0 @@
|
|
1
|
-
[]
|
@@ -1,114 +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 :physical_server_watch do
|
14
|
-
def setup_describe_host_node_file(filename)
|
15
|
-
subject.connection_settings[:options] = {
|
16
|
-
:describe_host_nodes_file => File.expand_path(filename, File.dirname(__FILE__))
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
context "初期登録時" do
|
22
|
-
before{ Tengine::Resource::PhysicalServer.delete_all }
|
23
|
-
|
24
|
-
context "Wakameが0件返す場合" do
|
25
|
-
before{ setup_describe_host_node_file("00_describe_host_nodes_0_physical_servers.json")}
|
26
|
-
it "件数は増えない" do
|
27
|
-
expect{
|
28
|
-
subject.physical_server_watch
|
29
|
-
}.to_not change(Tengine::Resource::PhysicalServer, :count)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "Wakameが10件返す場合" do
|
34
|
-
before{ setup_describe_host_node_file("01_describe_host_nodes_10_physical_servers.json")}
|
35
|
-
it "10件増える" do
|
36
|
-
expect{
|
37
|
-
subject.physical_server_watch
|
38
|
-
}.to change(Tengine::Resource::PhysicalServer, :count).by(10)
|
39
|
-
Tengine::Resource::PhysicalServer.all.each do |server|
|
40
|
-
server.provided_id.should_not == nil
|
41
|
-
server.name.should_not == nil
|
42
|
-
server.provider_id.should == subject.id
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "10件登録されているとき" do
|
49
|
-
context "テスト用JSONと同じIDのデータが登録されている" do
|
50
|
-
before do
|
51
|
-
Tengine::Resource::PhysicalServer.delete_all
|
52
|
-
subject.physical_servers.tap do |servers|
|
53
|
-
(1..10).each do |idx|
|
54
|
-
servers.create!(:provided_id => "physical_server_id_%02d" % idx, :name => "physical_server_name_%02d" % idx)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "Wakameが0件返す場合" do
|
60
|
-
before{ setup_describe_host_node_file("00_describe_host_nodes_0_physical_servers.json")}
|
61
|
-
it "10件削除される" do
|
62
|
-
expect{
|
63
|
-
subject.physical_server_watch
|
64
|
-
}.to change(Tengine::Resource::PhysicalServer, :count).by(-10)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "Wakameが同じ10件返す場合" do
|
69
|
-
before{ setup_describe_host_node_file("01_describe_host_nodes_10_physical_servers.json")}
|
70
|
-
it "件数もデータも変わらず" do
|
71
|
-
ids = Tengine::Resource::PhysicalServer.all.map(&:id).map(&:to_s).sort
|
72
|
-
expect{
|
73
|
-
subject.physical_server_watch
|
74
|
-
}.to_not change(Tengine::Resource::PhysicalServer, :count)
|
75
|
-
Tengine::Resource::PhysicalServer.all.map(&:id).map(&:to_s).sort.should == ids
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context "テスト用JSONと異なるIDのデータが登録されている" do
|
81
|
-
before do
|
82
|
-
Tengine::Resource::PhysicalServer.delete_all
|
83
|
-
subject.physical_servers.tap do |servers|
|
84
|
-
(11..20).each do |idx|
|
85
|
-
servers.create!(:provided_id => "physical_server_id_%02d" % idx, :name => "physical_server_name_%02d" % idx)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "Wakameが0件返す場合" do
|
91
|
-
before{ setup_describe_host_node_file("00_describe_host_nodes_0_physical_servers.json")}
|
92
|
-
it "10件削除される" do
|
93
|
-
expect{
|
94
|
-
subject.physical_server_watch
|
95
|
-
}.to change(Tengine::Resource::PhysicalServer, :count).by(-10)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context "Wakameが同じ10件返す場合" do
|
100
|
-
before{ setup_describe_host_node_file("01_describe_host_nodes_10_physical_servers.json")}
|
101
|
-
it "件数は変わらないが、データは変わっている" do
|
102
|
-
ids = Tengine::Resource::PhysicalServer.all.map(&:id).map(&:to_s).sort
|
103
|
-
expect{
|
104
|
-
subject.physical_server_watch
|
105
|
-
}.to_not change(Tengine::Resource::PhysicalServer, :count)
|
106
|
-
Tengine::Resource::PhysicalServer.all.map(&:id).map(&:to_s).sort.should_not == ids
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
@@ -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_image_watch do
|
14
|
-
def setup_describe_images_file(filename)
|
15
|
-
subject.connection_settings[:options] = {
|
16
|
-
:describe_images_file => File.expand_path(filename, File.dirname(__FILE__))
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
context "初期登録時" do
|
22
|
-
before{ Tengine::Resource::VirtualServerImage.delete_all }
|
23
|
-
|
24
|
-
context "Wakameが0件返す場合" do
|
25
|
-
before{ setup_describe_images_file("20_describe_images_0_virtual_server_images.json")}
|
26
|
-
it "件数は増えない" do
|
27
|
-
expect{
|
28
|
-
subject.virtual_server_image_watch
|
29
|
-
}.to_not change(Tengine::Resource::VirtualServerImage, :count)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "Wakameが5件返す場合" do
|
34
|
-
before{ setup_describe_images_file("21_describe_images_5_virtual_server_images.json")}
|
35
|
-
it "5件増える" do
|
36
|
-
expect{
|
37
|
-
subject.virtual_server_image_watch
|
38
|
-
}.to change(Tengine::Resource::VirtualServerImage, :count).by(5)
|
39
|
-
Tengine::Resource::VirtualServerImage.all.each do |server|
|
40
|
-
server.provided_id.should_not == nil
|
41
|
-
server.name.should_not == nil
|
42
|
-
server.provider_id.should == subject.id
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "5件登録されているとき" do
|
49
|
-
context "テスト用JSONと同じIDのデータが登録されている" do
|
50
|
-
before do
|
51
|
-
Tengine::Resource::VirtualServerImage.delete_all
|
52
|
-
subject.virtual_server_images.tap do |servers|
|
53
|
-
(1..5).each do |idx|
|
54
|
-
# TODO virtual_server_image_uuid_ ではなくて、 virtual_server_image_id_ では?
|
55
|
-
servers.create!(:provided_id => "virtual_server_image_uuid_%02d" % idx, :name => "virtual_server_image_id_%02d" % idx)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "Wakameが0件返す場合" do
|
61
|
-
before{ setup_describe_images_file("20_describe_images_0_virtual_server_images.json")}
|
62
|
-
it "5件削除される" do
|
63
|
-
expect{
|
64
|
-
subject.virtual_server_image_watch
|
65
|
-
}.to change(Tengine::Resource::VirtualServerImage, :count).by(-5)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context "Wakameが同じ5件返す場合" do
|
70
|
-
before{ setup_describe_images_file("21_describe_images_5_virtual_server_images.json")}
|
71
|
-
it "件数もデータも変わらず" do
|
72
|
-
ids = Tengine::Resource::VirtualServerImage.all.map(&:id).map(&:to_s).sort
|
73
|
-
expect{
|
74
|
-
subject.virtual_server_image_watch
|
75
|
-
}.to_not change(Tengine::Resource::VirtualServerImage, :count)
|
76
|
-
Tengine::Resource::VirtualServerImage.all.map(&:id).map(&:to_s).sort.should == ids
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context "テスト用JSONと異なるIDのデータが登録されている" do
|
82
|
-
before do
|
83
|
-
Tengine::Resource::VirtualServerImage.delete_all
|
84
|
-
subject.virtual_server_images.tap do |servers|
|
85
|
-
(11..15).each do |idx|
|
86
|
-
# TODO virtual_server_image_uuid_ ではなくて、 virtual_server_image_id_ では?
|
87
|
-
servers.create!(:provided_id => "virtual_server_image_uuid_%02d" % idx, :name => "virtual_server_image_name_%02d" % idx)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context "Wakameが0件返す場合" do
|
93
|
-
before{ setup_describe_images_file("20_describe_images_0_virtual_server_images.json")}
|
94
|
-
it "5件削除される" do
|
95
|
-
expect{
|
96
|
-
subject.virtual_server_image_watch
|
97
|
-
}.to change(Tengine::Resource::VirtualServerImage, :count).by(-5)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "Wakameが登録されているものとは異なる5件返す場合" do
|
102
|
-
before{ setup_describe_images_file("21_describe_images_5_virtual_server_images.json")}
|
103
|
-
it "件数は変わらないが、データは変わっている" do
|
104
|
-
ids = Tengine::Resource::VirtualServerImage.all.map(&:id).map(&:to_s).sort
|
105
|
-
expect{
|
106
|
-
subject.virtual_server_image_watch
|
107
|
-
}.to_not change(Tengine::Resource::VirtualServerImage, :count)
|
108
|
-
Tengine::Resource::VirtualServerImage.all.map(&:id).map(&:to_s).sort.should_not == ids
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|