Sha256: 09aac55f0ea393b2ee91487a2d9cbf8dae529b328a225f4f292d989b1bc294d0

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

class Brightbox
  class Compute
    module TestSupport
      # Find a suitable image for testing with
      # For speed of server building we're using an empty image
      #
      # Unless the tester has credentials this will fail so we rescue
      # any errors and return nil.
      #
      # This is used in the shared file +tests/compute/helper.rb+ so unfortunately
      # makes all tests reliant on hardcoded values and each other
      #
      # @return [String,NilClass] the most suitable test image's identifier or nil
      def self.image_id
        return @image_id unless @image_id.nil?
        images = Fog::Compute[:brightbox].list_images
        @image_id = Fog::Brightbox::Compute::ImageSelector.new(images).official_minimal
      end

      # Prepare a test server, wait for it to be usable but raise if it fails
      def self.get_test_server
        test_server_options = { :image_id => image_id }
        server = Fog::Compute[:brightbox].servers.create(test_server_options)
        server.wait_for do
          raise "Test server failed to build" if state == "failed"
          ready?
        end
        server
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fog-brightbox-1.10.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.9.1 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.9.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.8.2 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.8.1 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.8.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.7.3 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.7.2 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.7.1 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.7.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.6.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.5.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.5.0.rc1 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.4.2 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.4.1 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.4.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.3.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.2.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.1.0 tests/brightbox/requests/compute/helper.rb
fog-brightbox-1.0.0 tests/brightbox/requests/compute/helper.rb