diff --git a/.kitchen.yml b/.kitchen.yml index 919aef4..4038f00 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,3 +1,3 @@ --- #<% require 'poise_boiler' %> -<%= PoiseBoiler.kitchen %> +<%= PoiseBoiler.kitchen(platforms: %w{ubuntu-16.04 centos-7}) %> diff --git a/.travis.yml b/.travis.yml index 25c0084..67d30a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty sudo: false cache: bundler language: ruby @@ -18,38 +19,12 @@ matrix: include: - rvm: 2.3.1 gemfile: test/gemfiles/chef-12.gemfile - - rvm: 2.4.1 + - rvm: 2.4.3 gemfile: test/gemfiles/chef-13.gemfile - - rvm: 2.1.4 - gemfile: test/gemfiles/chef-12.1.gemfile - - rvm: 2.1.4 - gemfile: test/gemfiles/chef-12.2.gemfile - - rvm: 2.1.4 - gemfile: test/gemfiles/chef-12.3.gemfile - - rvm: 2.1.6 - gemfile: test/gemfiles/chef-12.4.gemfile - - rvm: 2.1.6 - gemfile: test/gemfiles/chef-12.5.gemfile - - rvm: 2.1.6 - gemfile: test/gemfiles/chef-12.6.gemfile - - rvm: 2.1.6 - gemfile: test/gemfiles/chef-12.7.gemfile - - rvm: 2.1.6 - gemfile: test/gemfiles/chef-12.8.gemfile - - rvm: 2.1.8 - gemfile: test/gemfiles/chef-12.9.gemfile - - rvm: 2.1.8 - gemfile: test/gemfiles/chef-12.10.gemfile - - rvm: 2.1.8 - gemfile: test/gemfiles/chef-12.11.gemfile - - rvm: 2.1.8 - gemfile: test/gemfiles/chef-12.12.gemfile - - rvm: 2.1.9 - gemfile: test/gemfiles/chef-12.13.gemfile - - rvm: 2.3.1 - gemfile: test/gemfiles/chef-12.14.gemfile - - rvm: 2.3.1 - gemfile: test/gemfiles/chef-12.15.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/master.gemfile - rvm: 2.3.1 gemfile: test/gemfiles/chef-12.16.gemfile - rvm: 2.3.1 @@ -58,6 +33,10 @@ matrix: gemfile: test/gemfiles/chef-12.18.gemfile - rvm: 2.3.1 gemfile: test/gemfiles/chef-12.19.gemfile + - rvm: 2.3.1 + gemfile: test/gemfiles/chef-12.20.gemfile + - rvm: 2.3.1 + gemfile: test/gemfiles/chef-12.21.gemfile - rvm: 2.4.1 gemfile: test/gemfiles/chef-13.0.gemfile - rvm: 2.4.1 @@ -65,4 +44,26 @@ matrix: - rvm: 2.4.1 gemfile: test/gemfiles/chef-13.2.gemfile - rvm: 2.4.1 - gemfile: test/gemfiles/master.gemfile + gemfile: test/gemfiles/chef-13.3.gemfile + - rvm: 2.4.2 + gemfile: test/gemfiles/chef-13.4.gemfile + - rvm: 2.4.2 + gemfile: test/gemfiles/chef-13.5.gemfile + - rvm: 2.4.2 + gemfile: test/gemfiles/chef-13.6.gemfile + - rvm: 2.4.3 + gemfile: test/gemfiles/chef-13.8.gemfile + - rvm: 2.4.3 + gemfile: test/gemfiles/chef-13.9.gemfile + - rvm: 2.4.3 + gemfile: test/gemfiles/chef-13.10.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.0.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.1.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.2.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.3.gemfile + - rvm: 2.5.1 + gemfile: test/gemfiles/chef-14.4.gemfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 5460358..485d49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Poise-Python Changelog +## v1.7.1 + +* Support for Pip 18.1. +* Improved support for Python 3 on Ubuntu 18.04. +* Update SCL packages. + +## v1.7.0 + +* Support for Pip 10. +* Support for Chef 14. +* System package info for Ubuntu 18.04 and Debian 9, 10. + ## v1.6.0 * Improved handling for Python 3.3. diff --git a/Gemfile b/Gemfile index 0640ad1..a72fef5 100644 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,7 @@ def dev_gem(name, path: File.join('..', name), github: nil) end end -dev_gem 'halite' +dev_gem 'halite', github: 'poise/halite' dev_gem 'poise' dev_gem 'poise-archive' dev_gem 'poise-boiler' diff --git a/Rakefile b/Rakefile index d2b12d0..cb942ad 100644 --- a/Rakefile +++ b/Rakefile @@ -14,4 +14,5 @@ # limitations under the License. # +ENV['KITCHEN_CONCURRENCY'] = '10' require 'poise_boiler/rakefile' diff --git a/lib/poise_python/python_providers/scl.rb b/lib/poise_python/python_providers/scl.rb index e9f66b2..9f67d40 100644 --- a/lib/poise_python/python_providers/scl.rb +++ b/lib/poise_python/python_providers/scl.rb @@ -26,7 +26,8 @@ module PythonProviders class Scl < Base include PoiseLanguages::Scl::Mixin provides(:scl) - scl_package('3.5.1', 'rh-python35', 'rh-python35-python-devel', '>= 7.0') + scl_package('3.6.3', 'rh-python36', 'rh-python36-python-devel') + scl_package('3.5.1', 'rh-python35', 'rh-python35-python-devel') scl_package('3.4.2', 'rh-python34', 'rh-python34-python-devel') scl_package('3.3.2', 'python33', 'python33-python-devel') scl_package('2.7.8', 'python27', 'python27-python-devel') diff --git a/lib/poise_python/python_providers/system.rb b/lib/poise_python/python_providers/system.rb index 4c341e9..ba492d9 100644 --- a/lib/poise_python/python_providers/system.rb +++ b/lib/poise_python/python_providers/system.rb @@ -28,11 +28,14 @@ class System < Base provides(:system) packages('python', { debian: { + '~> 10.0' => %w{python3.6 python2.7}, + '~> 9.0' => %w{python3.5 python2.7}, '~> 8.0' => %w{python3.4 python2.7}, '~> 7.0' => %w{python3.2 python2.7 python2.6}, '~> 6.0' => %w{python3.1 python2.6 python2.5}, }, ubuntu: { + '18.04' => %w{python3.6 python2.7}, '16.04' => %w{python3.5 python2.7}, '14.04' => %w{python3.4 python2.7}, '12.04' => %w{python3.2 python2.7}, @@ -54,9 +57,22 @@ def python_binary def install_python install_system_packages + if node.platform_family?('debian') && system_package_name == 'python3.6' + # Ubuntu 18.04 and Debian 10 have some weird dependency fuckery going on. + _options = options + package %w{python3.6-venv python3.6-distutils} do + action(:upgrade) if _options['package_upgrade'] + end + end end def uninstall_python + if node.platform_family?('debian') && system_package_name == 'python3.6' + # Other side of the depdency nonsense. + package %w{python3.6-venv python3.6-distutils} do + action(:purge) + end + end uninstall_system_packages end @@ -71,7 +87,7 @@ def system_package_candidates(version) end # Aliases for 2 and 3. if version == '3' || version == '' - names.concat(%w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3}) + names.concat(%w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3}) end if version == '2' || version == '' names.concat(%w{python2.7 python27 python2.6 python26 python2.5 python25}) diff --git a/lib/poise_python/resources/python_package.rb b/lib/poise_python/resources/python_package.rb index dc1819b..64e32e6 100644 --- a/lib/poise_python/resources/python_package.rb +++ b/lib/poise_python/resources/python_package.rb @@ -38,14 +38,25 @@ module PythonPackage import pip # Don't use pkg_resources because I don't want to require it before this anyway. -if re.match(r'0|1|6\\.0', pip.__version__): +if re.match(r'0\\.|1\\.|6\\.0', pip.__version__): sys.stderr.write('The python_package resource requires pip >= 6.1.0, currently '+pip.__version__+'\\n') sys.exit(1) -from pip.commands import InstallCommand -from pip.index import PackageFinder -from pip.req import InstallRequirement - +try: + from pip.commands import InstallCommand + from pip.index import PackageFinder + from pip.req import InstallRequirement + install_req_from_line = InstallRequirement.from_line +except ImportError: + # Pip 10 moved all internals to their own package. + from pip._internal.commands import InstallCommand + from pip._internal.index import PackageFinder + try: + # Pip 18.1 moved from_line to the constructors + from pip._internal.req.constructors import install_req_from_line + except ImportError: + from pip._internal.req import InstallRequirement + install_req_from_line = InstallRequirement.from_line packages = {} cmd = InstallCommand() @@ -68,7 +79,7 @@ module PythonPackage finder = PackageFinder(**finder_options) find_all = getattr(finder, 'find_all_candidates', getattr(finder, '_find_all_versions', None)) for arg in args: - req = InstallRequirement.from_line(arg) + req = install_req_from_line(arg) found = finder.find_requirement(req, True) all_candidates = find_all(req.name) candidate = [c for c in all_candidates if c.location == found] @@ -113,6 +124,12 @@ class Resource < Chef::Resource::Package # @return [String, Integer, nil] attribute(:user, kind_of: [String, Integer, NilClass], default: lazy { default_user }) + # This should probably be in the base class but ¯\_(ツ)_/¯. + # @!attribute allow_downgrade + # Allow downgrading the package. + # @return [Boolean] + attribute(:allow_downgrade, kind_of: [TrueClass, FalseClass], default: false) + def initialize(*args) super # For older Chef. @@ -187,6 +204,7 @@ def load_current_resource @current_resource = new_resource.class.new(new_resource.name, run_context) current_resource.package_name(new_resource.package_name) check_package_versions(current_resource) + Chef::Log.debug("[#{new_resource}] Current version: #{current_resource.version}, candidate version: #{@candidate_version}") current_resource end @@ -200,7 +218,7 @@ def load_current_resource def check_package_versions(resource, version=new_resource.version) version_data = Hash.new {|hash, key| hash[key] = {current: nil, candidate: nil} } # Get the version for everything currently installed. - list = pip_command('list', :list).stdout + list = pip_command('list', :list, [], environment: {'PIP_FORMAT' => 'json'}).stdout parse_pip_list(list).each do |name, current| # Merge current versions in to the data. version_data[name][:current] = current @@ -347,15 +365,22 @@ def pip_outdated(requirements) # @param text [String] Output to parse. # @return [Hash] def parse_pip_list(text) - text.split(/\r?\n/).inject({}) do |memo, line| - # Example of a line: - # boto (2.25.0) - if md = line.match(/^(\S+)\s+\(([^\s,]+).*\)$/i) - memo[parse_package_name(md[1])] = md[2] - else - Chef::Log.debug("[#{new_resource}] Unparsable line in pip list: #{line}") + if text[0] == '[' + # Pip 9 or newer, so it understood $PIP_FORMAT=json. + Chef::JSONCompat.parse(text).each_with_object({}) do |data, memo| + memo[parse_package_name(data['name'])] = data['version'] + end + else + # Pip 8 or earlier, which doesn't support JSON output. + text.split(/\r?\n/).each_with_object({}) do |line, memo| + # Example of a line: + # boto (2.25.0) + if md = line.match(/^(\S+)\s+\(([^\s,]+).*\)$/i) + memo[parse_package_name(md[1])] = md[2] + else + Chef::Log.debug("[#{new_resource}] Unparsable line in pip list: #{line}") + end end - memo end end diff --git a/lib/poise_python/resources/python_runtime.rb b/lib/poise_python/resources/python_runtime.rb index 4692dd1..9a974a9 100644 --- a/lib/poise_python/resources/python_runtime.rb +++ b/lib/poise_python/resources/python_runtime.rb @@ -51,6 +51,7 @@ class Resource < Chef::Resource # of https://bootstrap.pypa.io/get-pip.py is used. If you want to skip # the pip installer entirely, set {#pip_version} to `false`. # @return [String] + # If this default value changes, fix ths 2.6-compat logic in python_runtime_pip. attribute(:get_pip_url, kind_of: String, default: 'https://bootstrap.pypa.io/get-pip.py') # @!attribute pip_version # Version of pip to install. If set to `true`, the latest available diff --git a/lib/poise_python/resources/python_runtime_pip.rb b/lib/poise_python/resources/python_runtime_pip.rb index 4a51cb8..dac9cc7 100644 --- a/lib/poise_python/resources/python_runtime_pip.rb +++ b/lib/poise_python/resources/python_runtime_pip.rb @@ -30,6 +30,12 @@ module PythonRuntimePip # Earliest version of pip we will try upgrading in-place. PIP_INPLACE_VERSION = Gem::Version.create('7.0.0') + # Version to trigger the automatic get-pip.py URL fixup on for 2.6 compat. + PY26_FIXUP_VERSION = Gem::Version.create('2.7') + + # Replacement URL for 2.6 compat. + PY26_FIXUP_GETPIP_URL = 'https://bootstrap.pypa.io/2.6/get-pip.py' + # A `python_runtime_pip` resource to install/upgrade pip itself. This is # used internally by `python_runtime` and is not intended to be a public # API. @@ -103,15 +109,30 @@ def action_uninstall # # @return [void] def bootstrap_pip + # If we're on Python 2.6 and using the default get_pip_url, we need to + # switch to a 2.6-compatible version. This kind of sucks because it + # makes the default a magic value but it seems like the safest option. + get_pip_url = new_resource.get_pip_url + if get_pip_url == 'https://bootstrap.pypa.io/get-pip.py' + python_version_cmd = poise_shell_out!([new_resource.parent.python_binary, '--version'], environment: new_resource.parent.python_environment) + # Python 2 puts the output on stderr, 3 is on stdout. You can't make this shit up. + python_version = (python_version_cmd.stdout + python_version_cmd.stderr)[/Python (\S+)/, 1] + Chef::Log.debug("[#{new_resource}] Checking for Python 2.6 fixup of get-pip URL, found Python version #{python_version || '(unknown)'}") + if python_version && Gem::Version.create(python_version) < PY26_FIXUP_VERSION + Chef::Log.debug("[#{new_resource}] Detected old Python, enabling fixup") + get_pip_url = PY26_FIXUP_GETPIP_URL + end + end + # Always updated if we have hit this point. - converge_by("Bootstrapping pip #{new_resource.version || 'latest'} from #{new_resource.get_pip_url}") do + converge_by("Bootstrapping pip #{new_resource.version || 'latest'} from #{get_pip_url}") do # Use a temp file to hold the installer. # Put `Tempfile.create` back when Chef on Windows has a newer Ruby. # Tempfile.create(['get-pip', '.py']) do |temp| temp = Tempfile.new(['get-pip', '.py']) begin # Download the get-pip.py. - get_pip = Chef::HTTP.new(new_resource.get_pip_url).get('') + get_pip = Chef::HTTP.new(get_pip_url).get('') # Write it to the temp file. temp.write(get_pip) # Close the file to flush it. @@ -165,6 +186,7 @@ def install_pip action :upgrade parent_python new_resource.parent version new_resource.version if new_resource.version + allow_downgrade true end end end diff --git a/lib/poise_python/resources/python_runtime_test.rb b/lib/poise_python/resources/python_runtime_test.rb index 01943be..c41d7d5 100644 --- a/lib/poise_python/resources/python_runtime_test.rb +++ b/lib/poise_python/resources/python_runtime_test.rb @@ -70,6 +70,10 @@ def action_run test_version # Test python_package. + python_package 'argparse' do + # Needed for sqlparse but not in the stdlib until 2.7. + python new_resource.name + end python_package 'sqlparse remove before' do action :remove package_name 'sqlparse' @@ -176,6 +180,7 @@ def action_run end test_import('docopt', python: nil, virtualenv: test_venv, user: test_user) end + end end diff --git a/lib/poise_python/version.rb b/lib/poise_python/version.rb index d0520c6..1d9f3d2 100644 --- a/lib/poise_python/version.rb +++ b/lib/poise_python/version.rb @@ -16,5 +16,5 @@ module PoisePython - VERSION = '1.6.1.pre' + VERSION = '1.7.1.pre' end diff --git a/poise-python.gemspec b/poise-python.gemspec index 0bbd12a..551dc68 100644 --- a/poise-python.gemspec +++ b/poise-python.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = %w{lib} - spec.add_dependency 'chef', '>= 12.1', '< 14' + spec.add_dependency 'chef', '>= 12.16', '< 15' spec.add_dependency 'halite', '~> 1.0' spec.add_dependency 'poise', '~> 2.7' spec.add_dependency 'poise-languages', '~> 2.0' diff --git a/test/cookbook/recipes/default.rb b/test/cookbook/recipes/default.rb index 93f5e7f..0a1c1ef 100644 --- a/test/cookbook/recipes/default.rb +++ b/test/cookbook/recipes/default.rb @@ -55,24 +55,47 @@ when 'pypy' python_runtime_test 'pypy' when 'pip' - # Specific test for pip reversion working correctly. + # Some pip-related tests that I don't need to run on every Python version. + # Pip does plenty of testing on different Python versions and I already touch + # the basics. pip_provider = value_for_platform_family(default: :portable_pypy, windows: :msi) + # Check the baseline state, should pull the latest pip. python_runtime 'pip1' do - pip_version '7.1.2' provider pip_provider options path: '/test_pip1' version '' end + # Check installing a requested version. python_runtime 'pip2' do + pip_version '8.1.2' provider pip_provider options path: '/test_pip2' version '' end - python_runtime 'pip2b' do + # Check installing the latest and reverting to an old version. + python_runtime 'pip3' do + provider pip_provider + options path: '/test_pip3' + version '' + end + python_runtime 'pip3b' do pip_version '7.1.2' provider pip_provider - options path: '/test_pip2' + options path: '/test_pip3' version '' end + # Test pip9 specifically just to be safe. + python_runtime 'pip4' do + pip_version '9.0.3' + provider pip_provider + options path: '/test_pip4' + version '' + end + # Run a simple package install on each just to test things. + (1..4).each do |n| + python_package 'structlog' do + python "pip#{n}" + end + end end end diff --git a/test/gemfiles/chef-12.1.gemfile b/test/gemfiles/chef-12.1.gemfile deleted file mode 100644 index 83ee246..0000000 --- a/test/gemfiles/chef-12.1.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.1.2' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.10.gemfile b/test/gemfiles/chef-12.10.gemfile deleted file mode 100644 index b3f1bce..0000000 --- a/test/gemfiles/chef-12.10.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.10.24' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.11.gemfile b/test/gemfiles/chef-12.11.gemfile deleted file mode 100644 index e1a1b77..0000000 --- a/test/gemfiles/chef-12.11.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.11.18' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.2.gemfile b/test/gemfiles/chef-12.2.gemfile deleted file mode 100644 index 1be9dc1..0000000 --- a/test/gemfiles/chef-12.2.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.2.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.15.gemfile b/test/gemfiles/chef-12.20.gemfile similarity index 90% rename from test/gemfiles/chef-12.15.gemfile rename to test/gemfiles/chef-12.20.gemfile index 1095dd8..24473c3 100644 --- a/test/gemfiles/chef-12.15.gemfile +++ b/test/gemfiles/chef-12.20.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.15.19' +gem 'chef', '~> 12.20.3' diff --git a/test/gemfiles/chef-12.14.gemfile b/test/gemfiles/chef-12.21.gemfile similarity index 90% rename from test/gemfiles/chef-12.14.gemfile rename to test/gemfiles/chef-12.21.gemfile index e0cb5c1..b15de0b 100644 --- a/test/gemfiles/chef-12.14.gemfile +++ b/test/gemfiles/chef-12.21.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.14.89' +gem 'chef', '~> 12.21.31' diff --git a/test/gemfiles/chef-12.3.gemfile b/test/gemfiles/chef-12.3.gemfile deleted file mode 100644 index f467b24..0000000 --- a/test/gemfiles/chef-12.3.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.3.0' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.4.gemfile b/test/gemfiles/chef-12.4.gemfile deleted file mode 100644 index 3982e37..0000000 --- a/test/gemfiles/chef-12.4.gemfile +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.4.3' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'gh', '0.14.0' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.5.gemfile b/test/gemfiles/chef-12.5.gemfile deleted file mode 100644 index cce7846..0000000 --- a/test/gemfiles/chef-12.5.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.5.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.6.gemfile b/test/gemfiles/chef-12.6.gemfile deleted file mode 100644 index 5f699c5..0000000 --- a/test/gemfiles/chef-12.6.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.6.0' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.7.gemfile b/test/gemfiles/chef-12.7.gemfile deleted file mode 100644 index a5930c6..0000000 --- a/test/gemfiles/chef-12.7.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.7.2' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.8.gemfile b/test/gemfiles/chef-12.8.gemfile deleted file mode 100644 index 49da969..0000000 --- a/test/gemfiles/chef-12.8.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.8.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.9.gemfile b/test/gemfiles/chef-12.9.gemfile deleted file mode 100644 index 4295ec5..0000000 --- a/test/gemfiles/chef-12.9.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.9.41' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.gemfile b/test/gemfiles/chef-12.gemfile index bd22a0f..1209719 100644 --- a/test/gemfiles/chef-12.gemfile +++ b/test/gemfiles/chef-12.gemfile @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.19' +gem 'chef', '~> 12.21' diff --git a/test/gemfiles/chef-12.13.gemfile b/test/gemfiles/chef-13.10.gemfile similarity index 78% rename from test/gemfiles/chef-12.13.gemfile rename to test/gemfiles/chef-13.10.gemfile index 76b2217..daf9679 100644 --- a/test/gemfiles/chef-12.13.gemfile +++ b/test/gemfiles/chef-13.10.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.13.37' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' +gem 'chef', '~> 13.10.4' diff --git a/test/gemfiles/chef-12.12.gemfile b/test/gemfiles/chef-13.3.gemfile similarity index 78% rename from test/gemfiles/chef-12.12.gemfile rename to test/gemfiles/chef-13.3.gemfile index cdbf048..cf2a9bc 100644 --- a/test/gemfiles/chef-12.12.gemfile +++ b/test/gemfiles/chef-13.3.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.12.15' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'ffi-yajl', '< 2.3.1' -gem 'foodcritic', '< 8' +gem 'chef', '~> 13.3.42' diff --git a/test/gemfiles/chef-13.4.gemfile b/test/gemfiles/chef-13.4.gemfile new file mode 100644 index 0000000..ea6fbee --- /dev/null +++ b/test/gemfiles/chef-13.4.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.4.24' diff --git a/test/gemfiles/chef-13.5.gemfile b/test/gemfiles/chef-13.5.gemfile new file mode 100644 index 0000000..ecffdfa --- /dev/null +++ b/test/gemfiles/chef-13.5.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.5.3' diff --git a/test/gemfiles/chef-13.6.gemfile b/test/gemfiles/chef-13.6.gemfile new file mode 100644 index 0000000..315d54e --- /dev/null +++ b/test/gemfiles/chef-13.6.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.6.4' diff --git a/test/gemfiles/chef-13.8.gemfile b/test/gemfiles/chef-13.8.gemfile new file mode 100644 index 0000000..60aa2c3 --- /dev/null +++ b/test/gemfiles/chef-13.8.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.8.0' diff --git a/test/gemfiles/chef-13.9.gemfile b/test/gemfiles/chef-13.9.gemfile new file mode 100644 index 0000000..c06de0f --- /dev/null +++ b/test/gemfiles/chef-13.9.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.9.4' diff --git a/test/gemfiles/chef-13.gemfile b/test/gemfiles/chef-13.gemfile index 3f49de1..039b51b 100644 --- a/test/gemfiles/chef-13.gemfile +++ b/test/gemfiles/chef-13.gemfile @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 13.2' +gem 'chef', '~> 13.10' diff --git a/test/gemfiles/chef-14.0.gemfile b/test/gemfiles/chef-14.0.gemfile new file mode 100644 index 0000000..31ec48c --- /dev/null +++ b/test/gemfiles/chef-14.0.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.0.202' diff --git a/test/gemfiles/chef-14.1.gemfile b/test/gemfiles/chef-14.1.gemfile new file mode 100644 index 0000000..a347dd6 --- /dev/null +++ b/test/gemfiles/chef-14.1.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.1.12' diff --git a/test/gemfiles/chef-14.2.gemfile b/test/gemfiles/chef-14.2.gemfile new file mode 100644 index 0000000..e0db219 --- /dev/null +++ b/test/gemfiles/chef-14.2.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.2.0' diff --git a/test/gemfiles/chef-14.3.gemfile b/test/gemfiles/chef-14.3.gemfile new file mode 100644 index 0000000..b80e938 --- /dev/null +++ b/test/gemfiles/chef-14.3.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.3.37' diff --git a/test/gemfiles/chef-14.4.gemfile b/test/gemfiles/chef-14.4.gemfile new file mode 100644 index 0000000..47651c8 --- /dev/null +++ b/test/gemfiles/chef-14.4.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.4.56' diff --git a/test/gemfiles/chef-14.gemfile b/test/gemfiles/chef-14.gemfile new file mode 100644 index 0000000..63ff708 --- /dev/null +++ b/test/gemfiles/chef-14.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.4' diff --git a/test/gemfiles/master.gemfile b/test/gemfiles/master.gemfile index 18d3604..15f3464 100644 --- a/test/gemfiles/master.gemfile +++ b/test/gemfiles/master.gemfile @@ -20,7 +20,7 @@ gem 'chef', git: 'https://github.com/chef/chef.git' gem 'chefspec', git: 'https://github.com/sethvargo/chefspec.git' gem 'fauxhai', git: 'https://github.com/customink/fauxhai.git' gem 'foodcritic', git: 'https://github.com/foodcritic/foodcritic.git' -gem 'halite', git: 'https://github.com/poise/halite.git' +# gem 'halite', git: 'https://github.com/poise/halite.git' gem 'ohai', git: 'https://github.com/chef/ohai.git' gem 'poise', git: 'https://github.com/poise/poise.git' gem 'poise-archive', git: 'https://github.com/poise/poise-archive.git' diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index 31f7612..6720d74 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -128,13 +128,41 @@ def self.assert_file(rel_path, should_exist=true, &block) '/bin/pypy' end + # Confirm pip verisons. describe command("/test_pip1#{path_suffix} -m pip --version") do its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { is_expected.to include '7.1.2' } + its(:stdout) { is_expected.to include ' 18.' } end describe command("/test_pip2#{path_suffix} -m pip --version") do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to include '8.1.2' } + end + + describe command("/test_pip3#{path_suffix} -m pip --version") do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to include '7.1.2' } end + + describe command("/test_pip4#{path_suffix} -m pip --version") do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to include '9.0.3' } + end + + # Check that structlog installed. + describe command("/test_pip1#{path_suffix} -c 'import structlog'") do + its(:exit_status) { is_expected.to eq 0 } + end + + describe command("/test_pip2#{path_suffix} -c 'import structlog'") do + its(:exit_status) { is_expected.to eq 0 } + end + + describe command("/test_pip3#{path_suffix} -c 'import structlog'") do + its(:exit_status) { is_expected.to eq 0 } + end + + describe command("/test_pip4#{path_suffix} -c 'import structlog'") do + its(:exit_status) { is_expected.to eq 0 } + end end diff --git a/test/spec/python_providers/scl_spec.rb b/test/spec/python_providers/scl_spec.rb index 05cbbc1..2edcec4 100644 --- a/test/spec/python_providers/scl_spec.rb +++ b/test/spec/python_providers/scl_spec.rb @@ -18,7 +18,7 @@ describe PoisePython::PythonProviders::Scl do let(:python_version) { '' } - let(:chefspec_options) { {platform: 'centos', version: '7.0'} } + let(:chefspec_options) { {platform: 'centos', version: '7.4.1708'} } let(:default_attributes) { {poise_python_version: python_version} } let(:python_runtime) { chef_run.python_runtime('test') } step_into(:python_runtime) @@ -41,7 +41,7 @@ context 'with version ""' do let(:python_version) { '' } - it_behaves_like 'scl provider', 'rh-python35' + it_behaves_like 'scl provider', 'rh-python36' end # /context with version "" context 'with version "2"' do @@ -51,7 +51,7 @@ context 'with version "3"' do let(:python_version) { '3' } - it_behaves_like 'scl provider', 'rh-python35' + it_behaves_like 'scl provider', 'rh-python36' end # /context with version "3" context 'with version "3.3"' do @@ -60,9 +60,9 @@ end # /context with version "3.3" context 'with version "" on CentOS 6' do - let(:chefspec_options) { {platform: 'centos', version: '6.0'} } + let(:chefspec_options) { {platform: 'centos', version: '6.9'} } let(:python_version) { '' } - it_behaves_like 'scl provider', 'rh-python34' + it_behaves_like 'scl provider', 'rh-python36' end # /context with version "" on CentOS 6 context 'action :uninstall' do diff --git a/test/spec/python_providers/system_spec.rb b/test/spec/python_providers/system_spec.rb index 1d2e565..055fcf9 100644 --- a/test/spec/python_providers/system_spec.rb +++ b/test/spec/python_providers/system_spec.rb @@ -43,7 +43,7 @@ context 'with version ""' do let(:python_version) { '' } - it_behaves_like 'system provider', %w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python3.4' + it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python3.4' end # /context with version "" context 'with version 2' do @@ -53,7 +53,7 @@ context 'with version 3' do let(:python_version) { '3' } - it_behaves_like 'system provider', %w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python}, 'python3.4' + it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python}, 'python3.4' end # /context with version 3 context 'with version 2.3' do @@ -65,13 +65,20 @@ it_behaves_like 'system provider', %w{python2.3 python23 python}, 'python2.3' end # /context with version 2.3 - context 'on Debian 8.1' do - before { chefspec_options.update(platform: 'debian', version: '8.1') } + context 'on Ubuntu 18.04' do + let(:chefspec_options) { {platform: 'ubuntu', version: '18.04'} } + let(:python_version) { '3.6' } + + it { is_expected.to install_package(%w{python3.6-venv python3.6-distutils}) } + end # /context on Ubuntu 18.04 + + context 'on Debian 8' do + before { chefspec_options.update(platform: 'debian', version: '8.9') } it_behaves_like 'system provider', 'python3.4' - end # /context on Debian 8.1 + end # /context on Debian 8 context 'on CentOS 7' do - before { chefspec_options.update(platform: 'centos', version: '7.0') } + before { chefspec_options.update(platform: 'centos', version: '7.4.1708') } recipe do python_runtime 'test' do provider :system @@ -80,7 +87,7 @@ end end it_behaves_like 'system provider', 'python' - end # /context on Debian 8.1 + end # /context on CentOS 7 context 'action :uninstall' do recipe do diff --git a/test/spec/resources/pip_requirements_spec.rb b/test/spec/resources/pip_requirements_spec.rb index 554a64d..e34e2d1 100644 --- a/test/spec/resources/pip_requirements_spec.rb +++ b/test/spec/resources/pip_requirements_spec.rb @@ -24,7 +24,7 @@ let(:pip_cwd) { '/test' } step_into(:pip_requirements) before do - allow(File).to receive(:directory?).and_return(false) + allow(File).to receive(:directory?).and_call_original allow(File).to receive(:directory?).with('/test').and_return(true) end before do diff --git a/test/spec/resources/python_package_spec.rb b/test/spec/resources/python_package_spec.rb index 9583d3d..6e608d8 100644 --- a/test/spec/resources/python_package_spec.rb +++ b/test/spec/resources/python_package_spec.rb @@ -50,7 +50,7 @@ end # /describe PoisePython::Resources::PythonPackage::Resource describe PoisePython::Resources::PythonPackage::Provider do - let(:test_resource) { nil } + let(:test_resource) { PoisePython::Resources::PythonPackage::Resource.new('package', chef_run.run_context) } let(:test_provider) { described_class.new(test_resource, chef_run.run_context) } def stub_cmd(cmd, **options) options = options.dup @@ -72,7 +72,7 @@ def stub_cmd(cmd, **options) context 'with package_name foo' do let(:package_name) { 'foo' } before do - stub_cmd(%w{-m pip.__main__ list}, stdout: '') + stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd(%w{- foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') end @@ -83,7 +83,7 @@ def stub_cmd(cmd, **options) context 'with package_name ["foo", "bar"]' do let(:package_name) { %w{foo bar} } before do - stub_cmd(%w{-m pip.__main__ list}, stdout: '') + stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd(%w{- foo bar}, input: kind_of(String), stdout: '{"foo":"1.0.0","bar":"2.0.0"}') end @@ -94,7 +94,7 @@ def stub_cmd(cmd, **options) context 'with a package with extras' do let(:package_name) { 'foo[bar]' } before do - stub_cmd(%w{-m pip.__main__ list}, stdout: '') + stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd(%w{- foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') end @@ -105,7 +105,7 @@ def stub_cmd(cmd, **options) context 'with a package with underscores' do let(:package_name) { 'cx_foo' } before do - stub_cmd(%w{-m pip.__main__ list}, stdout: '') + stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd(%w{- cx-foo}, input: kind_of(String), stdout: '{"cx-foo":"1.0.0"}') end @@ -117,7 +117,7 @@ def stub_cmd(cmd, **options) let(:package_name) { 'foo' } before do test_resource.options('--index-url=http://example') - stub_cmd("-m pip.__main__ list --index-url=http://example ", stdout: '', array_13: true) + stub_cmd("-m pip.__main__ list --index-url=http://example ", environment: {'PIP_FORMAT' => 'json'}, stdout: '', array_13: true) stub_cmd("- --index-url=http://example foo", input: kind_of(String), stdout: '{"foo":"1.0.0"}', array_13: true) end @@ -129,7 +129,7 @@ def stub_cmd(cmd, **options) let(:package_name) { 'foo' } before do test_resource.list_options('--index-url=http://example') - stub_cmd("-m pip.__main__ list --index-url=http://example ", stdout: '') + stub_cmd("-m pip.__main__ list --index-url=http://example ", environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd("- --index-url=http://example foo", input: kind_of(String), stdout: '{"foo":"1.0.0"}') end @@ -141,7 +141,7 @@ def stub_cmd(cmd, **options) let(:package_name) { 'foo' } before do test_resource.list_options(%w{--index-url=http://example}) - stub_cmd(%w{-m pip.__main__ list --index-url=http://example}, stdout: '') + stub_cmd(%w{-m pip.__main__ list --index-url=http://example}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') stub_cmd(%w{- --index-url=http://example foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') end @@ -302,6 +302,13 @@ def stub_cmd(cmd, **options) it { is_expected.to eq({'eventlet' => '0.12.1', 'fabric' => '1.9.1', 'fabric-rundeck' => '1.2', 'flake8' => '2.1.0.dev0', 'cx-freeze' => '4.3.4'}) } end # /context with standard content + context 'with JSON content' do + let(:text) { <<-EOH.strip } +[{"name":"eventlet","version":"0.12.1"}, {"name":"Fabric","version":"1.9.1"}, {"name":"fabric-rundeck","version":"1.2"}, {"name":"flake8","version":"2.1.0.dev0"}, {"name":"cx-Freeze","version":"4.3.4"}] +EOH + it { is_expected.to eq({'eventlet' => '0.12.1', 'fabric' => '1.9.1', 'fabric-rundeck' => '1.2', 'flake8' => '2.1.0.dev0', 'cx-freeze' => '4.3.4'}) } + end # /context with JSON content + context 'with malformed content' do let(:text) { <<-EOH } eventlet (0.12.1)