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.6.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.5.4 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.5.3 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.5.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.5.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.5.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.4.3 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.4.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.4.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.4.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.3.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.3.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.2.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.1.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.0.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-1.0.0.rc lib/awspec/generator/spec/elasticsearch.rb
awspec-0.88.2 lib/awspec/generator/spec/elasticsearch.rb
awspec-0.88.1 lib/awspec/generator/spec/elasticsearch.rb
awspec-0.88.0 lib/awspec/generator/spec/elasticsearch.rb
awspec-0.87.1 lib/awspec/generator/spec/elasticsearch.rb