mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[compute] consistency in #state call and mock test fixes
This commit is contained in:
parent
91d6e8ee4e
commit
8a25dd46dd
8 changed files with 22 additions and 23 deletions
|
@ -17,7 +17,7 @@ module Fog
|
||||||
attribute :image_id
|
attribute :image_id
|
||||||
attribute :ips
|
attribute :ips
|
||||||
attribute :memory
|
attribute :memory
|
||||||
attribute :status
|
attribute :state, :aliases => :status
|
||||||
attribute :storage
|
attribute :storage
|
||||||
attribute :template
|
attribute :template
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'running'
|
self.state == 'running'
|
||||||
end
|
end
|
||||||
|
|
||||||
def reboot(type = 'SOFT')
|
def reboot(type = 'SOFT')
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Fog
|
||||||
|
|
||||||
attribute :url
|
attribute :url
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :status
|
attribute :state, :aliases => 'status'
|
||||||
attribute :hostname
|
attribute :hostname
|
||||||
attribute :created_at, :type => :time
|
attribute :created_at, :type => :time
|
||||||
attribute :deleted_at, :type => :time
|
attribute :deleted_at, :type => :time
|
||||||
|
@ -86,7 +86,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'active'
|
self.state == 'active'
|
||||||
end
|
end
|
||||||
|
|
||||||
def activate_console
|
def activate_console
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :personality
|
attribute :personality
|
||||||
attribute :progress
|
attribute :progress
|
||||||
attribute :status
|
attribute :state, :aliases => 'status'
|
||||||
|
|
||||||
attr_reader :password
|
attr_reader :password
|
||||||
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
||||||
|
@ -75,7 +75,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'ACTIVE'
|
self.state == 'ACTIVE'
|
||||||
end
|
end
|
||||||
|
|
||||||
def reboot(type = 'SOFT')
|
def reboot(type = 'SOFT')
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
||||||
attribute :image_id, :aliases => 'image-id'
|
attribute :image_id, :aliases => 'image-id'
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :progress
|
attribute :progress
|
||||||
attribute :status
|
attribute :state, :aliases => 'status'
|
||||||
|
|
||||||
attr_accessor :password
|
attr_accessor :password
|
||||||
alias_method :'root-password=', :password=
|
alias_method :'root-password=', :password=
|
||||||
|
@ -71,7 +71,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'active'
|
self.state == 'active'
|
||||||
end
|
end
|
||||||
|
|
||||||
def reboot(type = 'SOFT')
|
def reboot(type = 'SOFT')
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'SUCCEEDED'
|
self.state == 'SUCCEEDED'
|
||||||
end
|
end
|
||||||
|
|
||||||
def private_ip_address
|
def private_ip_address
|
||||||
|
@ -49,8 +49,8 @@ module Fog
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
def state
|
||||||
@status ||= connection.voxcloud_status(id).body['devices'].first['status']
|
@state ||= connection.voxcloud_status(id).body['devices'].first['status']
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
|
|
|
@ -14,12 +14,12 @@ Shindo.tests('Rackspace::Compute | resize request', ['rackspace']) do
|
||||||
Rackspace[:compute].resize_server(@revert_server.id, 2)
|
Rackspace[:compute].resize_server(@revert_server.id, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
@confirm_server.wait_for { status == 'VERIFY_RESIZE' }
|
@confirm_server.wait_for { state == 'VERIFY_RESIZE' }
|
||||||
tests("#confirm_resized_server(#{@confirm_server.id})").succeeds do
|
tests("#confirm_resized_server(#{@confirm_server.id})").succeeds do
|
||||||
Rackspace[:compute].confirm_resized_server(@confirm_server.id)
|
Rackspace[:compute].confirm_resized_server(@confirm_server.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@revert_server.wait_for { status == 'VERIFY_RESIZE' }
|
@revert_server.wait_for { state == 'VERIFY_RESIZE' }
|
||||||
tests("#revert_resized_server(#{@revert_server.id})").succeeds do
|
tests("#revert_resized_server(#{@revert_server.id})").succeeds do
|
||||||
Rackspace[:compute].revert_resized_server(@revert_server.id)
|
Rackspace[:compute].revert_resized_server(@revert_server.id)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@ def server_tests(connection, params = {}, mocks_implemented = true)
|
||||||
model_tests(connection.servers, params, mocks_implemented) do
|
model_tests(connection.servers, params, mocks_implemented) do
|
||||||
|
|
||||||
tests('#reload').returns(true) do
|
tests('#reload').returns(true) do
|
||||||
|
pending if Fog.mocking? && !mocks_implemented
|
||||||
identity = @instance.identity
|
identity = @instance.identity
|
||||||
!identity.nil? && identity == @instance.reload.identity
|
!identity.nil? && identity == @instance.reload.identity
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,7 @@ def model_tests(collection, params = {}, mocks_implemented = true)
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
if !Fog.mocking? || mocks_implemented
|
|
||||||
@instance = collection.new(params)
|
@instance = collection.new(params)
|
||||||
end
|
|
||||||
|
|
||||||
tests("#save").succeeds do
|
tests("#save").succeeds do
|
||||||
pending if Fog.mocking? && !mocks_implemented
|
pending if Fog.mocking? && !mocks_implemented
|
||||||
|
|
Loading…
Reference in a new issue