2013-08-06 19:52:11 -04:00
|
|
|
def test
|
|
|
|
connection = Fog::Compute.new({ :provider => "Google" })
|
|
|
|
|
|
|
|
# we create a new private network
|
2013-08-13 17:41:52 -04:00
|
|
|
connection.insert_network('my-private-network', '10.240.0.0/16')
|
2013-08-06 19:52:11 -04:00
|
|
|
|
2013-12-18 07:11:25 -05:00
|
|
|
name = "fog-smoke-test-#{Time.now.to_i}"
|
|
|
|
|
|
|
|
disk = connection.disks.create({
|
|
|
|
:name => name,
|
|
|
|
:size_gb => 10,
|
|
|
|
:zone_name => 'us-central1-a',
|
|
|
|
:source_image => 'debian-7-wheezy-v20131120',
|
|
|
|
})
|
|
|
|
|
|
|
|
disk.wait_for { disk.ready? }
|
|
|
|
|
2013-08-13 17:41:52 -04:00
|
|
|
server = connection.servers.create({
|
2013-12-18 07:11:25 -05:00
|
|
|
:name => name,
|
|
|
|
:disks => [disk],
|
2013-08-06 19:52:11 -04:00
|
|
|
:machine_type => "n1-standard-1",
|
|
|
|
:zone_name => "us-central1-a",
|
|
|
|
:private_key_path => File.expand_path("~/.ssh/id_rsa"),
|
|
|
|
:public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
|
|
|
|
:network => 'my-private-network',
|
|
|
|
:external_ip => false,
|
|
|
|
:user => ENV['USER'],
|
|
|
|
})
|
2013-08-13 17:41:52 -04:00
|
|
|
|
|
|
|
# The network won't have any firewall rules, so we won't be able to ssh in.
|
|
|
|
server.wait_for { ready? }
|
2013-10-04 18:31:14 -04:00
|
|
|
|
2013-10-04 19:03:56 -04:00
|
|
|
raise "Could not delete server." unless server.destroy
|
2013-08-06 19:52:11 -04:00
|
|
|
end
|