mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
Merge pull request #4419 from inspec/cw/check-enforce-version
inspec check: warn if inspec_version is not supported by current inspec
This commit is contained in:
commit
f90a4c633d
3 changed files with 18 additions and 0 deletions
|
@ -88,6 +88,10 @@ module Inspec
|
|||
errors.push("Version needs to be in SemVer format")
|
||||
end
|
||||
|
||||
unless supports_runtime?
|
||||
warnings.push("The current inspec version #{Inspec::VERSION} cannot satisfy profile inspec_version constraint #{params[:inspec_version]}")
|
||||
end
|
||||
|
||||
%w{title summary maintainer copyright license}.each do |field|
|
||||
next unless params[field.to_sym].nil?
|
||||
|
||||
|
|
|
@ -106,4 +106,13 @@ describe "inspec check" do
|
|||
assert_exit_code 1, out
|
||||
end
|
||||
end
|
||||
|
||||
describe "inspec check with unsatisfied runtime version constraint" do
|
||||
it "should enforce runtime version constraint" do
|
||||
out = inspec("check #{profile_path}/unsupported_inspec")
|
||||
out.stdout.must_include "The current inspec version #{Inspec::VERSION}"
|
||||
out.stdout.must_include ">= 99.0.0"
|
||||
assert_exit_code 1, out
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -242,5 +242,10 @@ EOF
|
|||
m = version_meta("> " + next_version)
|
||||
m.supports_runtime?.must_equal false
|
||||
end
|
||||
|
||||
it "is included in valid?" do
|
||||
m = version_meta("> #{next_version}")
|
||||
refute m.valid?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue