chef-acme icon indicating copy to clipboard operation
chef-acme copied to clipboard

False positive Chefspec matcher `create_acme_certificate()`

Open willis7 opened this issue 7 years ago • 0 comments

describe 'site-proxy::letsencrypt' do
  context 'When all attributes are default, on debian 8.7' do
    let(:chef_run) { ChefSpec::SoloRunner.new(DEBIAN_OPTS).converge(described_recipe) }

    it 'includes `acme` recipe' do
      expect(chef_run).to include_recipe('acme')
    end

    it 'creates a self signed certificate with attributes' do
      expect(chef_run).to create_acme_selfsigned('my-site.com')
      expect(chef_run).to_not create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')
    end
  end

  context 'When configured for live, on debian 8.7' do
    let(:chef_run) {
      ChefSpec::SoloRunner.new(DEBIAN_OPTS) do |node|
        node.normal['site']['lets_encrypt']['enabled'] = true
      end.converge(described_recipe)
    }

    it 'creates a ca certificate' do
      expect(chef_run).to create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')
      expect(chef_run).to_not create_acme_selfsigned('my-site.com')
    end
  end
end

The output is:

Failures:

  1) site-proxy::letsencrypt When configured for live, on debian 8.7 creates a ca certificate with attributes
     Failure/Error: expect(chef_run).to create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')

       expected "acme_certificate[/etc/nginx/ssl/my-site.com.crt]" with action :create to be in Chef run. Other acme_certificate resources:

I'm really confused with this failure despite having a match. Am I missing something?

willis7 avatar Sep 20 '17 08:09 willis7