Sha256: 6a7c35316a4da46ea1d9c01f545fe4263928798d941d3acc3e7dc1626f314ea7

Contents?: true

Size: 1.07 KB

Versions: 7

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-11-bullseye-v20220920"
  )

  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

7 entries across 7 versions & 1 rubygems

Version Path
fog-google-1.24.1 examples/metadata.rb
fog-google-1.24.0 examples/metadata.rb
fog-google-1.23.0 examples/metadata.rb
fog-google-1.22.0 examples/metadata.rb
fog-google-1.21.1 examples/metadata.rb
fog-google-1.21.0 examples/metadata.rb
fog-google-1.20.0 examples/metadata.rb