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 :ips
|
||||
attribute :memory
|
||||
attribute :status
|
||||
attribute :state, :aliases => :status
|
||||
attribute :storage
|
||||
attribute :template
|
||||
|
||||
|
@ -73,7 +73,7 @@ module Fog
|
|||
end
|
||||
|
||||
def ready?
|
||||
status == 'running'
|
||||
self.state == 'running'
|
||||
end
|
||||
|
||||
def reboot(type = 'SOFT')
|
||||
|
|
|
@ -10,19 +10,19 @@ module Fog
|
|||
|
||||
attribute :url
|
||||
attribute :name
|
||||
attribute :status
|
||||
attribute :state, :aliases => 'status'
|
||||
attribute :hostname
|
||||
attribute :created_at, :type => :time
|
||||
attribute :deleted_at, :type => :time
|
||||
attribute :started_at, :type => :time
|
||||
attribute :created_at, :type => :time
|
||||
attribute :deleted_at, :type => :time
|
||||
attribute :started_at, :type => :time
|
||||
attribute :user_data
|
||||
|
||||
attribute :resource_type
|
||||
|
||||
attribute :account_id, :aliases => "account", :squash => "id"
|
||||
attribute :image_id, :aliases => "image", :squash => "id"
|
||||
attribute :flavor_id, :aliases => "server_type", :squash => "id"
|
||||
attribute :zone_id, :aliases => "zone", :squash => "id"
|
||||
attribute :account_id, :aliases => "account", :squash => "id"
|
||||
attribute :image_id, :aliases => "image", :squash => "id"
|
||||
attribute :flavor_id, :aliases => "server_type", :squash => "id"
|
||||
attribute :zone_id, :aliases => "zone", :squash => "id"
|
||||
|
||||
attribute :snapshots
|
||||
attribute :cloud_ips
|
||||
|
@ -86,7 +86,7 @@ module Fog
|
|||
end
|
||||
|
||||
def ready?
|
||||
status == 'active'
|
||||
self.state == 'active'
|
||||
end
|
||||
|
||||
def activate_console
|
||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
|||
attribute :name
|
||||
attribute :personality
|
||||
attribute :progress
|
||||
attribute :status
|
||||
attribute :state, :aliases => 'status'
|
||||
|
||||
attr_reader :password
|
||||
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
||||
|
@ -75,7 +75,7 @@ module Fog
|
|||
end
|
||||
|
||||
def ready?
|
||||
status == 'ACTIVE'
|
||||
self.state == 'ACTIVE'
|
||||
end
|
||||
|
||||
def reboot(type = 'SOFT')
|
||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
|||
attribute :image_id, :aliases => 'image-id'
|
||||
attribute :name
|
||||
attribute :progress
|
||||
attribute :status
|
||||
attribute :state, :aliases => 'status'
|
||||
|
||||
attr_accessor :password
|
||||
alias_method :'root-password=', :password=
|
||||
|
@ -71,7 +71,7 @@ module Fog
|
|||
end
|
||||
|
||||
def ready?
|
||||
status == 'active'
|
||||
self.state == 'active'
|
||||
end
|
||||
|
||||
def reboot(type = 'SOFT')
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
end
|
||||
|
||||
def ready?
|
||||
status == 'SUCCEEDED'
|
||||
self.state == 'SUCCEEDED'
|
||||
end
|
||||
|
||||
def private_ip_address
|
||||
|
@ -49,8 +49,8 @@ module Fog
|
|||
true
|
||||
end
|
||||
|
||||
def status
|
||||
@status ||= connection.voxcloud_status(id).body['devices'].first['status']
|
||||
def state
|
||||
@state ||= connection.voxcloud_status(id).body['devices'].first['status']
|
||||
end
|
||||
|
||||
def save
|
||||
|
|
|
@ -14,12 +14,12 @@ Shindo.tests('Rackspace::Compute | resize request', ['rackspace']) do
|
|||
Rackspace[:compute].resize_server(@revert_server.id, 2)
|
||||
end
|
||||
|
||||
@confirm_server.wait_for { status == 'VERIFY_RESIZE' }
|
||||
@confirm_server.wait_for { state == 'VERIFY_RESIZE' }
|
||||
tests("#confirm_resized_server(#{@confirm_server.id})").succeeds do
|
||||
Rackspace[:compute].confirm_resized_server(@confirm_server.id)
|
||||
end
|
||||
|
||||
@revert_server.wait_for { status == 'VERIFY_RESIZE' }
|
||||
@revert_server.wait_for { state == 'VERIFY_RESIZE' }
|
||||
tests("#revert_resized_server(#{@revert_server.id})").succeeds do
|
||||
Rackspace[:compute].revert_resized_server(@revert_server.id)
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@ def server_tests(connection, params = {}, mocks_implemented = true)
|
|||
model_tests(connection.servers, params, mocks_implemented) do
|
||||
|
||||
tests('#reload').returns(true) do
|
||||
pending if Fog.mocking? && !mocks_implemented
|
||||
identity = @instance.identity
|
||||
!identity.nil? && identity == @instance.reload.identity
|
||||
end
|
||||
|
|
|
@ -2,9 +2,7 @@ def model_tests(collection, params = {}, mocks_implemented = true)
|
|||
|
||||
tests('success') do
|
||||
|
||||
if !Fog.mocking? || mocks_implemented
|
||||
@instance = collection.new(params)
|
||||
end
|
||||
@instance = collection.new(params)
|
||||
|
||||
tests("#save").succeeds do
|
||||
pending if Fog.mocking? && !mocks_implemented
|
||||
|
|
Loading…
Reference in a new issue