k1LoW / awspec

RSpec tests for your AWS resources.
MIT License
1.17k stars 192 forks source link

Documentation for eks_nodegroup is not working properly #536

Open glasswalk3r opened 3 years ago

glasswalk3r commented 3 years ago

When I execute

bundle exec rake generate_docs

The resulting Markdown completely ignores the content available on the file awspec/doc/_resource_types/eks_nodegroup.md, producing exactly the same content, which is different of the Markdown file has.

This is the current content of the mentioned file:

### exist

ruby
describe eks_nodegroup('my-eks-nodegroup'), cluster: 'my-cluster' do
  it { should exist }
end

### be_active, be_creating

ruby
describe eks('my-eks-nodegroup'), cluster: 'my-cluster' do
  it { should be_active }
end

The second code section is never inserted, neither changes on the header ### be_active, be_creating.

I was able to conduct some debugging from lib/awspec/generator/doc/type/base.rb, all the expected content is available on @descriptions before actually generating the template result:

          @descriptions = {}
          merge_file = File.dirname(__FILE__) + '/../../../../../doc/_resource_types/' + type_name.underscore + '.md'
          if File.exist?(merge_file)
            matcher = nil
            File.foreach(merge_file) do |line|
              if /\A### (.+)\Z/ =~ line
                matcher = Regexp.last_match[1]
                next
              end
              @descriptions[matcher] = '' unless @descriptions[matcher]
              @descriptions[matcher] += line
            end
          end
          ERB.new(doc_template, nil, '-').result(binding)

But for some reason, the Markdown on @descriptions never reaches doc/resource_types.md. I even attempt to delete the whole eks_nodegroup section from the file before generating again, but the result is the same.

Also, I believe that this automatic documentation process lacks, well, it's own documentation. I'm not sure either what the automation expected from those Markdown snippets to do it's work.