106 lines
3.6 KiB
Plaintext
106 lines
3.6 KiB
Plaintext
|
|
IMPORTANT: The file content has been truncated.
|
|
Status: Showing lines 1-100 of 3243 total lines.
|
|
Action: To read more of the file, you can use the 'offset' and 'limit' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use offset: 100.
|
|
|
|
--- FILE CONTENT (truncated) ---
|
|
require_relative "../support/spec_helper"
|
|
|
|
module Dalmatian
|
|
RSpec.describe "tests local configuration" do
|
|
def fake_parameter_store
|
|
double(
|
|
"parameter_store",
|
|
get_parameter: "",
|
|
get_parameters_by_path: {}
|
|
)
|
|
end
|
|
|
|
def tfvar_arg_string(tfvars)
|
|
Terraform.tfvar_arg_string(tfvars)
|
|
end
|
|
|
|
def terraform_validate_cmd(tfvar_string)
|
|
"#{tfvar_string} terraform validate"
|
|
end
|
|
|
|
def terraform_plan_cmd(tfvar_string)
|
|
"#{tfvar_string} terraform plan"
|
|
end
|
|
|
|
def stub_workspace_creation_cmds
|
|
%w[
|
|
new-dedicated-cluster-example-domain-name-com-hz
|
|
new-dedicated-cluster-test-s3
|
|
new-dedicated-cluster-test-vpn-vpn-cg
|
|
new-dedicated-cluster-ecs-production
|
|
new-dedicated-cluster-ecs-staging
|
|
new-dedicated-cluster-0-production
|
|
new-dedicated-cluster-0-staging
|
|
new-dedicated-cluster-test-service-staging
|
|
new-dedicated-cluster-test-service-production
|
|
new-dedicated-cluster-test-1-waf-staging
|
|
new-dedicated-cluster-test-1-waf-production
|
|
new-dedicated-cluster-testservice-rds-staging
|
|
new-dedicated-cluster-testservice-rds-production
|
|
new-dedicated-cluster-testredis-elasticache-cluster-staging
|
|
new-dedicated-cluster-testredis-elasticache-cluster-production
|
|
new-dedicated-cluster-testos-opensearch-cluster-staging
|
|
new-dedicated-cluster-testos-opensearch-cluster-production
|
|
new-dedicated-cluster-test-lb-1-shared-loadbalancer-staging
|
|
new-dedicated-cluster-test-lb-1-shared-loadbalancer-production
|
|
shared-new-cluster-ecs-production
|
|
shared-new-cluster-ecs-staging
|
|
existing-shared-cluster-staging-0-staging
|
|
existing-shared-cluster-production-0-production
|
|
].each do |workspace_name|
|
|
allow(Helper).to receive(:run!).with("terraform workspace new #{workspace_name}")
|
|
end
|
|
end
|
|
|
|
def stub_git_checkout
|
|
allow(Helper).to receive(:run!).with("git checkout feature/experiment")
|
|
end
|
|
|
|
def stub_git_clone_cmds
|
|
[
|
|
{
|
|
source: "git@github.com:dxw/awesome-app-dalmatian-config",
|
|
name: "new-dedicated-cluster-0.config"
|
|
},
|
|
{
|
|
source: "git@github.com:dxw/funky-app-dalmatian-config",
|
|
name: "existing-shared-cluster-staging-0.config"
|
|
},
|
|
{
|
|
source: "git@github.com:dxw/neat-app-dalmatian-config",
|
|
name: "existing-shared-cluster-production-0.config"
|
|
},
|
|
{
|
|
source: "git@github.com:dxw/neat-app-dalmatian-config",
|
|
name: "existing-shared-cluster-production-0.config"
|
|
}
|
|
|
|
].each do |src|
|
|
allow(Helper).to receive(:run!)
|
|
.with("git clone #{src.fetch(:source)} terraform/infrastructures/#{src.fetch(:name)}")
|
|
end
|
|
end
|
|
|
|
def infrastructure_defaults
|
|
{
|
|
"region" => "eu-west-2",
|
|
"cidr" => "10.0.0.0/16",
|
|
"root_domain_zone" => "dalmatian.dxw.net",
|
|
"internal_domain_zone" => "dalmatian.internal",
|
|
"ecs_private_subnets" => [
|
|
{
|
|
"availability_zone" => "eu-west-2a",
|
|
"cidr" => "10.0.128.0/24"
|
|
},
|
|
{
|
|
"availability_zone" => "eu-west-2b",
|
|
"cidr" => "10.0.129.0/24"
|
|
},
|
|
{
|
|
"availability_zone" => "eu-west-2c", |