Sha256: 35f99d923ed340ece5d17a49af7edab6f6214190abff261238f27a2d3d9feb4e

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

module Vcloud
  module Core
    describe EdgeGateway do

      required_env = {
        'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
        'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
        'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
      }

      error = false
      required_env.each do |var,message|
        unless ENV[var]
          puts "Must set #{var} #{message}" unless ENV[var]
          error = true
        end
      end
      Kernel.exit(2) if error

      context "get vcloud attributes for given gateway interface id " do
        before(:all) do
          @edge_gateway = EdgeGateway.get_by_name(ENV['VCLOUD_EDGE_GATEWAY'])
        end
        it "should return provider network" do
          gateway_interface = @edge_gateway.vcloud_gateway_interface_by_id(ENV['VCLOUD_PROVIDER_NETWORK_ID'])
          expect(gateway_interface[:Network]).not_to be_nil
          expect(gateway_interface[:Network][:href]).to include(ENV['VCLOUD_PROVIDER_NETWORK_ID'])
        end

        it "should return orgVdcNetwork" do
          gateway_interface = @edge_gateway.vcloud_gateway_interface_by_id(ENV['VCLOUD_NETWORK1_ID'])
          expect(gateway_interface[:Network]).not_to be_nil
          expect(gateway_interface[:Network][:href]).to include(ENV['VCLOUD_NETWORK1_ID'])
        end

        it "return nil if network with given id is not found" do
          gateway_interface = @edge_gateway.vcloud_gateway_interface_by_id(SecureRandom.uuid)
          expect(gateway_interface).to be_nil
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vcloud-core-0.5.0 spec/integration/edge_gateway/edge_gateway_spec.rb
vcloud-core-0.4.0 spec/integration/edge_gateway/edge_gateway_spec.rb
vcloud-core-0.3.0 spec/integration/edge_gateway/edge_gateway_spec.rb
vcloud-core-0.2.0 spec/integration/edge_gateway/edge_gateway_spec.rb
vcloud-core-0.1.0 spec/integration/edge_gateway/edge_gateway_spec.rb
vcloud-core-0.0.13 spec/integration/edge_gateway/edge_gateway_spec.rb