fog-openstack 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -28
- data/docs/workflow.md +129 -0
- data/examples/workflow/workflow-examples.rb +387 -0
- data/gemfiles/Gemfile-1.9 +1 -0
- data/lib/fog/openstack.rb +5 -1
- data/lib/fog/openstack/baremetal.rb +14 -38
- data/lib/fog/openstack/compute.rb +4 -33
- data/lib/fog/openstack/core.rb +104 -50
- data/lib/fog/openstack/identity.rb +2 -1
- data/lib/fog/openstack/identity_v2.rb +0 -2
- data/lib/fog/openstack/identity_v3.rb +0 -2
- data/lib/fog/openstack/image_v1.rb +6 -6
- data/lib/fog/openstack/image_v2.rb +7 -6
- data/lib/fog/openstack/introspection.rb +10 -35
- data/lib/fog/openstack/metering.rb +16 -35
- data/lib/fog/openstack/monitoring.rb +5 -31
- data/lib/fog/openstack/network.rb +5 -34
- data/lib/fog/openstack/nfv.rb +10 -35
- data/lib/fog/openstack/orchestration.rb +5 -40
- data/lib/fog/openstack/planning.rb +11 -36
- data/lib/fog/openstack/requests/compute/get_limits.rb +8 -7
- data/lib/fog/openstack/requests/network/update_router.rb +1 -1
- data/lib/fog/openstack/requests/workflow_v2/create_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/create_action_execution.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/create_cron_trigger.rb +55 -0
- data/lib/fog/openstack/requests/workflow_v2/create_environment.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/create_execution.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/create_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/create_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_action.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_action_execution.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_cron_trigger.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_environment.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_execution.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_workbook.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_workflow.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/get_action.rb +27 -0
- data/lib/fog/openstack/requests/workflow_v2/get_action_execution.rb +26 -0
- data/lib/fog/openstack/requests/workflow_v2/get_cron_trigger.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_environment.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_execution.rb +26 -0
- data/lib/fog/openstack/requests/workflow_v2/get_task.rb +27 -0
- data/lib/fog/openstack/requests/workflow_v2/get_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_action_executions.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_actions.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/list_cron_triggers.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_environments.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_executions.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_services.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_tasks.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_workbooks.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_workflows.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/rerun_task.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/update_action_execution.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_environment.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/update_execution.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/update_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_workflow.rb +28 -0
- data/lib/fog/openstack/storage.rb +4 -35
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/openstack/volume_v1.rb +7 -5
- data/lib/fog/openstack/volume_v2.rb +7 -5
- data/lib/fog/openstack/workflow.rb +12 -0
- data/lib/fog/openstack/workflow_v2.rb +160 -0
- metadata +48 -95
- data/lib/fog/openstack/common.rb +0 -44
- data/tests/openstack/models/compute/images_tests.rb +0 -13
- data/tests/openstack/models/compute/security_group_tests.rb +0 -54
- data/tests/openstack/models/compute/server_tests.rb +0 -220
- data/tests/openstack/models/compute/service_tests.rb +0 -17
- data/tests/openstack/models/image/image_tests.rb +0 -36
- data/tests/openstack/models/image/images_tests.rb +0 -19
- data/tests/openstack/models/network/floating_ip_tests.rb +0 -35
- data/tests/openstack/models/network/floating_ips_tests.rb +0 -19
- data/tests/openstack/models/network/ike_policies_tests.rb +0 -28
- data/tests/openstack/models/network/ike_policy_tests.rb +0 -36
- data/tests/openstack/models/network/ipsec_policies_tests.rb +0 -26
- data/tests/openstack/models/network/ipsec_policy_tests.rb +0 -36
- data/tests/openstack/models/network/ipsec_site_connection_tests.rb +0 -50
- data/tests/openstack/models/network/ipsec_site_connections_tests.rb +0 -32
- data/tests/openstack/models/network/lb_health_monitor_tests.rb +0 -52
- data/tests/openstack/models/network/lb_health_monitors_tests.rb +0 -21
- data/tests/openstack/models/network/lb_member_tests.rb +0 -28
- data/tests/openstack/models/network/lb_members_tests.rb +0 -21
- data/tests/openstack/models/network/lb_pool_tests.rb +0 -53
- data/tests/openstack/models/network/lb_pools_tests.rb +0 -20
- data/tests/openstack/models/network/lb_vip_tests.rb +0 -39
- data/tests/openstack/models/network/lb_vips_tests.rb +0 -21
- data/tests/openstack/models/network/network_tests.rb +0 -61
- data/tests/openstack/models/network/networks_tests.rb +0 -21
- data/tests/openstack/models/network/port_tests.rb +0 -28
- data/tests/openstack/models/network/ports_tests.rb +0 -25
- data/tests/openstack/models/network/router_tests.rb +0 -39
- data/tests/openstack/models/network/routers_tests.rb +0 -21
- data/tests/openstack/models/network/security_group_rule_tests.rb +0 -27
- data/tests/openstack/models/network/security_group_rules_tests.rb +0 -25
- data/tests/openstack/models/network/security_group_tests.rb +0 -17
- data/tests/openstack/models/network/security_groups_tests.rb +0 -16
- data/tests/openstack/models/network/subnet_tests.rb +0 -30
- data/tests/openstack/models/network/subnets_tests.rb +0 -27
- data/tests/openstack/models/network/vpn_service_tests.rb +0 -27
- data/tests/openstack/models/network/vpn_services_tests.rb +0 -22
- data/tests/openstack/models/nfv/vnf_tests.rb +0 -35
- data/tests/openstack/models/nfv/vnfd_tests.rb +0 -23
- data/tests/openstack/models/nfv/vnfds_tests.rb +0 -31
- data/tests/openstack/models/nfv/vnfs_tests.rb +0 -38
- data/tests/openstack/models/planning/.gitkeep +0 -0
- data/tests/openstack/models/planning/plan_tests.rb +0 -51
- data/tests/openstack/models/planning/plans_tests.rb +0 -18
- data/tests/openstack/models/planning/role_tests.rb +0 -14
- data/tests/openstack/models/storage/file_tests.rb +0 -251
- data/tests/openstack/requests/compute/address_tests.rb +0 -58
- data/tests/openstack/requests/compute/aggregate_tests.rb +0 -59
- data/tests/openstack/requests/compute/availability_zone_tests.rb +0 -18
- data/tests/openstack/requests/compute/flavor_tests.rb +0 -95
- data/tests/openstack/requests/compute/helper.rb +0 -41
- data/tests/openstack/requests/compute/image_tests.rb +0 -58
- data/tests/openstack/requests/compute/keypair_tests.rb +0 -30
- data/tests/openstack/requests/compute/limit_tests.rb +0 -59
- data/tests/openstack/requests/compute/quota_tests.rb +0 -60
- data/tests/openstack/requests/compute/security_group_tests.rb +0 -61
- data/tests/openstack/requests/compute/server_tests.rb +0 -289
- data/tests/openstack/requests/compute/service_tests.rb +0 -33
- data/tests/openstack/requests/compute/tenant_tests.rb +0 -19
- data/tests/openstack/requests/compute/volume_tests.rb +0 -38
- data/tests/openstack/requests/image/image_tests.rb +0 -135
- data/tests/openstack/requests/metering/event_tests.rb +0 -17
- data/tests/openstack/requests/metering/meter_tests.rb +0 -52
- data/tests/openstack/requests/metering/resource_tests.rb +0 -19
- data/tests/openstack/requests/network/ike_policy_tests.rb +0 -65
- data/tests/openstack/requests/network/ipsec_policy_tests.rb +0 -65
- data/tests/openstack/requests/network/ipsec_site_connection_tests.rb +0 -82
- data/tests/openstack/requests/network/lb_health_monitor_tests.rb +0 -93
- data/tests/openstack/requests/network/lb_member_tests.rb +0 -60
- data/tests/openstack/requests/network/lb_pool_tests.rb +0 -80
- data/tests/openstack/requests/network/lb_vip_tests.rb +0 -71
- data/tests/openstack/requests/network/network_tests.rb +0 -107
- data/tests/openstack/requests/network/port_tests.rb +0 -66
- data/tests/openstack/requests/network/quota_tests.rb +0 -65
- data/tests/openstack/requests/network/router_tests.rb +0 -73
- data/tests/openstack/requests/network/security_group_rule_tests.rb +0 -58
- data/tests/openstack/requests/network/security_group_tests.rb +0 -43
- data/tests/openstack/requests/network/subnet_tests.rb +0 -66
- data/tests/openstack/requests/network/vpn_service_tests.rb +0 -61
- data/tests/openstack/requests/nfv/vnf_tests.rb +0 -70
- data/tests/openstack/requests/nfv/vnfd_tests.rb +0 -44
- data/tests/openstack/requests/orchestration/stack_tests.rb +0 -64
- data/tests/openstack/requests/planning/.gitkeep +0 -0
- data/tests/openstack/requests/planning/plan_tests.rb +0 -65
- data/tests/openstack/requests/planning/role_tests.rb +0 -16
- data/tests/openstack/requests/storage/container_tests.rb +0 -64
- data/tests/openstack/requests/storage/large_object_tests.rb +0 -372
- data/tests/openstack/requests/storage/object_tests.rb +0 -208
- data/tests/openstack/requests/volume/availability_zone_tests.rb +0 -13
- data/tests/openstack/requests/volume/quota_tests.rb +0 -50
- data/tests/openstack/requests/volume/volume_type_tests.rb +0 -32
@@ -1,44 +0,0 @@
|
|
1
|
-
Shindo.tests('@vnfd | NFV vnfds requests', ['openstack']) do
|
2
|
-
@nfv = Fog::NFV::OpenStack.new
|
3
|
-
|
4
|
-
@vnfds = {
|
5
|
-
"service_types" => Array,
|
6
|
-
"description" => String,
|
7
|
-
"tenant_id" => String,
|
8
|
-
"mgmt_driver" => String,
|
9
|
-
"infra_driver" => String,
|
10
|
-
"attributes" => Hash,
|
11
|
-
"id" => String,
|
12
|
-
"name" => String
|
13
|
-
}
|
14
|
-
|
15
|
-
tests('success') do
|
16
|
-
tests('#create_vnfds').data_matches_schema('vnfd' => @vnfds) do
|
17
|
-
vnfd_data = {:attributes => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_prop"\
|
18
|
-
"erties:\n Id: sample-vnfd\n vendor: tacker\n version: 1\n\nvdus:\n"\
|
19
|
-
" vdu1:\n id: vdu1\n vm_image: cirros\n instance_type: m1.ti"\
|
20
|
-
"ny\n\n network_interfaces:\n management:\n network: ne"\
|
21
|
-
"t_mgmt\n management: true\n pkt_in:\n network: net"\
|
22
|
-
"0\n pkt_out:\n network: net1\n\n placement_policy:\n "\
|
23
|
-
" availability_zone: nova\n\n auto-scaling: noop\n\n config:"\
|
24
|
-
"\n param0: key0\n param1: key1\n"},
|
25
|
-
:service_types => [{:service_type => "vnfd"}],
|
26
|
-
:mgmt_driver => "noop",
|
27
|
-
:infra_driver => "heat"}
|
28
|
-
auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin", "password" => "password"}}
|
29
|
-
@vnfd_body = @nfv.create_vnfd(:vnfd => vnfd_data, :auth => auth).body
|
30
|
-
end
|
31
|
-
|
32
|
-
tests('#list_vnfds').data_matches_schema('vnfds' => [@vnfds]) do
|
33
|
-
@nfv.list_vnfds.body
|
34
|
-
end
|
35
|
-
|
36
|
-
tests('#get_vnfds').data_matches_schema('vnfd' => @vnfds) do
|
37
|
-
@nfv.get_vnfd(@vnfd_body["vnfd"]["id"]).body
|
38
|
-
end
|
39
|
-
|
40
|
-
tests('#delete_vnfds').succeeds do
|
41
|
-
@nfv.delete_vnfd(@vnfd_body["vnfd"]["id"])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Orchestration[:openstack] | stack requests', ['openstack']) do
|
2
|
-
@stack_format = {
|
3
|
-
'links' => Array,
|
4
|
-
'id' => String,
|
5
|
-
'stack_name' => String,
|
6
|
-
'description' => Fog::Nullable::String,
|
7
|
-
'stack_status' => String,
|
8
|
-
'stack_status_reason' => String,
|
9
|
-
'creation_time' => Time,
|
10
|
-
'updated_time' => Time
|
11
|
-
}
|
12
|
-
|
13
|
-
@stack_detailed_format = {
|
14
|
-
"parent" => Fog::Nullable::String,
|
15
|
-
"disable_rollback" => Fog::Boolean,
|
16
|
-
"description" => String,
|
17
|
-
"links" => Array,
|
18
|
-
"stack_status_reason" => String,
|
19
|
-
"stack_name" => String,
|
20
|
-
"stack_user_project_id" => String,
|
21
|
-
"stack_owner" => String,
|
22
|
-
"creation_time" => Fog::Nullable::String,
|
23
|
-
"capabilities" => Array,
|
24
|
-
"notification_topics" => Array,
|
25
|
-
"updated_time" => Fog::Nullable::String,
|
26
|
-
"timeout_mins" => Fog::Nullable::String,
|
27
|
-
"stack_status" => String,
|
28
|
-
"parameters" => Hash,
|
29
|
-
"id" => String,
|
30
|
-
"outputs" => Array,
|
31
|
-
"template_description" => String
|
32
|
-
}
|
33
|
-
|
34
|
-
@create_format = {
|
35
|
-
'id' => String,
|
36
|
-
'links' => Array,
|
37
|
-
}
|
38
|
-
|
39
|
-
tests('success') do
|
40
|
-
tests('#create_stack("teststack")').formats(@create_format) do
|
41
|
-
@stack = Fog::Orchestration[:openstack].create_stack("teststack").body
|
42
|
-
end
|
43
|
-
|
44
|
-
tests('#list_stack_data').formats({'stacks' => [@stack_format]}) do
|
45
|
-
Fog::Orchestration[:openstack].list_stack_data.body
|
46
|
-
end
|
47
|
-
|
48
|
-
tests('#list_stack_data_Detailed').formats({'stacks' => [@stack_detailed_format]}) do
|
49
|
-
Fog::Orchestration[:openstack].list_stack_data_detailed.body
|
50
|
-
end
|
51
|
-
|
52
|
-
tests('#update_stack("teststack")').formats({}) do
|
53
|
-
Fog::Orchestration[:openstack].update_stack("teststack").body
|
54
|
-
end
|
55
|
-
|
56
|
-
tests('#patch_stack("teststack")').formats({}) do
|
57
|
-
Fog::Orchestration[:openstack].patch_stack(@stack).body
|
58
|
-
end
|
59
|
-
|
60
|
-
tests('#delete_stack("teststack", "id")').formats({}) do
|
61
|
-
Fog::Orchestration[:openstack].delete_stack("teststack", "id").body
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
File without changes
|
@@ -1,65 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Openstack[:planning] | Planning plan requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@plan_format = {
|
5
|
-
"created_at" => Fog::Nullable::String,
|
6
|
-
"description" => Fog::Nullable::String,
|
7
|
-
"name" => String,
|
8
|
-
"parameters" => Fog::Nullable::Array,
|
9
|
-
"roles" => Fog::Nullable::Array,
|
10
|
-
"updated_at" => Fog::Nullable::String,
|
11
|
-
"uuid" => String,
|
12
|
-
"version" => Fog::Nullable::Integer,
|
13
|
-
}
|
14
|
-
|
15
|
-
@plan_templates_format = Hash
|
16
|
-
|
17
|
-
tests('success') do
|
18
|
-
tests('#list_plans').data_matches_schema([@plan_format]) do
|
19
|
-
plans = Fog::Openstack[:planning].list_plans.body
|
20
|
-
@instance = plans.first
|
21
|
-
plans
|
22
|
-
end
|
23
|
-
|
24
|
-
tests('#get_plan').data_matches_schema(@plan_format) do
|
25
|
-
Fog::Openstack[:planning].get_plan(@instance['uuid']).body
|
26
|
-
end
|
27
|
-
|
28
|
-
tests('#delete_plan').succeeds do
|
29
|
-
Fog::Openstack[:planning].delete_plan(@instance['uuid'])
|
30
|
-
end
|
31
|
-
|
32
|
-
tests('#create_plan').data_matches_schema(@plan_format) do
|
33
|
-
plan_attributes = {
|
34
|
-
:name => 'test-plan-name',
|
35
|
-
:description => 'test-plan-desc',
|
36
|
-
}
|
37
|
-
@instance = Fog::Openstack[:planning].create_plan(plan_attributes).body
|
38
|
-
end
|
39
|
-
|
40
|
-
tests('#add_role_to_plan').data_matches_schema(@plan_format) do
|
41
|
-
@role_instance = Fog::Openstack[:planning].list_roles.body.first
|
42
|
-
Fog::Openstack[:planning].add_role_to_plan(@instance['uuid'], @role_instance['uuid']).body
|
43
|
-
end
|
44
|
-
|
45
|
-
tests('#patch_plan').data_matches_schema(@plan_format) do
|
46
|
-
parameters = Fog::Openstack[:planning].get_plan(@instance['uuid']).body['parameters'][0..1]
|
47
|
-
plan_parameters = parameters.map do |parameter|
|
48
|
-
{
|
49
|
-
"name" => parameter['name'],
|
50
|
-
"value" => "test-#{parameter['name']}-value",
|
51
|
-
}
|
52
|
-
end
|
53
|
-
Fog::Openstack[:planning].patch_plan(@instance['uuid'], plan_parameters).body
|
54
|
-
end
|
55
|
-
|
56
|
-
tests('#get_plan_templates').data_matches_schema(@plan_templates_format) do
|
57
|
-
Fog::Openstack[:planning].get_plan_templates(@instance['uuid']).body
|
58
|
-
end
|
59
|
-
|
60
|
-
tests('#remove_role_from_plan').data_matches_schema(@plan_format) do
|
61
|
-
Fog::Openstack[:planning].remove_role_from_plan(@instance['uuid'], @role_instance['uuid']).body
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Openstack[:planning] | Planning role requests', ['openstack']) do
|
2
|
-
openstack = Fog::Identity[:openstack]
|
3
|
-
|
4
|
-
@role_format = {
|
5
|
-
'description' => Fog::Nullable::String,
|
6
|
-
'name' => Fog::Nullable::String,
|
7
|
-
'uuid' => String,
|
8
|
-
'version' => Integer,
|
9
|
-
}
|
10
|
-
|
11
|
-
tests('success') do
|
12
|
-
tests('#list_roles').data_matches_schema([@role_format]) do
|
13
|
-
Fog::Openstack[:planning].list_roles.body
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Storage[:openstack] | container requests', ["openstack"]) do
|
2
|
-
|
3
|
-
@container_format = [String]
|
4
|
-
|
5
|
-
@containers_format = [{
|
6
|
-
'bytes' => Integer,
|
7
|
-
'count' => Integer,
|
8
|
-
'name' => String
|
9
|
-
}]
|
10
|
-
|
11
|
-
tests('success') do
|
12
|
-
|
13
|
-
tests("#put_container('fogcontainertests')").succeeds do
|
14
|
-
pending if Fog.mocking?
|
15
|
-
Fog::Storage[:openstack].put_container('fogcontainertests')
|
16
|
-
end
|
17
|
-
|
18
|
-
tests("#get_container('fogcontainertests')").formats(@container_format) do
|
19
|
-
pending if Fog.mocking?
|
20
|
-
Fog::Storage[:openstack].get_container('fogcontainertests').body
|
21
|
-
end
|
22
|
-
|
23
|
-
tests("#get_containers").formats(@containers_format) do
|
24
|
-
pending if Fog.mocking?
|
25
|
-
Fog::Storage[:openstack].get_containers.body
|
26
|
-
end
|
27
|
-
|
28
|
-
tests("#head_container('fogcontainertests')").succeeds do
|
29
|
-
pending if Fog.mocking?
|
30
|
-
Fog::Storage[:openstack].head_container('fogcontainertests')
|
31
|
-
end
|
32
|
-
|
33
|
-
tests("#head_containers").succeeds do
|
34
|
-
pending if Fog.mocking?
|
35
|
-
Fog::Storage[:openstack].head_containers
|
36
|
-
end
|
37
|
-
|
38
|
-
tests("#delete_container('fogcontainertests')").succeeds do
|
39
|
-
pending if Fog.mocking?
|
40
|
-
Fog::Storage[:openstack].delete_container('fogcontainertests')
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
tests('failure') do
|
46
|
-
|
47
|
-
tests("#get_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do
|
48
|
-
pending if Fog.mocking?
|
49
|
-
Fog::Storage[:openstack].get_container('fognoncontainer')
|
50
|
-
end
|
51
|
-
|
52
|
-
tests("#head_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do
|
53
|
-
pending if Fog.mocking?
|
54
|
-
Fog::Storage[:openstack].head_container('fognoncontainer')
|
55
|
-
end
|
56
|
-
|
57
|
-
tests("#delete_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do
|
58
|
-
pending if Fog.mocking?
|
59
|
-
Fog::Storage[:openstack].delete_container('fognoncontainer')
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
@@ -1,372 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Storage[:openstack] | large object requests', ['openstack']) do
|
2
|
-
|
3
|
-
unless Fog.mocking?
|
4
|
-
@directory = Fog::Storage[:openstack].directories.create(:key => 'foglargeobjecttests')
|
5
|
-
@directory2 = Fog::Storage[:openstack].directories.create(:key => 'foglargeobjecttests2')
|
6
|
-
@segments = {
|
7
|
-
:a => {
|
8
|
-
:container => @directory.identity,
|
9
|
-
:name => 'fog_large_object/a',
|
10
|
-
:data => 'a' * (1024**2 + 10),
|
11
|
-
:size => 1024**2 + 10,
|
12
|
-
:etag => 'c2e97007d59f0c19b850debdcb80cca5'
|
13
|
-
},
|
14
|
-
:b => {
|
15
|
-
:container => @directory.identity,
|
16
|
-
:name => 'fog_large_object/b',
|
17
|
-
:data => 'b' * (1024**2 + 20),
|
18
|
-
:size => 1024**2 + 20,
|
19
|
-
:etag => 'd35f50622a1259daad75ff7d5512c7ef'
|
20
|
-
},
|
21
|
-
:c => {
|
22
|
-
:container => @directory.identity,
|
23
|
-
:name => 'fog_large_object2/a',
|
24
|
-
:data => 'c' * (1024**2 + 30),
|
25
|
-
:size => 1024**2 + 30,
|
26
|
-
:etag => '901d3531a87d188041d4d5b43cb464c1'
|
27
|
-
},
|
28
|
-
:d => {
|
29
|
-
:container => @directory2.identity,
|
30
|
-
:name => 'fog_large_object2/b',
|
31
|
-
:data => 'd' * (1024**2 + 40),
|
32
|
-
:size => 1024**2 + 40,
|
33
|
-
:etag => '350c0e00525198813920a157df185c8d'
|
34
|
-
}
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
tests('success') do
|
39
|
-
|
40
|
-
tests('upload test segments').succeeds do
|
41
|
-
pending if Fog.mocking?
|
42
|
-
|
43
|
-
@segments.each_value do |segment|
|
44
|
-
Fog::Storage[:openstack].put_object(segment[:container], segment[:name], segment[:data])
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
tests('dynamic large object requests') do
|
49
|
-
pending if Fog.mocking?
|
50
|
-
|
51
|
-
tests('#put_object_manifest alias').succeeds do
|
52
|
-
Fog::Storage[:openstack].put_object_manifest(@directory.identity, 'fog_large_object')
|
53
|
-
end
|
54
|
-
|
55
|
-
tests('using default X-Object-Manifest header') do
|
56
|
-
|
57
|
-
tests('#put_dynamic_obj_manifest').succeeds do
|
58
|
-
Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object')
|
59
|
-
end
|
60
|
-
|
61
|
-
tests('#get_object streams all segments matching the default prefix').succeeds do
|
62
|
-
expected = @segments[:a][:data] + @segments[:b][:data] + @segments[:c][:data]
|
63
|
-
Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected
|
64
|
-
end
|
65
|
-
|
66
|
-
# When the manifest object name is equal to the segment prefix, OpenStack treats it as if it's the first segment.
|
67
|
-
# So you must prepend the manifest object's Etag - Digest::MD5.hexdigest('')
|
68
|
-
tests('#head_object returns Etag that includes manifest object in calculation').succeeds do
|
69
|
-
etags = ['d41d8cd98f00b204e9800998ecf8427e', @segments[:a][:etag], @segments[:b][:etag], @segments[:c][:etag]]
|
70
|
-
expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"2577f38428e895c50de6ea78ccc7da2a"\"
|
71
|
-
Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
tests('specifying X-Object-Manifest segment prefix') do
|
77
|
-
|
78
|
-
tests('#put_dynamic_obj_manifest').succeeds do
|
79
|
-
options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" }
|
80
|
-
Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object', options)
|
81
|
-
end
|
82
|
-
|
83
|
-
tests('#get_object streams segments only matching the specified prefix').succeeds do
|
84
|
-
expected = @segments[:a][:data] + @segments[:b][:data]
|
85
|
-
Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected
|
86
|
-
end
|
87
|
-
|
88
|
-
tests('#head_object returns Etag that does not include manifest object in calculation').succeeds do
|
89
|
-
etags = [@segments[:a][:etag], @segments[:b][:etag]]
|
90
|
-
expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"0f035ed3cc38aa0ef46dda3478fad44d"\"
|
91
|
-
Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
tests('storing manifest in a different container than the segments') do
|
97
|
-
|
98
|
-
tests('#put_dynamic_obj_manifest').succeeds do
|
99
|
-
options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" }
|
100
|
-
Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory2.identity, 'fog_large_object', options)
|
101
|
-
end
|
102
|
-
|
103
|
-
tests('#get_object').succeeds do
|
104
|
-
expected = @segments[:a][:data] + @segments[:b][:data]
|
105
|
-
Fog::Storage[:openstack].get_object(@directory2.identity, 'fog_large_object').body == expected
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
tests('static large object requests') do
|
113
|
-
pending if Fog.mocking?
|
114
|
-
|
115
|
-
tests('single container') do
|
116
|
-
|
117
|
-
tests('#put_static_obj_manifest').succeeds do
|
118
|
-
segments = [
|
119
|
-
{ :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }",
|
120
|
-
:etag => @segments[:a][:etag],
|
121
|
-
:size_bytes => @segments[:a][:size] },
|
122
|
-
{ :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }",
|
123
|
-
:etag => @segments[:c][:etag],
|
124
|
-
:size_bytes => @segments[:c][:size] }
|
125
|
-
]
|
126
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments)
|
127
|
-
end
|
128
|
-
|
129
|
-
tests('#head_object') do
|
130
|
-
etags = [@segments[:a][:etag], @segments[:c][:etag]]
|
131
|
-
etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"ad7e633a12e8a4915b45e6dd1d4b0b4b\""
|
132
|
-
content_length = (@segments[:a][:size] + @segments[:c][:size]).to_s
|
133
|
-
response = Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object')
|
134
|
-
|
135
|
-
returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] }
|
136
|
-
returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] }
|
137
|
-
returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] }
|
138
|
-
end
|
139
|
-
|
140
|
-
tests('#get_object').succeeds do
|
141
|
-
expected = @segments[:a][:data] + @segments[:c][:data]
|
142
|
-
Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected
|
143
|
-
end
|
144
|
-
|
145
|
-
tests('#delete_static_large_object') do
|
146
|
-
expected = {
|
147
|
-
'Number Not Found' => 0,
|
148
|
-
'Response Status' => '200 OK',
|
149
|
-
'Errors' => [],
|
150
|
-
'Number Deleted' => 3,
|
151
|
-
'Response Body' => ''
|
152
|
-
}
|
153
|
-
returns(expected, 'deletes manifest and segments') do
|
154
|
-
Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_large_object').body
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
tests('multiple containers') do
|
161
|
-
|
162
|
-
tests('#put_static_obj_manifest').succeeds do
|
163
|
-
segments = [
|
164
|
-
{ :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }",
|
165
|
-
:etag => @segments[:b][:etag],
|
166
|
-
:size_bytes => @segments[:b][:size] },
|
167
|
-
{ :path => "#{ @segments[:d][:container] }/#{ @segments[:d][:name] }",
|
168
|
-
:etag => @segments[:d][:etag],
|
169
|
-
:size_bytes => @segments[:d][:size] }
|
170
|
-
]
|
171
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory2.identity, 'fog_large_object', segments)
|
172
|
-
end
|
173
|
-
|
174
|
-
tests('#head_object') do
|
175
|
-
etags = [@segments[:b][:etag], @segments[:d][:etag]]
|
176
|
-
etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"9801a4cc4472896a1e975d03f0d2c3f8\""
|
177
|
-
content_length = (@segments[:b][:size] + @segments[:d][:size]).to_s
|
178
|
-
response = Fog::Storage[:openstack].head_object(@directory2.identity, 'fog_large_object')
|
179
|
-
|
180
|
-
returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] }
|
181
|
-
returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] }
|
182
|
-
returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] }
|
183
|
-
end
|
184
|
-
|
185
|
-
tests('#get_object').succeeds do
|
186
|
-
expected = @segments[:b][:data] + @segments[:d][:data]
|
187
|
-
Fog::Storage[:openstack].get_object(@directory2.identity, 'fog_large_object').body == expected
|
188
|
-
end
|
189
|
-
|
190
|
-
tests('#delete_static_large_object') do
|
191
|
-
expected = {
|
192
|
-
'Number Not Found' => 0,
|
193
|
-
'Response Status' => '200 OK',
|
194
|
-
'Errors' => [],
|
195
|
-
'Number Deleted' => 3,
|
196
|
-
'Response Body' => ''
|
197
|
-
}
|
198
|
-
returns(expected, 'deletes manifest and segments') do
|
199
|
-
Fog::Storage[:openstack].delete_static_large_object(@directory2.identity, 'fog_large_object').body
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
end
|
204
|
-
|
205
|
-
end
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
tests('failure') do
|
210
|
-
|
211
|
-
tests('dynamic large object requests') do
|
212
|
-
pending if Fog.mocking?
|
213
|
-
|
214
|
-
tests('#put_dynamic_obj_manifest with missing container').raises(Fog::Storage::OpenStack::NotFound) do
|
215
|
-
Fog::Storage[:openstack].put_dynamic_obj_manifest('fognoncontainer', 'fog_large_object')
|
216
|
-
end
|
217
|
-
|
218
|
-
end
|
219
|
-
|
220
|
-
tests('static large object requests') do
|
221
|
-
pending if Fog.mocking?
|
222
|
-
|
223
|
-
tests('upload test segments').succeeds do
|
224
|
-
Fog::Storage[:openstack].put_object(@segments[:a][:container], @segments[:a][:name], @segments[:a][:data])
|
225
|
-
Fog::Storage[:openstack].put_object(@segments[:b][:container], @segments[:b][:name], @segments[:b][:data])
|
226
|
-
end
|
227
|
-
|
228
|
-
tests('#put_static_obj_manifest with missing container').raises(Fog::Storage::OpenStack::NotFound) do
|
229
|
-
Fog::Storage[:openstack].put_static_obj_manifest('fognoncontainer', 'fog_large_object', [])
|
230
|
-
end
|
231
|
-
|
232
|
-
tests('#put_static_obj_manifest with missing object') do
|
233
|
-
segments = [
|
234
|
-
{ :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }",
|
235
|
-
:etag => @segments[:c][:etag],
|
236
|
-
:size_bytes => @segments[:c][:size] }
|
237
|
-
]
|
238
|
-
expected = { 'Errors' => [[segments[0][:path], '404 Not Found']] }
|
239
|
-
|
240
|
-
error = nil
|
241
|
-
begin
|
242
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments)
|
243
|
-
rescue => err
|
244
|
-
error = err
|
245
|
-
end
|
246
|
-
|
247
|
-
raises(Excon::Errors::BadRequest) do
|
248
|
-
raise error if error
|
249
|
-
end
|
250
|
-
|
251
|
-
returns(expected, 'returns error information') do
|
252
|
-
Fog::JSON.decode(error.response.body)
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
tests('#put_static_obj_manifest with invalid etag') do
|
257
|
-
segments = [
|
258
|
-
{ :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }",
|
259
|
-
:etag => @segments[:b][:etag],
|
260
|
-
:size_bytes => @segments[:a][:size] }
|
261
|
-
]
|
262
|
-
expected = { 'Errors' => [[segments[0][:path], 'Etag Mismatch']] }
|
263
|
-
|
264
|
-
error = nil
|
265
|
-
begin
|
266
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments)
|
267
|
-
rescue => err
|
268
|
-
error = err
|
269
|
-
end
|
270
|
-
|
271
|
-
raises(Excon::Errors::BadRequest) do
|
272
|
-
raise error if error
|
273
|
-
end
|
274
|
-
|
275
|
-
returns(expected, 'returns error information') do
|
276
|
-
Fog::JSON.decode(error.response.body)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
tests('#put_static_obj_manifest with invalid byte_size') do
|
281
|
-
segments = [
|
282
|
-
{ :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }",
|
283
|
-
:etag => @segments[:a][:etag],
|
284
|
-
:size_bytes => @segments[:b][:size] }
|
285
|
-
]
|
286
|
-
expected = { 'Errors' => [[segments[0][:path], 'Size Mismatch']] }
|
287
|
-
|
288
|
-
error = nil
|
289
|
-
begin
|
290
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments)
|
291
|
-
rescue => err
|
292
|
-
error = err
|
293
|
-
end
|
294
|
-
|
295
|
-
raises(Excon::Errors::BadRequest) do
|
296
|
-
raise error if error
|
297
|
-
end
|
298
|
-
|
299
|
-
returns(expected, 'returns error information') do
|
300
|
-
Fog::JSON.decode(error.response.body)
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
tests('#delete_static_large_object with missing container') do
|
305
|
-
expected = {
|
306
|
-
'Number Not Found' => 1,
|
307
|
-
'Response Status' => '200 OK',
|
308
|
-
'Errors' => [],
|
309
|
-
'Number Deleted' => 0,
|
310
|
-
'Response Body' => ''
|
311
|
-
}
|
312
|
-
|
313
|
-
returns(expected, 'reports missing object') do
|
314
|
-
Fog::Storage[:openstack].delete_static_large_object('fognoncontainer', 'fog_large_object').body
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
tests('#delete_static_large_object with missing manifest') do
|
319
|
-
expected = {
|
320
|
-
'Number Not Found' => 1,
|
321
|
-
'Response Status' => '200 OK',
|
322
|
-
'Errors' => [],
|
323
|
-
'Number Deleted' => 0,
|
324
|
-
'Response Body' => ''
|
325
|
-
}
|
326
|
-
|
327
|
-
returns(expected, 'reports missing manifest') do
|
328
|
-
Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_non_object').body
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
tests('#delete_static_large_object with missing segment') do
|
333
|
-
|
334
|
-
tests('#put_static_obj_manifest for segments :a and :b').succeeds do
|
335
|
-
segments = [
|
336
|
-
{ :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }",
|
337
|
-
:etag => @segments[:a][:etag],
|
338
|
-
:size_bytes => @segments[:a][:size] },
|
339
|
-
{ :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }",
|
340
|
-
:etag => @segments[:b][:etag],
|
341
|
-
:size_bytes => @segments[:b][:size] }
|
342
|
-
]
|
343
|
-
Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments)
|
344
|
-
end
|
345
|
-
|
346
|
-
tests('#delete_object segment :b').succeeds do
|
347
|
-
Fog::Storage[:openstack].delete_object(@segments[:b][:container], @segments[:b][:name])
|
348
|
-
end
|
349
|
-
|
350
|
-
tests('#delete_static_large_object') do
|
351
|
-
expected = {
|
352
|
-
'Number Not Found' => 1,
|
353
|
-
'Response Status' => '200 OK',
|
354
|
-
'Errors' => [],
|
355
|
-
'Number Deleted' => 2,
|
356
|
-
'Response Body' => ''
|
357
|
-
}
|
358
|
-
returns(expected, 'deletes manifest and segment :a, and reports missing segment :b') do
|
359
|
-
Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_large_object').body
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
end
|
367
|
-
|
368
|
-
unless Fog.mocking?
|
369
|
-
@directory.destroy
|
370
|
-
@directory2.destroy
|
371
|
-
end
|
372
|
-
end
|