Sha256: bf3161eab95b15c4fb3a838ff54155d736d4f6c49d98b412782840aea8a33d6d

Contents?: true

Size: 1.99 KB

Versions: 7

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests('Fog::Compute::DigitalOcean | create_server request', ['digitalocean', 'compute']) do
  service = Fog::Compute.new(:provider => 'DigitalOcean')

  server_format = {
    'id'         => Integer,
    'name'       => String,
    'memory'     => Integer,
    'vcpus'      => Integer,
    'disk'       => Integer,
    'locked'     => Fog::Boolean,
    'created_at' => String,
  }

  create_server_format = {
    'droplet' => {
      'id'           => Integer,
      'name'         => String,
      'memory'       => Integer,
      'vcpus'        => Integer,
      'disk'         => Integer,
      'locked'       => Fog::Boolean,
      'status'       => String,
      'kernel'       => Hash,
      "created_at"   => String,
      "features"     => Array,
      "backup_ids"   => Array,
      "snapshot_ids" => Array,
      "image"        => Hash,
      "size"         => Hash,
      "size_slug"    => String,
      "networks"     => Hash,
      "region"       => Hash,
    },

    'links'   => {
      "actions" => Array,
    }

  }

  tests('success') do

    server_id   = nil
    server_name = "fog-#{Time.now.to_i.to_s}"
    image       = "ubuntu-14-04-x64"
    region      = "nyc3"
    size        = "512mb"

    tests("#create_server(#{server_name}, #{size}, #{image}, #{region})").formats(create_server_format) do
      body      = service.create_server(server_name, size, image, region).body
      server_id = body['droplet']['id']
      body
    end

    test('#get_server_details can retrieve by id') do
      body = service.get_server_details(server_id).body
      tests('format').data_matches_schema(server_format) do
        body['droplet']
      end
    end

    server = service.servers.get(server_id)
    server.wait_for { ready? }

    tests('#delete_server').succeeds do
      server.delete
    end

    tests('#list_servers') do
      service.list_servers.body['droplets'].each do |droplet|
        tests('format').data_matches_schema(server_format) do
          droplet
        end
      end
    end
  end
end

Version data entries

7 entries across 5 versions & 2 rubygems

Version Path
fog-digitalocean-0.4.0 tests/digitalocean/requests/compute/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-digitalocean-0.3.0/tests/digitalocean/requests/compute/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-digitalocean-0.3.0/tests/digitalocean/requests/compute/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-digitalocean-0.3.0/tests/digitalocean/requests/compute/server_tests.rb
fog-digitalocean-0.3.0 tests/digitalocean/requests/compute/server_tests.rb
fog-digitalocean-0.2.0 tests/digitalocean/requests/compute/server_tests.rb
fog-digitalocean-0.1.0 tests/digitalocean/requests/compute/server_tests.rb