Kitchen inpect test cannot recognize the resource "firewalld" (CentOS 7)

I have a inspec test rb file:

describe firewalld do
  it { should be_running }

After run it gives the error:

$ kitchen verify
-----> Starting Kitchen (v1.17.0)
-----> Verifying <default-generic-rhel7>...
       Loaded tests from test/smoke/default 
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [undefined local variable or method `firewalld' for #<#<Class:0x00000000046df570>:0x00000000046de530>] on default-generic-rhel7
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

While I run other resources such as “iptables” it is successful.

Why the inspect in kitchen cannot recognize the resource firewalld? I am running a CentOS 7 VM for testing.

Given your older version of Test Kitchen it is likely you are also running an older version of InSpec. It looks like the firewalld resource was added in InSpec 1.14:

@coderanger, I am running latest inspec 1.51.0. Did you successfully run this resource on your computer?

How are you judging that version of InSpec? For kitchen-inspec what matters is the version included with the ChefDK installer you used. Which version of ChefDK do you have (chef --version).

xianlin@t470s-work:~/Code/sgdc-repo/gs_base$ chef --version
Chef Development Kit Version: 2.3.4
chef-client version: 13.4.19
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: 1.17.0
inspec version: 1.36.1