Sha256: c237d9fe64fa889b9daa21c631c796620270f10fb6c1c058d9e5a625e67667ec

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

# All examples presume that you have a ~/.fog credentials file set up.
# More info on it can be found here: http://fog.io/about/getting_started.html

require "bundler"
Bundler.require(:default, :development)
# Uncomment this if you want to make real requests to GCE (you _will_ be billed!)
# WebMock.disable!

def test
  connection = Fog::Compute.new(:provider => "Google")

  name = "fog-smoke-test-#{Time.now.to_i}"

  disk = connection.disks.create(
    :name => name,
    :size_gb => 10,
    :zone_name => "us-central1-f",
    :source_image => "debian-8-jessie-v20161215"
  )

  disk.wait_for { disk.ready? }

  server = connection.servers.create(
    :name => name,
    :disks => [disk],
    :machine_type => "n1-standard-1",
    :zone_name => "us-central1-f",
    :private_key_path => File.expand_path("~/.ssh/id_rsa"),
    :public_key_path => File.expand_path("~/.ssh/id_rsa.pub")
  )

  server.wait_for { ready? }

  server.metadata["test"] = "foo"

  raise "Metadata was not set." unless server.metadata["test"] == "foo"
  raise "Could not delete server." unless server.destroy
end

test

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-google-1.3.3 examples/metadata.rb
fog-google-1.3.2 examples/metadata.rb
fog-google-1.3.1 examples/metadata.rb
fog-google-1.3.0 examples/metadata.rb
fog-google-1.2.2 examples/metadata.rb
fog-google-1.2.1 examples/metadata.rb
fog-google-1.2.0 examples/metadata.rb
fog-google-1.1.0 examples/metadata.rb
fog-google-1.0.1 examples/metadata.rb
fog-google-1.0.0 examples/metadata.rb