Sha256: e693fb877710a87c66b71f4c75cd09fd119e34c2f2ea1f660176133aa4f14bbf

Contents?: true

Size: 946 Bytes

Versions: 8

Compression:

Stored size: 946 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

8 entries across 8 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/test_helpers/auto_scaling_helpers.rb
ey-core-3.6.4 lib/ey-core/test_helpers/auto_scaling_helpers.rb
ey-core-3.6.3 lib/ey-core/test_helpers/auto_scaling_helpers.rb
ey-core-3.6.1 lib/ey-core/test_helpers/auto_scaling_helpers.rb
groove-ey-core-3.6.3 lib/ey-core/test_helpers/auto_scaling_helpers.rb
groove-ey-core-3.6.2 lib/ey-core/test_helpers/auto_scaling_helpers.rb
groove-ey-core-3.6.1 lib/ey-core/test_helpers/auto_scaling_helpers.rb
ey-core-3.5.0 lib/ey-core/test_helpers/auto_scaling_helpers.rb