Sha256: 7d48e42cc3f6fa4cceac1ac44604e77a1a4fe4c4a86a5e0fe58dd9e4074f90de

Contents?: true

Size: 1.42 KB

Versions: 108

Compression:

Stored size: 1.42 KB

Contents

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
        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
        template
      end
    end
  end
end

Version data entries

108 entries across 108 versions & 4 rubygems

Version Path
awspec-1.25.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.25.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.24.4 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.24.3 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.24.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.24.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.24.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.23.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.22.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.22.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.21.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.21.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.20.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.19.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.19.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.19.0 lib/awspec/generator/spec/elasticsearch.rb
cthiesfork-awspec-1.2.4 lib/awspec/generator/spec/elasticsearch.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/generator/spec/elasticsearch.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.18.6 lib/awspec/generator/spec/elasticsearch.rb