2013-07-24 21:46:20 -04:00
|
|
|
def test
|
|
|
|
connection = Fog::Compute.new({ :provider => "Google" })
|
|
|
|
time = Time.now.utc.to_i
|
2013-07-25 15:22:12 -04:00
|
|
|
disk = connection.disks.create({:name => 'foggydisk', :size => 10, :zone_name => 'us-central1-a', :image_name => 'centos-6-v20130522'})
|
2013-07-24 21:46:20 -04:00
|
|
|
|
|
|
|
disk.wait_for { disk.ready? }
|
|
|
|
disk = disk.get_as_boot_disk(true)
|
|
|
|
params = {
|
|
|
|
:name => "fog-smoke-test-#{Time.now.to_i}",
|
|
|
|
:machine_type => "f1-micro",
|
|
|
|
:zone_name => "us-central1-a",
|
|
|
|
:disks => [ disk ],
|
|
|
|
:kernel => 'gce-v20130522',
|
|
|
|
:user => ENV['USER']
|
|
|
|
}
|
|
|
|
|
2013-07-25 15:22:12 -04:00
|
|
|
server = connection.servers.bootstrap params
|
2013-07-24 21:46:20 -04:00
|
|
|
|
|
|
|
raise "Could not bootstrap sshable server." unless server.ssh("whoami")
|
|
|
|
raise "Could not delete server." unless server.destroy
|
|
|
|
raise "Could not delete disk." unless disk.destroy
|
|
|
|
end
|