fog-oraclecloud 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fog/oraclecloud/compute.rb +27 -1
- data/lib/fog/oraclecloud/database.rb +12 -41
- data/lib/fog/oraclecloud/java.rb +17 -45
- data/lib/fog/oraclecloud/models/compute/instance.rb +6 -2
- data/lib/fog/oraclecloud/models/database/instance.rb +14 -6
- data/lib/fog/oraclecloud/models/database/instances.rb +1 -5
- data/lib/fog/oraclecloud/models/java/instance.rb +12 -3
- data/lib/fog/oraclecloud/models/java/instances.rb +1 -5
- data/lib/fog/oraclecloud/requests/compute/create_instance.rb +21 -0
- data/lib/fog/oraclecloud/requests/compute/create_orchestration.rb +36 -0
- data/lib/fog/oraclecloud/requests/compute/create_ssh_key.rb +19 -0
- data/lib/fog/oraclecloud/requests/compute/delete_instance.rb +11 -0
- data/lib/fog/oraclecloud/requests/compute/delete_ssh_key.rb +10 -0
- data/lib/fog/oraclecloud/requests/compute/get_instance.rb +21 -0
- data/lib/fog/oraclecloud/requests/compute/get_orchestration.rb +15 -0
- data/lib/fog/oraclecloud/requests/compute/get_ssh_key.rb +15 -0
- data/lib/fog/oraclecloud/requests/compute/list_instances.rb +12 -0
- data/lib/fog/oraclecloud/requests/compute/list_ssh_keys.rb +13 -0
- data/lib/fog/oraclecloud/requests/compute/update_orchestration.rb +31 -0
- data/lib/fog/oraclecloud/requests/compute/update_ssh_key.rb +20 -0
- data/lib/fog/oraclecloud/requests/database/create_instance.rb +16 -6
- data/lib/fog/oraclecloud/requests/database/delete_instance.rb +5 -10
- data/lib/fog/oraclecloud/requests/database/get_instance.rb +19 -11
- data/lib/fog/oraclecloud/requests/database/list_instances.rb +13 -0
- data/lib/fog/oraclecloud/requests/java/create_instance.rb +14 -9
- data/lib/fog/oraclecloud/requests/java/delete_instance.rb +4 -9
- data/lib/fog/oraclecloud/requests/java/get_instance.rb +19 -12
- data/lib/fog/oraclecloud/requests/java/list_instances.rb +13 -0
- data/lib/fog/oraclecloud/requests/java/list_servers.rb +1 -12
- data/lib/fog/oraclecloud/version.rb +1 -1
- data/tests/helper.rb +3 -1
- data/tests/helpers/mock_helper.rb +15 -0
- data/tests/requests/database_tests.rb +31 -27
- data/tests/requests/instance_tests.rb +23 -13
- data/tests/requests/java_tests.rb +38 -27
- data/tests/requests/orchestrations_tests.rb +1 -0
- data/tests/requests/ssh_keys_tests.rb +9 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfdb853230afc1e89dba20e81a39ef494234917f
|
4
|
+
data.tar.gz: 757d5807cbb9f31ec133be9821a51d6b0b6c8cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 060f7511d4454b87de04176b24488db21088b81a1568faeee3920499af9a928f6f0138f75d36e369e1f401c9641a0c57a0f252f0931faf4fee18cc4da0535e6f
|
7
|
+
data.tar.gz: 83395c4a62880b05ff56f18c854538a8c2df526489e2965fb060ff2a65ea0055f4221dbba70c6677a98811c67ba0d01603113bdcf0e09417396c6ed1d9c71070
|
@@ -94,7 +94,6 @@ module Fog
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def authenticate()
|
97
|
-
|
98
97
|
begin
|
99
98
|
response = @connection.request({
|
100
99
|
:expects => 204,
|
@@ -141,6 +140,33 @@ module Fog
|
|
141
140
|
response
|
142
141
|
end
|
143
142
|
end
|
143
|
+
|
144
|
+
class Mock
|
145
|
+
def initialize(options={})
|
146
|
+
@username = options[:oracle_username]
|
147
|
+
@password = options[:oracle_password]
|
148
|
+
@identity_domain = options[:oracle_domain]
|
149
|
+
@api_endpoint = options[:oracle_compute_api]
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.data
|
154
|
+
@data ||= {
|
155
|
+
:instances => {},
|
156
|
+
:sshkeys => {},
|
157
|
+
:orchestrations => {},
|
158
|
+
:deleted_at => {}
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.reset
|
163
|
+
@data = nil
|
164
|
+
end
|
165
|
+
|
166
|
+
def data
|
167
|
+
self.class.data
|
168
|
+
end
|
169
|
+
end
|
144
170
|
end
|
145
171
|
end
|
146
172
|
end
|
@@ -42,7 +42,7 @@ module Fog
|
|
42
42
|
rescue Excon::Errors::HTTPStatusError => error
|
43
43
|
raise case error
|
44
44
|
when Excon::Errors::NotFound
|
45
|
-
Fog::
|
45
|
+
Fog::OracleCloud::Database::NotFound.slurp(error)
|
46
46
|
else
|
47
47
|
error
|
48
48
|
end
|
@@ -62,51 +62,22 @@ module Fog
|
|
62
62
|
@username = options[:oracle_username]
|
63
63
|
@password = options[:oracle_password]
|
64
64
|
@identity_domain = options[:oracle_domain]
|
65
|
-
|
66
|
-
@connection = Fog::XML::Connection.new("https://dbaas.oraclecloud.com")
|
67
65
|
end
|
68
66
|
|
69
|
-
def self.data
|
70
|
-
@data ||=
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
|
67
|
+
def self.data
|
68
|
+
@data ||= {
|
69
|
+
:instances => {},
|
70
|
+
:deleted_at => {},
|
71
|
+
:created_at => {}
|
72
|
+
}
|
75
73
|
end
|
76
74
|
|
77
|
-
def
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
# Remove, jsut for testing
|
82
|
-
def auth_header
|
83
|
-
auth_header ||= 'Basic ' + Base64.encode64("#{@username}:#{@password}").gsub("\n",'')
|
75
|
+
def self.reset
|
76
|
+
@data = nil
|
84
77
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
:headers => {
|
89
|
-
'Authorization' => auth_header,
|
90
|
-
'X-ID-TENANT-NAME' => @identity_domain,
|
91
|
-
'Content-Type' => 'application/json',
|
92
|
-
#'Accept' => 'application/json'
|
93
|
-
}.merge!(params[:headers] || {})
|
94
|
-
}), &block)
|
95
|
-
rescue Excon::Errors::HTTPStatusError => error
|
96
|
-
raise case error
|
97
|
-
when Excon::Errors::NotFound
|
98
|
-
Fog::OracleCloud::Database::NotFound.slurp(error)
|
99
|
-
else
|
100
|
-
error
|
101
|
-
end
|
102
|
-
end
|
103
|
-
#https://jaas.oraclecloud.com/paas/service/jcs/api/v1.1/instances/agriculture/status/create/job/2781084
|
104
|
-
if !response.body.empty? && parse_json
|
105
|
-
# The Oracle Cloud doesn't return the Content-Type header as application/json, rather as application/vnd.com.oracle.oracloud.provisioning.Pod+json
|
106
|
-
# Should add check here to validate, but not sure if this might change in future
|
107
|
-
response.body = Fog::JSON.decode(response.body)
|
108
|
-
end
|
109
|
-
response
|
78
|
+
|
79
|
+
def data
|
80
|
+
self.class.data
|
110
81
|
end
|
111
82
|
end
|
112
83
|
end
|
data/lib/fog/oraclecloud/java.rb
CHANGED
@@ -59,56 +59,28 @@ module Fog
|
|
59
59
|
end
|
60
60
|
|
61
61
|
class Mock
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@connection = Fog::XML::Connection.new("https://jaas.oraclecloud.com")
|
68
|
-
end
|
62
|
+
def initialize(options={})
|
63
|
+
@username = options[:oracle_username]
|
64
|
+
@password = options[:oracle_password]
|
65
|
+
@identity_domain = options[:oracle_domain]
|
66
|
+
end
|
69
67
|
|
70
|
-
|
71
|
-
@data ||=
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
68
|
+
def self.data
|
69
|
+
@data ||= {
|
70
|
+
:instances => {},
|
71
|
+
:deleted_at => {},
|
72
|
+
:created_at => {}
|
73
|
+
}
|
76
74
|
end
|
77
75
|
|
78
|
-
def
|
79
|
-
|
76
|
+
def self.reset
|
77
|
+
@data = nil
|
80
78
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
auth_header ||= 'Basic ' + Base64.encode64("#{@username}:#{@password}").gsub("\n",'')
|
85
|
-
end
|
86
|
-
def request(params, parse_json = true, &block)
|
87
|
-
begin
|
88
|
-
response = @connection.request(params.merge!({
|
89
|
-
:headers => {
|
90
|
-
'Authorization' => auth_header,
|
91
|
-
'X-ID-TENANT-NAME' => @identity_domain,
|
92
|
-
'Content-Type' => 'application/json',
|
93
|
-
#'Accept' => 'application/json'
|
94
|
-
}.merge!(params[:headers] || {})
|
95
|
-
}), &block)
|
96
|
-
rescue Excon::Errors::HTTPStatusError => error
|
97
|
-
raise case error
|
98
|
-
when Excon::Errors::NotFound
|
99
|
-
Fog::Errors::NotFound.new("Instance not found")
|
100
|
-
else
|
101
|
-
error
|
102
|
-
end
|
103
|
-
end
|
104
|
-
if !response.body.empty? && parse_json
|
105
|
-
# The Oracle Cloud doesn't return the Content-Type header as application/json, rather as application/vnd.com.oracle.oracloud.provisioning.Pod+json
|
106
|
-
# Should add check here to validate, but not sure if this might change in future
|
107
|
-
response.body = Fog::JSON.decode(response.body)
|
108
|
-
end
|
109
|
-
response
|
79
|
+
|
80
|
+
def data
|
81
|
+
self.class.data
|
110
82
|
end
|
111
|
-
end
|
83
|
+
end
|
112
84
|
end
|
113
85
|
end
|
114
86
|
end
|
@@ -37,12 +37,16 @@ module Fog
|
|
37
37
|
attribute :uri
|
38
38
|
attribute :vcable_id
|
39
39
|
attribute :virtio
|
40
|
-
attribute :vnc
|
41
|
-
|
40
|
+
attribute :vnc
|
41
|
+
|
42
42
|
def ready?
|
43
43
|
state == 'running'
|
44
44
|
end
|
45
45
|
|
46
|
+
def clean_name
|
47
|
+
name.sub %r{\/.*\/}, ''
|
48
|
+
end
|
49
|
+
|
46
50
|
def save
|
47
51
|
#identity ? update : create
|
48
52
|
create
|
@@ -6,7 +6,6 @@ module Fog
|
|
6
6
|
class Instance < Fog::Model
|
7
7
|
identity :service_name
|
8
8
|
|
9
|
-
attribute :service_name, :aliases => 'display_name'
|
10
9
|
attribute :version
|
11
10
|
attribute :status
|
12
11
|
attribute :description
|
@@ -45,6 +44,9 @@ module Fog
|
|
45
44
|
attribute :vmPublicKey
|
46
45
|
attribute :parameters
|
47
46
|
|
47
|
+
def clean_name
|
48
|
+
name.sub %r{\/.*\/}, ''
|
49
|
+
end
|
48
50
|
|
49
51
|
def save
|
50
52
|
#identity ? update : create
|
@@ -55,6 +57,14 @@ module Fog
|
|
55
57
|
status == "Running"
|
56
58
|
end
|
57
59
|
|
60
|
+
def stopping?
|
61
|
+
status == 'Maintenance' || status == 'Terminating'
|
62
|
+
end
|
63
|
+
|
64
|
+
def stopped?
|
65
|
+
status == 'Stopped'
|
66
|
+
end
|
67
|
+
|
58
68
|
def ip_address
|
59
69
|
# TODO: Replace with regex
|
60
70
|
content_url.sub('http://', '')
|
@@ -68,14 +78,12 @@ module Fog
|
|
68
78
|
private
|
69
79
|
|
70
80
|
def create
|
71
|
-
requires :service_name, :edition, :vmPublicKey, :
|
72
|
-
data = service.create_instance(service_name, edition, vmPublicKey,
|
81
|
+
requires :service_name, :edition, :vmPublicKey, :shape, :version
|
82
|
+
data = service.create_instance(service_name, edition, vmPublicKey, shape, version,
|
73
83
|
:level => level,
|
74
84
|
:subscriptionType => subscriptionType,
|
75
85
|
:description => description,
|
76
|
-
:
|
77
|
-
:edition => edition,
|
78
|
-
:shape => shape)
|
86
|
+
:edition => edition)
|
79
87
|
|
80
88
|
end
|
81
89
|
end
|
@@ -57,6 +57,7 @@ module Fog
|
|
57
57
|
attribute :cloud_storage_user, :aliases=>'cloudStorageUser'
|
58
58
|
attribute :cloud_storage_password, :aliases=>'cloudStoragePassword'
|
59
59
|
attribute :admin_user_name, :aliases=>'adminUserName'
|
60
|
+
attribute :vm_public_key, :aliases=>'vmPublicKey'
|
60
61
|
|
61
62
|
# The following are used to delete an instance and are not returned in the list action
|
62
63
|
attribute :dba_name
|
@@ -80,6 +81,14 @@ module Fog
|
|
80
81
|
status == "Running"
|
81
82
|
end
|
82
83
|
|
84
|
+
def stopping?
|
85
|
+
status == 'Maintenance' || status == 'Terminating'
|
86
|
+
end
|
87
|
+
|
88
|
+
def stopped?
|
89
|
+
status == 'Stopped'
|
90
|
+
end
|
91
|
+
|
83
92
|
def servers
|
84
93
|
service.servers.all(service_name)
|
85
94
|
end
|
@@ -92,11 +101,11 @@ module Fog
|
|
92
101
|
private
|
93
102
|
|
94
103
|
def create
|
95
|
-
requires :service_name, :
|
104
|
+
requires :service_name, :cloud_storage_container, :cloud_storage_user, :cloud_storage_password
|
96
105
|
|
97
|
-
data = service.create_instance(service_name,
|
106
|
+
data = service.create_instance(service_name, cloud_storage_container, cloud_storage_user, cloud_storage_password, dba_name, dba_password, db_servicename, shape, version, vm_public_key,
|
98
107
|
:level => level,
|
99
|
-
:subscriptionType =>
|
108
|
+
:subscriptionType => subscription_type,
|
100
109
|
:description => description)
|
101
110
|
|
102
111
|
end
|
@@ -27,6 +27,27 @@ module Fog
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def create_instance (name, shape, imagelist, label, sshkeys)
|
33
|
+
response = Excon::Response.new
|
34
|
+
name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
|
35
|
+
|
36
|
+
self.data[:instances][name] = {
|
37
|
+
'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
|
38
|
+
'shape' => shape,
|
39
|
+
'imagelist' => imagelist,
|
40
|
+
'label' => label,
|
41
|
+
'sshkeys' => sshkeys,
|
42
|
+
'state' => 'running'
|
43
|
+
}
|
44
|
+
response.status = 201
|
45
|
+
response.body = {
|
46
|
+
'instances' => [self.data[:instances][name]]
|
47
|
+
}
|
48
|
+
response
|
49
|
+
end
|
50
|
+
end
|
30
51
|
end
|
31
52
|
end
|
32
53
|
end
|
@@ -41,6 +41,42 @@ module Fog
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
class Mock
|
46
|
+
def create_orchestration (name, oplans, options={})
|
47
|
+
response = Excon::Response.new
|
48
|
+
# Clean up names in case they haven't provided the fully resolved names
|
49
|
+
name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
|
50
|
+
oplans.map do |oplan|
|
51
|
+
oplan['objects'].map do |object|
|
52
|
+
if oplan['obj_type'] == 'launchplan' then
|
53
|
+
object['instances'].map do |instance|
|
54
|
+
if !instance['name'].start_with?("/Compute-") then
|
55
|
+
instance['name'] = "/Compute-#{@identity_domain}/#{@username}/#{instance['name']}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
else
|
59
|
+
if !object['name'].start_with?("/Compute-") then
|
60
|
+
object['name'] = "/Compute-#{@identity_domain}/#{@username}/#{object['name']}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
self.data[:orchestrations][name] = {
|
66
|
+
'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
|
67
|
+
'oplans' => oplans,
|
68
|
+
'relationships' => options[:relationships],
|
69
|
+
'description' => options[:description],
|
70
|
+
'account' => options[:account],
|
71
|
+
'schedule' => options[:schedule],
|
72
|
+
'status' => 'stopped',
|
73
|
+
'uri' => "#{@api_endpoint}orchestration/Compute-#{@identity_domain}/#{@username}/#{name}"
|
74
|
+
}
|
75
|
+
response.status = 201
|
76
|
+
response.body = self.data[:orchestrations][name]
|
77
|
+
response
|
78
|
+
end
|
79
|
+
end
|
44
80
|
end
|
45
81
|
end
|
46
82
|
end
|
@@ -22,6 +22,25 @@ module Fog
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
class Mock
|
27
|
+
def create_ssh_key (name, enabled, key)
|
28
|
+
response = Excon::Response.new
|
29
|
+
name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
|
30
|
+
|
31
|
+
data = {
|
32
|
+
'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
|
33
|
+
'enabled' => enabled,
|
34
|
+
'key' => key,
|
35
|
+
'uri' => "#{@api_endpoint}sshkey/#{name}"
|
36
|
+
}
|
37
|
+
self.data[:sshkeys][name] = data
|
38
|
+
|
39
|
+
response.status = 201
|
40
|
+
response.body = self.data[:sshkeys][name]
|
41
|
+
response
|
42
|
+
end
|
43
|
+
end
|
25
44
|
end
|
26
45
|
end
|
27
46
|
end
|
@@ -17,6 +17,17 @@ module Fog
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
class Mock
|
22
|
+
def delete_instance(name)
|
23
|
+
response = Excon::Response.new
|
24
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
25
|
+
self.data[:instances][clean_name]['state'] = 'stopping'
|
26
|
+
self.data[:deleted_at][clean_name] = Time.now
|
27
|
+
response.status = 204
|
28
|
+
response
|
29
|
+
end
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -17,6 +17,16 @@ module Fog
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
class Mock
|
22
|
+
def delete_ssh_key (name)
|
23
|
+
response = Excon::Response.new
|
24
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
25
|
+
self.data[:sshkeys].delete(clean_name)
|
26
|
+
response.status = 204
|
27
|
+
response
|
28
|
+
end
|
29
|
+
end
|
20
30
|
end
|
21
31
|
end
|
22
32
|
end
|
@@ -19,6 +19,27 @@ module Fog
|
|
19
19
|
response
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def get_instance(name)
|
25
|
+
response = Excon::Response.new
|
26
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
27
|
+
|
28
|
+
if instance = self.data[:instances][clean_name]
|
29
|
+
if instance['state'] == 'stopping'
|
30
|
+
if Time.now - self.data[:deleted_at][clean_name] >= Fog::Mock.delay
|
31
|
+
self.data[:deleted_at].delete(clean_name)
|
32
|
+
self.data[:instances].delete(clean_name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
response.status = 200
|
36
|
+
response.body = instance
|
37
|
+
response
|
38
|
+
else;
|
39
|
+
raise Fog::Compute::OracleCloud::NotFound.new("Instance #{name} does not exist");
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
22
43
|
end
|
23
44
|
end
|
24
45
|
end
|
@@ -19,6 +19,21 @@ module Fog
|
|
19
19
|
response
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def get_orchestration(name)
|
25
|
+
response = Excon::Response.new
|
26
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
27
|
+
|
28
|
+
if instance = self.data[:orchestrations][clean_name]
|
29
|
+
response.status = 200
|
30
|
+
response.body = instance
|
31
|
+
response
|
32
|
+
else;
|
33
|
+
raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
@@ -19,6 +19,21 @@ module Fog
|
|
19
19
|
response
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def get_ssh_key(name)
|
25
|
+
response = Excon::Response.new
|
26
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
27
|
+
|
28
|
+
if sshkey = self.data[:sshkeys][clean_name]
|
29
|
+
response.status = 200
|
30
|
+
response.body = sshkey
|
31
|
+
response
|
32
|
+
else;
|
33
|
+
raise Fog::Compute::OracleCloud::NotFound.new("SSHKey #{name} does not exist");
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
@@ -11,6 +11,18 @@ module Fog
|
|
11
11
|
response
|
12
12
|
end
|
13
13
|
end
|
14
|
+
class Mock
|
15
|
+
def list_instances
|
16
|
+
response = Excon::Response.new
|
17
|
+
|
18
|
+
instances = self.data[:instances].values
|
19
|
+
|
20
|
+
response.body = {
|
21
|
+
'result' => instances
|
22
|
+
}
|
23
|
+
response
|
24
|
+
end
|
25
|
+
end
|
14
26
|
end
|
15
27
|
end
|
16
28
|
end
|
@@ -11,6 +11,19 @@ module Fog
|
|
11
11
|
response
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_ssh_keys
|
17
|
+
response = Excon::Response.new
|
18
|
+
|
19
|
+
sshkeys = self.data[:sshkeys].values
|
20
|
+
|
21
|
+
response.body = {
|
22
|
+
'result' => sshkeys
|
23
|
+
}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -44,6 +44,37 @@ module Fog
|
|
44
44
|
)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
class Mock
|
49
|
+
def update_orchestration (name, oplans, options={})
|
50
|
+
response = Excon::Response.new
|
51
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
52
|
+
if orchestration = self.data[:orchestrations][clean_name]
|
53
|
+
oplans.map do |oplan|
|
54
|
+
oplan['objects'].map do |object|
|
55
|
+
if oplan['obj_type'] == 'launchplan' then
|
56
|
+
object['instances'].map do |instance|
|
57
|
+
if !instance['name'].start_with?("/Compute-") then
|
58
|
+
instance['name'] = "/Compute-#{@identity_domain}/#{@username}/#{instance['name']}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
else
|
62
|
+
if !object['name'].start_with?("/Compute-") then
|
63
|
+
object['name'] = "/Compute-#{@identity_domain}/#{@username}/#{object['name']}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
self.data[:orchestrations][clean_name].merge!(options)
|
69
|
+
self.data[:orchestrations][clean_name]['oplans'] = oplans
|
70
|
+
response.status = 200
|
71
|
+
response.body = self.data[:orchestrations][clean_name]
|
72
|
+
response
|
73
|
+
else;
|
74
|
+
raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
47
78
|
end
|
48
79
|
end
|
49
80
|
end
|
@@ -24,6 +24,26 @@ module Fog
|
|
24
24
|
)
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
def update_ssh_key (name, enabled, key)
|
30
|
+
response = Excon::Response.new
|
31
|
+
clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
|
32
|
+
if sshkey = self.data[:sshkeys][clean_name]
|
33
|
+
self.data[:sshkeys][clean_name].merge!({
|
34
|
+
'name' => "/Compute-#{@identity_domain}/#{@username}/#{clean_name}",
|
35
|
+
'enabled' => enabled,
|
36
|
+
'key' => key,
|
37
|
+
'uri' => "#{@api_endpoint}sshkey/#{clean_name}"
|
38
|
+
})
|
39
|
+
response.status = 200
|
40
|
+
response.body = self.data[:sshkeys][clean_name]
|
41
|
+
response
|
42
|
+
else;
|
43
|
+
raise Fog::Compute::OracleCloud::NotFound.new("SSHKey #{name} does not exist");
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
27
47
|
end
|
28
48
|
end
|
29
49
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Database
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def create_instance(service_name, edition, vmPublicKey,
|
6
|
+
def create_instance(service_name, edition, vmPublicKey, shape, version, options={})
|
7
7
|
body_data = {
|
8
8
|
'serviceName' => service_name,
|
9
9
|
'version' => options[:version],
|
@@ -13,7 +13,10 @@ module Fog
|
|
13
13
|
'description' => options[:description],
|
14
14
|
'shape' => options[:shape],
|
15
15
|
'vmPublicKeyText' => vmPublicKey,
|
16
|
-
'parameters' =>
|
16
|
+
'parameters' => {
|
17
|
+
'shape' => shape,
|
18
|
+
'version' => version
|
19
|
+
}
|
17
20
|
}
|
18
21
|
body_data = body_data.reject {|key, value| value.nil?}
|
19
22
|
|
@@ -31,13 +34,20 @@ module Fog
|
|
31
34
|
end
|
32
35
|
|
33
36
|
class Mock
|
34
|
-
def create_instance(service_name, edition, vmPublicKey,
|
37
|
+
def create_instance(service_name, edition, vmPublicKey, shape, version, options={})
|
35
38
|
response = Excon::Response.new
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
data = {
|
41
|
+
'service_name' => service_name,
|
42
|
+
'shape' => shape,
|
43
|
+
'edition' => edition,
|
44
|
+
'version' => version,
|
45
|
+
'status' => 'In Progress'
|
46
|
+
}.merge(options.select {|key, value| ["description"].include?(key) })
|
39
47
|
|
40
|
-
|
48
|
+
self.data[:instances][service_name] = data
|
49
|
+
self.data[:created_at][service_name] = Time.now
|
50
|
+
response.status = 202
|
41
51
|
response
|
42
52
|
end
|
43
53
|
end
|
@@ -12,17 +12,12 @@ module Fog
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
def delete_instance(
|
15
|
+
class Mock
|
16
|
+
def delete_instance(name)
|
17
17
|
response = Excon::Response.new
|
18
|
-
|
19
|
-
self.data[:
|
20
|
-
response.
|
21
|
-
'service_name' => service_name,
|
22
|
-
'status' => 'Terminating'
|
23
|
-
}
|
24
|
-
response.status = 202
|
25
|
-
|
18
|
+
self.data[:instances][name]['status'] = 'Terminating'
|
19
|
+
self.data[:deleted_at][name] = Time.now
|
20
|
+
response.status = 204
|
26
21
|
response
|
27
22
|
end
|
28
23
|
end
|
@@ -14,22 +14,30 @@ module Fog
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class Mock
|
17
|
-
def get_instance(
|
17
|
+
def get_instance(name)
|
18
18
|
response = Excon::Response.new
|
19
|
-
|
19
|
+
|
20
|
+
if instance = self.data[:instances][name]
|
21
|
+
case instance['status']
|
22
|
+
when 'Terminating'
|
23
|
+
if Time.now - self.data[:deleted_at][name] >= Fog::Mock.delay
|
24
|
+
self.data[:deleted_at].delete(name)
|
25
|
+
self.data[:instances].delete(name)
|
26
|
+
end
|
27
|
+
when 'In Progress'
|
28
|
+
if Time.now - self.data[:created_at][name] >= Fog::Mock.delay
|
29
|
+
self.data[:instances][name]['status'] = 'Running'
|
30
|
+
instance = self.data[:instances][name]
|
31
|
+
self.data[:created_at].delete(name)
|
32
|
+
end
|
33
|
+
end
|
20
34
|
response.status = 200
|
21
|
-
response.body
|
35
|
+
response.body = instance
|
36
|
+
response
|
22
37
|
else
|
23
|
-
raise Fog::
|
38
|
+
raise Fog::OracleCloud::Database::NotFound.new("Database #{name} does not exist");
|
24
39
|
end
|
25
|
-
response
|
26
|
-
end
|
27
|
-
|
28
|
-
# Checks if an instance exists
|
29
|
-
def instance_exists?(instance_id)
|
30
|
-
self.data[:instances].key? instance_id
|
31
40
|
end
|
32
|
-
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
@@ -11,6 +11,19 @@ module Fog
|
|
11
11
|
response
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_instances
|
17
|
+
response = Excon::Response.new
|
18
|
+
|
19
|
+
instances = self.data[:instances].values
|
20
|
+
|
21
|
+
response.body = {
|
22
|
+
'services' => instances
|
23
|
+
}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Java
|
4
4
|
class Real
|
5
5
|
|
6
|
-
|
6
|
+
def create_instance(service_name, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, dbaName, dbaPassword, dbServiceName, shape, version, vmPublicKey, options={})
|
7
7
|
if !cloudStorageContainer.start_with?("/Storage-") then
|
8
8
|
# They haven't provided a well formed container name, add their details in
|
9
9
|
name = "/Storage-#{@identity_domain}/#{@username}/#{cloudStorageContainer}"
|
@@ -33,18 +33,23 @@ module Fog
|
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
36
|
-
|
37
36
|
class Mock
|
38
|
-
|
39
|
-
|
37
|
+
def create_instance(service_name, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, dbaName, dbaPassword, dbServiceName, shape, version, vmPublicKey, options={})
|
38
|
+
response = Excon::Response.new
|
40
39
|
|
41
|
-
|
42
|
-
|
40
|
+
data = {
|
41
|
+
'service_name' => service_name,
|
42
|
+
'db_service_name' => dbServiceName,
|
43
|
+
'shape' => shape,
|
44
|
+
'version' => version,
|
45
|
+
'status' => 'In Progress'
|
46
|
+
}.merge(options.select {|key, value| ["description"].include?(key) })
|
43
47
|
|
44
|
-
|
45
|
-
|
48
|
+
self.data[:instances][service_name] = data
|
49
|
+
self.data[:created_at][service_name] = Time.now
|
50
|
+
response.status = 202
|
46
51
|
response
|
47
|
-
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -24,16 +24,11 @@ module Fog
|
|
24
24
|
end
|
25
25
|
|
26
26
|
class Mock
|
27
|
-
def delete_instance(
|
27
|
+
def delete_instance(name, dba_name, dba_password, options={})
|
28
28
|
response = Excon::Response.new
|
29
|
-
|
30
|
-
self.data[:
|
31
|
-
response.
|
32
|
-
'service_name' => service_name,
|
33
|
-
'status' => 'Terminating'
|
34
|
-
}
|
35
|
-
response.status = 202
|
36
|
-
|
29
|
+
self.data[:instances][name]['status'] = 'Terminating'
|
30
|
+
self.data[:deleted_at][name] = Time.now
|
31
|
+
response.status = 204
|
37
32
|
response
|
38
33
|
end
|
39
34
|
end
|
@@ -14,23 +14,30 @@ module Fog
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class Mock
|
17
|
-
|
18
|
-
|
17
|
+
def get_instance(name)
|
19
18
|
response = Excon::Response.new
|
20
|
-
|
19
|
+
|
20
|
+
if instance = self.data[:instances][name]
|
21
|
+
case instance['status']
|
22
|
+
when 'Terminating'
|
23
|
+
if Time.now - self.data[:deleted_at][name] >= Fog::Mock.delay
|
24
|
+
self.data[:deleted_at].delete(name)
|
25
|
+
self.data[:instances].delete(name)
|
26
|
+
end
|
27
|
+
when 'In Progress'
|
28
|
+
if Time.now - self.data[:created_at][name] >= Fog::Mock.delay
|
29
|
+
self.data[:instances][name]['status'] = 'Running'
|
30
|
+
instance = self.data[:instances][name]
|
31
|
+
self.data[:created_at].delete(name)
|
32
|
+
end
|
33
|
+
end
|
21
34
|
response.status = 200
|
22
|
-
response.body
|
35
|
+
response.body = instance
|
36
|
+
response
|
23
37
|
else
|
24
|
-
raise Fog::OracleCloud::Java::NotFound
|
38
|
+
raise Fog::OracleCloud::Java::NotFound.new("Java #{name} does not exist");
|
25
39
|
end
|
26
|
-
response
|
27
|
-
end
|
28
|
-
|
29
|
-
# Checks if an instance exists
|
30
|
-
def instance_exists?(instance_id)
|
31
|
-
self.data[:instances].key? instance_id
|
32
40
|
end
|
33
|
-
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
@@ -11,6 +11,19 @@ module Fog
|
|
11
11
|
response
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def list_instances
|
17
|
+
response = Excon::Response.new
|
18
|
+
|
19
|
+
instances = self.data[:instances].values
|
20
|
+
|
21
|
+
response.body = {
|
22
|
+
'services' => instances
|
23
|
+
}
|
24
|
+
response
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -12,18 +12,7 @@ module Fog
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
def list_servers(service_name)
|
17
|
-
# TODO: Remove, implement proper Mock
|
18
|
-
response = request(
|
19
|
-
:expects => 200,
|
20
|
-
:method => 'GET',
|
21
|
-
:path => "/paas/service/jcs/api/v1.1/instances/#{@identity_domain}/#{service_name}/servers"
|
22
|
-
)
|
23
|
-
response
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
15
|
+
|
27
16
|
end
|
28
17
|
end
|
29
18
|
end
|
data/tests/helper.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Use so you can run in mock mode from the command line
|
2
|
+
#
|
3
|
+
# FOG_MOCK=true fog
|
4
|
+
|
5
|
+
if ENV["FOG_MOCK"] == "true"
|
6
|
+
Fog.mock!
|
7
|
+
end
|
8
|
+
|
9
|
+
puts "Mock: #{Fog.mock?}"
|
10
|
+
# if in mocked mode, fill in some fake credentials for us
|
11
|
+
if Fog.mock?
|
12
|
+
Fog.credentials = {
|
13
|
+
:oracle_compute_api => 'https://api.compute.us0.oraclecloud.com'
|
14
|
+
}.merge(Fog.credentials)
|
15
|
+
end
|
@@ -2,33 +2,28 @@ require 'pp'
|
|
2
2
|
|
3
3
|
Shindo.tests('Fog::Database[oraclecloud] | database requests', 'database') do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# test "can delete instance" do
|
28
|
-
# check = Fog::Compute[:oracle].instances.get(new_instance.name)
|
29
|
-
# check.state == 'stopping'
|
30
|
-
# end
|
31
|
-
#end
|
5
|
+
tests("#database-create", "create") do
|
6
|
+
db = Fog::OracleCloud[:database].instances.create(
|
7
|
+
:service_name => 'TestDB',
|
8
|
+
:description => 'A new database',
|
9
|
+
:edition => 'SE',
|
10
|
+
:vmPublicKey => 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlDbUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ==',
|
11
|
+
:shape => 'oc3',
|
12
|
+
:version => '12.1.0.2'
|
13
|
+
)
|
14
|
+
test "can create a database" do
|
15
|
+
db.is_a? Fog::OracleCloud::Database::Instance
|
16
|
+
end
|
17
|
+
|
18
|
+
test "is being built" do
|
19
|
+
!db.ready?
|
20
|
+
end
|
21
|
+
db.wait_for { ready? }
|
22
|
+
|
23
|
+
test "is built" do
|
24
|
+
db.ready?
|
25
|
+
end
|
26
|
+
end
|
32
27
|
|
33
28
|
tests('#database-read') do
|
34
29
|
instances = Fog::OracleCloud[:database].instances
|
@@ -49,4 +44,13 @@ Shindo.tests('Fog::Database[oraclecloud] | database requests', 'database') do
|
|
49
44
|
instance.service_name.is_a? String
|
50
45
|
end
|
51
46
|
end
|
47
|
+
|
48
|
+
tests("#database-delete", "create") do
|
49
|
+
db = Fog::OracleCloud[:database].instances.get('TestDB')
|
50
|
+
db.destroy()
|
51
|
+
db.wait_for { stopping? }
|
52
|
+
tests("should actually delete instance").raises(Fog::OracleCloud::Database::NotFound) do
|
53
|
+
db.wait_for { stopped? }
|
54
|
+
end
|
55
|
+
end
|
52
56
|
end
|
@@ -3,31 +3,32 @@ require 'pp'
|
|
3
3
|
Shindo.tests('Fog::Compute[oraclecloud] | instance requests', 'instances') do
|
4
4
|
|
5
5
|
tests("#instance-create", "create") do
|
6
|
-
sshkey = Fog::Compute[:oraclecloud].ssh_keys.first.name
|
6
|
+
#sshkey = Fog::Compute[:oraclecloud].ssh_keys.first.name
|
7
|
+
begin
|
8
|
+
sshkey = Fog::Compute[:oraclecloud].ssh_keys.get('Test123Key')
|
9
|
+
rescue Fog::Compute::OracleCloud::NotFound
|
10
|
+
sshkey = Fog::Compute[:oraclecloud].ssh_keys.create(
|
11
|
+
:name => 'TestSSHKey2',
|
12
|
+
:enabled => false,
|
13
|
+
:key => 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlDbUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ=='
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
7
17
|
new_instance = Fog::Compute[:oraclecloud].instances.create(
|
8
18
|
:name=>'Test123',
|
9
19
|
:shape=>'oc3',
|
10
20
|
:imagelist=>'/oracle/public/oel_6.4_2GB_v1',
|
11
21
|
:label=>'dev-vm',
|
12
|
-
:sshkeys=>[sshkey]
|
22
|
+
:sshkeys=>[sshkey.name]
|
13
23
|
)
|
14
24
|
test "can create an instance" do
|
15
|
-
new_instance.is_a? Fog::Compute::
|
16
|
-
end
|
17
|
-
test "is being built" do
|
18
|
-
new_instance.state != "running"
|
25
|
+
new_instance.is_a? Fog::Compute::OracleCloud::Instance
|
19
26
|
end
|
20
27
|
new_instance.wait_for { ready? }
|
21
28
|
|
22
29
|
test "is built" do
|
23
30
|
new_instance.state == 'running'
|
24
31
|
end
|
25
|
-
|
26
|
-
new_instance.destroy()
|
27
|
-
test "can delete instance" do
|
28
|
-
check = Fog::Compute[:oraclecloud].instances.get(new_instance.name)
|
29
|
-
check.state == 'stopping'
|
30
|
-
end
|
31
32
|
end
|
32
33
|
|
33
34
|
tests('#instances-read') do
|
@@ -36,7 +37,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | instance requests', 'instances') do
|
|
36
37
|
instances.is_a? Array
|
37
38
|
end
|
38
39
|
instances.each do |ins|
|
39
|
-
puts "#{ins.
|
40
|
+
puts "#{ins.clean_name} - #{ins.state}"
|
40
41
|
end
|
41
42
|
test "should return records" do
|
42
43
|
instances.size >= 1
|
@@ -51,4 +52,13 @@ Shindo.tests('Fog::Compute[oraclecloud] | instance requests', 'instances') do
|
|
51
52
|
instance.name.is_a? String
|
52
53
|
end
|
53
54
|
end
|
55
|
+
|
56
|
+
tests("#instance-delete", "create") do
|
57
|
+
instance = Fog::Compute[:oraclecloud].instances.get('Test123')
|
58
|
+
instance.destroy()
|
59
|
+
instance.wait_for { state == 'stopping' }
|
60
|
+
tests("should actually delete instance").raises(Fog::Compute::OracleCloud::NotFound) do
|
61
|
+
instance.wait_for { state == 'stopped' }
|
62
|
+
end
|
63
|
+
end
|
54
64
|
end
|
@@ -2,33 +2,33 @@ require 'pp'
|
|
2
2
|
|
3
3
|
Shindo.tests('Fog::Java[oraclecloud] | java requests', 'java') do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
5
|
+
tests("#database-create", "create") do
|
6
|
+
instance = Fog::OracleCloud[:java].instances.create(
|
7
|
+
:service_name => 'TestWLS',
|
8
|
+
:description => 'A new weblogic instance',
|
9
|
+
:cloud_storage_container => 'todo',
|
10
|
+
:cloud_storage_user => 'admin',
|
11
|
+
:cloud_storage_password => 'password',
|
12
|
+
:dbaName => 'SYS',
|
13
|
+
:dbaPassword => 'password',
|
14
|
+
:dbServiceName => 'TestDB',
|
15
|
+
:shape => 'oc3',
|
16
|
+
:version => '12.2.1',
|
17
|
+
:vmPublicKey => 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlinstanceUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ==',
|
18
|
+
)
|
19
|
+
test "can create a java instance" do
|
20
|
+
instance.is_a? Fog::OracleCloud::Java::Instance
|
21
|
+
end
|
22
|
+
|
23
|
+
test "is being built" do
|
24
|
+
!instance.ready?
|
25
|
+
end
|
26
|
+
instance.wait_for { ready? }
|
27
|
+
|
28
|
+
test "is built" do
|
29
|
+
instance.ready?
|
30
|
+
end
|
31
|
+
end
|
32
32
|
|
33
33
|
tests('#java-read') do
|
34
34
|
instances = Fog::OracleCloud[:java].instances
|
@@ -49,4 +49,15 @@ Shindo.tests('Fog::Java[oraclecloud] | java requests', 'java') do
|
|
49
49
|
instance.service_name.is_a? String
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
tests("#java-delete", "create") do
|
54
|
+
instance = Fog::OracleCloud[:java].instances.get('TestWLS')
|
55
|
+
instance.dba_name = 'Admin',
|
56
|
+
instance.dba_password = 'password'
|
57
|
+
instance.destroy()
|
58
|
+
instance.wait_for { stopping? }
|
59
|
+
tests("should actually delete instance").raises(Fog::OracleCloud::Java::NotFound) do
|
60
|
+
instance.wait_for { stopped? }
|
61
|
+
end
|
62
|
+
end
|
52
63
|
end
|
@@ -23,10 +23,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | ssh_keys requests', 'ssh_keys') do
|
|
23
23
|
check = Fog::Compute[:oraclecloud].ssh_keys.get(sshkey.name)
|
24
24
|
check.enabled == true
|
25
25
|
end
|
26
|
-
|
27
|
-
tests("can delete ssh key").raises(Excon::Error::NotFound) do
|
28
|
-
check = Fog::Compute[:oraclecloud].ssh_keys.get(sshkey.name)
|
29
|
-
end
|
26
|
+
|
30
27
|
end
|
31
28
|
|
32
29
|
tests("#sshkeys-read") do
|
@@ -46,4 +43,12 @@ Shindo.tests('Fog::Compute[oraclecloud] | ssh_keys requests', 'ssh_keys') do
|
|
46
43
|
sshkey.name.is_a? String
|
47
44
|
end
|
48
45
|
end
|
46
|
+
|
47
|
+
tests("#sshkeys-delete", "create") do
|
48
|
+
sshkey = Fog::Compute[:oraclecloud].ssh_keys.get('TestSSHKey2')
|
49
|
+
sshkey.destroy()
|
50
|
+
tests("should delete key").raises(Fog::Compute::OracleCloud::NotFound) do
|
51
|
+
sshkey = Fog::Compute[:oraclecloud].ssh_keys.get('TestSSHKey2')
|
52
|
+
end
|
53
|
+
end
|
49
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-oraclecloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Nation
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/fog/oraclecloud/storage.rb
|
220
220
|
- lib/fog/oraclecloud/version.rb
|
221
221
|
- tests/helper.rb
|
222
|
+
- tests/helpers/mock_helper.rb
|
222
223
|
- tests/requests/database_tests.rb
|
223
224
|
- tests/requests/instance_tests.rb
|
224
225
|
- tests/requests/java_tests.rb
|