Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Chef/Deprecations/DeprecatedChefSpecPlatform for new fauxhai deprecations #938

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright:: 2020, Chef Software Inc.
# Copyright:: 2020-2022, Chef Software Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -34,6 +34,7 @@ class DeprecatedChefSpecPlatform < Base
DEPRECATED_MAPPING = {
'amazon' => {
'2017.12' => '2',
'> 2010' => true,
},
'aix' => {
'~> 6' => true,
Expand All @@ -46,15 +47,15 @@ class DeprecatedChefSpecPlatform < Base
'> 16.04, < 18.04' => true,
},
'fedora' => {
'< 31' => '31',
'< 32' => '32',
},
'freebsd' => {
'~> 11.0, < 11.2' => '11',
'= 12.0' => '12',
'< 11' => true,
'< 12' => true,
},
'mac_os_x' => {
'< 10.14' => '10.15',
' = 11.0' => '11',
},
'suse' => {
'~> 12.0, < 12.4' => '12',
Expand All @@ -67,17 +68,17 @@ class DeprecatedChefSpecPlatform < Base
},
'debian' => {
'< 9' => true,
'> 9.0, < 9.11' => '9',
'> 9.0, < 9.12' => '9',
},
'centos' => {
'< 6.0' => true,
'~> 6.0, < 6.10' => '6',
'~> 7.0, < 7.7 ' => '7',
'~> 7.0, < 7.8 ' => '7',
},
'redhat' => {
'< 6.0' => true,
'~> 6.0, < 6.10' => '6',
'~> 7.0, < 7.7' => '7',
'~> 7.0, < 7.8' => '7',
},
'oracle' => {
'< 6.0' => true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright:: 2020, Chef Software, Inc.
# Copyright:: 2020-2022, Chef Software, Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -57,4 +57,19 @@
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'centos', version: '200') }
RUBY
end

it "registers an offense when spec calls for Amazon 2018.03, but doesn't autocorrect" do
expect_offense(<<~RUBY)
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'amazon', version: '2018.03') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md. Fauxhai / ChefSpec will perform fuzzy matching on platform version so it's always best to be less specific ie. 10 instead of 10.3
RUBY

expect_no_corrections
end

it "doesn't register an offense with Amazon Linux 2022" do
expect_no_offenses(<<~RUBY)
let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'amazon', version: '2002') }
RUBY
end
end