consul icon indicating copy to clipboard operation
consul copied to clipboard

Why are unit tests disabled? Any plans to return them back?

Open KIVagant opened this issue 2 years ago • 1 comments

:speaking_head: Foreword

I was researching an issue I'm getting in tests (undefined method new_resource' for ConsulCookbook::Resource::ConsulConfigV0), so I wanted to look at the tests in the repo to find a good example for them. And I see that [all tests are disabled](https://github.com/sous-chefs/consul/pull/564) since Jun 2, 2020`. Do you plan to enable them back?

:ghost: Brief Description

No tests in the repo

:pancakes: Cookbook version

latest

:woman_cook: Chef-Infra Version

14.7.17

:tophat: Platform details

Steps To Reproduce

Run tests

:police_car: Expected behavior

100% covered and builds are green :)

:heavy_plus_sign: Additional context

Maybe someone also could help me to understand why I get the undefined method new_resource'from all tests inchefdk:3.5.13? It used to work in chefdk:3.0.36`. 🥺

The receipt is as minimal as possible:

config = consul_config('consul') do |r|
end

The test looks like this:

require 'spec_helper'
describe 'consul_agent::default' do
  cached(:chef_run) do
    ChefSpec::SoloRunner.new do |node|
      node.normal['languages'] = { 'python' => { 'version' => '2.7.1' } }
    end.converge(described_recipe)
  end
  it 'ensures it will boot as an agent' do
    expect(chef_run.node['consul']['config']['server']).to eq(false)
  end
end

It fails with:

  1) consul_agent::default ensures it will boot as an agent
     Failure/Error:
       ChefSpec::SoloRunner.new do |node|
         node.normal['languages'] = { 'python' => { 'version' => '2.7.1' } }
       end.converge(described_recipe)

     NoMethodError:
       undefined method `new_resource' for ConsulCookbook::Resource::ConsulConfigV0
     # /tmp/d20211001-196-1l6bw5/cookbooks/poise/files/halite_gem/poise/helpers/lwrp_polyfill.rb:34:in `initialize'
     # /tmp/d20211001-196-1l6bw5/cookbooks/poise/files/halite_gem/poise/helpers/resource_name.rb:32:in `initialize'
     # /tmp/d20211001-196-1l6bw5/cookbooks/consul_agent/recipes/install.rb:38:in `from_file'
     # /tmp/d20211001-196-1l6bw5/cookbooks/consul_agent/recipes/default.rb:7:in `from_file'
     # ./spec/unit/recipes/ba_consul_agent_spec.rb:13:in `block (2 levels) in <top (required)>'
     # ./spec/unit/recipes/ba_consul_agent_spec.rb:23:in `block (2 levels) in <top (required)>'

Appreciate any help!

KIVagant avatar Oct 01 '21 04:10 KIVagant

I suspect because they're currently failing. If you're able to fix them, please feel free to enable and fix them.

damacus avatar Apr 04 '23 10:04 damacus