Shindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'compute']) do server = fog_test_server tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ shutdown reboot power_cycle stop start }.each do |action| test(action) { server.respond_to? action } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :id, :name, :status, :backups_active, :ip_address, :flavor_id, :region_id, :image_id ] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end end test('#reboot') do server.reboot server.wait_for { server.status == 'off' } server.status == 'off' end test('#power_cycle') do server.wait_for { server.ready? } server.power_cycle server.wait_for { server.status == 'off' } server.status == 'off' end test('#stop') do server.stop server.wait_for { server.status == 'off' } server.status == 'off' end test('#start') do server.start server.wait_for { ready? } server.ready? end # DigitalOcean shutdown is unreliable #test('#shutdown') do # server.start # server.wait_for { server.ready? } # server.shutdown # server.wait_for { server.status == 'off' } # server.status == 'off' #end raises(NotImplementedError, '#update') do server.update end end # restore server state server.start end