Sha256: 7b15bad08bc6bb794835f7dc0d58c435e4117d6aacace7795f0be02987a0a429

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

module Awspec::Generator
  module Spec
    class Elasticsearch
      include Awspec::Helper::Finder
      def generate_all
        domains = select_all_elasticsearch_domains
        raise 'Not Found Domain' if domains.empty?

        ERB.new(domain_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
      end

      def domain_spec_template
        <<-'EOF'
<% domains.each do |domain| %>
describe elasticsearch('<%= domain.domain_status.domain_name %>') do
  it { should exist }
<% if domain.domain_status.created %>
  it { should be_created }
<% end %>
<% if domain.domain_status.deleted %>
  it { should be_deleted }
<% end %>
  its(:elasticsearch_version) { should eq '<%= domain.domain_status.elasticsearch_version %>' }
  its('elasticsearch_cluster_config.instance_type') { should eq '<%= domain.domain_status.elasticsearch_cluster_config.instance_type %>' }
  its('ebs_options.ebs_enabled') { should eq <%= domain.domain_status.ebs_options.ebs_enabled %> }
<% if domain.domain_status.ebs_options.ebs_enabled -%>
  its('ebs_options.volume_type') { should eq '<%= domain.domain_status.ebs_options.volume_type %>' }
  its('ebs_options.volume_size') { should eq <%= domain.domain_status.ebs_options.volume_size %> }
<% end %>
  it do
    should have_access_policies <<-policy
<%= JSON.pretty_generate(JSON.load(domain.domain_status.access_policies)) %>
  policy
  end
end
<% end %>
EOF
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
awspec-1.30.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.29.3 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.29.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.29.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.29.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.28.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.28.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.28.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.27.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.27.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.26.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.25.2 lib/awspec/generator/spec/elasticsearch.rb