Sha256: 6fa05aa7b0a7bb780b26e5d8242f77b4a7d670f5445519167abdf4116ec90403

Contents?: true

Size: 981 Bytes

Versions: 2

Compression:

Stored size: 981 Bytes

Contents

module Ey
  module Core
    module TestHelpers
      module AutoScalingHelpers
        def create_auto_scaling_group(options = {})
          environment = options[:environment] || create_environment

          groups = client.auto_scaling_groups

          groups.create!(
            minimum_size: 2,
            maximum_size: 6,
            environment: environment
          ).resource!
        end

        def create_auto_scaling_policy(options = {})
          group = options.delete(:auto_scaling_group) || create_auto_scaling_group
          policies = client.auto_scaling_policies

          policies.create!(
            {
              auto_scaling_group_id: group.id,
              action_value: 2,
              action_unit: "instances",
              action_type: "add",
              name: SecureRandom.hex(16),
              type: "simple"
            }.merge(options)
          ).resource!
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ey-core-3.6.6 lib/ey-core/test_helpers/auto_scaling_helpers.rb
ey-core-3.6.5 lib/ey-core/test_helpers/auto_scaling_helpers.rb