Sha256: 570d395641f1801c14713bd2c485703f870d3e315346e9a97457f3060b83051b

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

module CoreHelper
  def boot_environment(core_client)
    account               = core_client.accounts.create(name: SecureRandom.hex(4))
    environment           = account.environments.create(name: SecureRandom.hex(4))
    application           = account.applications.create(name: SecureRandom.hex(4))
    provider              = create_provider(account)
    cluster               = environment.clusters.create(name: SecureRandom.hex(4), location: "us-west-2", provider: provider)
    app_component         = core_client.components.first(name: "default_deployer")
    www_cluster_component = cluster.cluster_components.create!(component: app_component, configuration: { application: application.id})
    cluster.slots.create(quantity: 1)

    [account, environment, application]
  end

  def create_provider(account)
    attributes = {type: :aws, provisioned_id: SecureRandom.hex(8)}
    attributes[:credentials] ||= {
      :instance_aws_secret_id  => SecureRandom.hex(6),
      :instance_aws_secret_key => SecureRandom.hex(6),
      :aws_secret_id           => SecureRandom.hex(6),
      :aws_secret_key          => SecureRandom.hex(6),
      :aws_login               => FFaker::Internet.email,
      :aws_pass                => SecureRandom.hex(6),
    }

    account.providers.create!(attributes).resource!
  end
end

RSpec.configure do |config|
  config.include(CoreHelper)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.8 spec/support/core_helper.rb
ey-pro-cli-0.0.7 spec/support/core_helper.rb
ey-pro-cli-0.0.6 spec/support/core_helper.rb
ey-pro-cli-0.0.5 spec/support/core_helper.rb
ey-pro-cli-0.0.4 spec/support/core_helper.rb