
IMPORTANT: The file content has been truncated.
Status: Showing lines 1-100 of 196 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 RdsTest do
    let(:helper) { class_double(Helper, change_to: true, run!: true, git_checkout: true) }
    let(:logger) { class_double(Logger, info: true) }

    let(:terraform) do
      class_double(
        Terraform,
        fmt: true,
        init: true,
        validate: true,
        ensure_presence_of_workspace: true
      )
    end

    let(:rds) do
      instance_double(
        Rds,
        identifier: "testservice",
        in_use_by: [
          "test-service"
        ],
        clusters_in_use: {
          "production" => [
            "test"
          ],
          "staging" => [
            "test"
          ]
        },
        instance_class: {
          "production" => "db.t2.small",
          "staging" => "db.t2.micro"
        },
        engine: "postgres",
        engine_version: "11.4",
        allocated_storage: 20,
        storage_encrypted: true,
        storage_type: "gp3",
        db_name: "testapp",
        port: 5432,
        maintenance_window: "mon:19:00-mon:19:30",
        backup_window: "09:00-10:00",
        backup_retention_period: 31,
        force_ssl: true,
        cluster_id: "new-dedicated-cluster-id",
        account_id: 123456789012,
        parameter_store_path_db_url_name: "DATABASE_URL",
        sql_backup_scheduled_task_environment_variables: [
          {
            "name" => "foo",
            "value" => "bar"
          }
        ],
        check_sql_backup_scheduled_task_environment_variables: [
          {
            "name" => "foo",
            "value" => "bar"
          }
        ],
        sync_sql_backup_to_azure: false,
        codebuild_access: [
          "service-name"
        ]
      )
    end

    let!(:rds_test) do
      RdsTest.new(
        rds: rds,
        env: {name: "staging", details: {"min_servers" => 2, "max_servers" => 4}},
        helper: helper,
        logger: logger,
        terraform: terraform
      )
    end

    describe "#call" do
      before do
        allow(Terraform).to receive(:init)
        allow(Terraform).to receive(:ensure_presence_of_workspace)
        allow(logger).to receive(:info)
      end

      let(:workspace_name) { "new-dedicated-cluster-id-testservice-rds-staging" }

      before { rds_test.call }

      it "changes to the ecs-services directory" do
        directory = File.join(
          Infrastructure::APP_ROOT,
          Infrastructure::PATH,
          "rds"
        )

        expect(helper).to have_received(:change_to).with(directory)
      end
