Sha256: fb11b05ce6a05c6bbe9fe4844356d5afb9f074fcc9dade1d8f3eb60bc37c38c1

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

require "helpers/integration_test_helper"
require "integration/factories/networks_factory"
require "integration/factories/servers_factory"

class TestNetworks < FogIntegrationTest
  include TestCollection

  def setup
    @subject = Fog::Compute[:google].networks
    @servers = ServersFactory.new(namespaced_name)
    @factory = NetworksFactory.new(namespaced_name)
  end

  def teardown
    # Clean up the server resources used in testing
    @servers.cleanup
    super
  end

  def test_valid_range
    network = @factory.create

    octet = /\d{,2}|1\d{2}|2[0-4]\d|25[0-5]/
    netmask = /(\d{1}|1[0-9]|2[0-9]|3[0-2])/
    re = /\A#{octet}\.#{octet}\.#{octet}\.#{octet}\/#{netmask}\z/

    assert_match(re, network.ipv4_range,
                 "Network range should be valid")
  end

  def test_run_instance
    network = @factory.create
    server = @servers.create(:network_interfaces => [network.get_as_interface_config])

    assert_equal(
      network.self_link,
      server.network_interfaces[0][:network],
      "Created server should have the network specified on boot"
    )
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
fog-google-1.15.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.14.0 test/integration/compute/core_networking/test_networks.rb
gitlab-fog-google-1.14.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.13.0 test/integration/compute/core_networking/test_networks.rb
gitlab-fog-google-1.13.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.12.1 test/integration/compute/core_networking/test_networks.rb
fog-google-1.12.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.11.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.10.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.9.1 test/integration/compute/core_networking/test_networks.rb
fog-google-1.9.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.8.2 test/integration/compute/core_networking/test_networks.rb
fog-google-1.8.1 test/integration/compute/core_networking/test_networks.rb
fog-google-1.8.0 test/integration/compute/core_networking/test_networks.rb
fog-google-1.7.1 test/integration/compute/core_networking/test_networks.rb
fog-google-1.7.0 test/integration/compute/core_networking/test_networks.rb