diff options
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | Gemfile | 4 | ||||
-rw-r--r-- | Rakefile | 4 | ||||
-rw-r--r-- | gemfiles/oc-chef-pedant.gemfile | 1 | ||||
-rw-r--r-- | spec/run_oc_pedant.rb | 5 | ||||
-rw-r--r-- | spec/run_pedant.rb | 103 | ||||
-rw-r--r-- | spec/support/oc_pedant.rb | 1 | ||||
-rw-r--r-- | spec/support/pedant.rb | 129 |
8 files changed, 14 insertions, 239 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cf9890..743232b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Chef Zero CHANGELOG =================== +$ 5.0 (pending) + +* updates to be compatible with current Chef Server 12 behaviors +* update oc-chef-pedant to 2.0 +* remove chef-pedant support + # 4.2.3 * [PR#143](https://github.com/chef/chef-zero/pull/143): Fix server_scope: :context @@ -3,7 +3,9 @@ gemspec gem 'rest-client', :github => 'chef/rest-client' -gem 'chef-pedant', :github => 'chef/chef-pedant', :tag => '1.0.46' +#WIP +#gem 'oc-chef-pedant', :github => 'chef/oc-chef-pedant', :tag => '2.0.0' +gem 'oc-chef-pedant', :github => 'chef/oc-chef-pedant', :branch => 'mp/merge-pedants' gem 'chef', :github => 'opscode/chef', :tag => '12.2.1' @@ -10,9 +10,9 @@ task :spec do system('rspec spec/*_spec.rb') end -desc "run pedant" +desc "run oc pedant" task :pedant do - require File.expand_path('spec/run_pedant') + require File.expand_path('spec/run_oc_pedant') end desc "run oc pedant" diff --git a/gemfiles/oc-chef-pedant.gemfile b/gemfiles/oc-chef-pedant.gemfile index 26324c3..27c87bd 100644 --- a/gemfiles/oc-chef-pedant.gemfile +++ b/gemfiles/oc-chef-pedant.gemfile @@ -2,6 +2,5 @@ source 'https://rubygems.org' gemspec :path => '../' gem 'rest-client', :github => 'opscode/rest-client', :branch => 'lcg/1.6.7-version-lying' -gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => '81f3b4ecbc09d04950f2819b38a6a8f906ada2a7' gem 'oc-chef-pedant', :git => 'git@github.com:opscode/oc-chef-pedant', :ref => '3c0eb31f1e49aa947b81ad51387b7a68adbc5f91' gem 'chef', :github => 'opscode/chef' diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 79d92e7..053062a 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -24,8 +24,6 @@ begin require 'rspec/core' require 'pedant' - require 'pedant/opensource/platform' - require 'pedant/multitenant' require 'pedant/organization' #Pedant::Config.rerun = true @@ -43,7 +41,8 @@ begin '--skip-omnibus', '--skip-usags', '--skip-internal_orgs', - '--skip-rename_org' + '--skip-rename_org', + '--skip-headers' ]) result = RSpec::Core::Runner.run(Pedant.config.rspec_args) diff --git a/spec/run_pedant.rb b/spec/run_pedant.rb deleted file mode 100644 index 30ffa2d..0000000 --- a/spec/run_pedant.rb +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env ruby -require 'bundler' -require 'bundler/setup' - -require 'chef_zero/server' -require 'rspec/core' - -tmpdir = nil - -def start_local_server(chef_repo_path) - Dir.mkdir(chef_repo_path) if !File.exists?(chef_repo_path) - - # 11.6 and below had a bug where it couldn't create the repo children automatically - if Chef::VERSION.to_f < 11.8 - %w(clients cookbooks data_bags environments nodes roles users).each do |child| - Dir.mkdir("#{chef_repo_path}/#{child}") if !File.exists?("#{chef_repo_path}/#{child}") - end - end - - # Start the new server - Chef::Config.repo_mode = 'everything' - Chef::Config.chef_repo_path = chef_repo_path - Chef::Config.versioned_cookbooks = true - chef_fs = Chef::ChefFS::Config.new.local_fs - data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs) - server = ChefZero::Server.new(:port => 8889, :data_store => data_store) - ENV['SINGLE_ORG'] = 'true' - server.start_background - server -end - -begin - if ENV['CHEF_FS'] - require 'chef/chef_fs/chef_fs_data_store' - require 'chef/chef_fs/config' - require 'tmpdir' - require 'fileutils' - require 'chef/version' - require 'chef_zero/data_store/v1_to_v2_adapter' - - # Create chef repository - tmpdir = Dir.mktmpdir - chef_repo_path = "#{tmpdir}/repo" - - # Capture setup data into master_chef_repo_path - server = start_local_server(chef_repo_path) - - elsif ENV['SINGLE_ORG'] - server = ChefZero::Server.new(:port => 8889, :single_org => 'chef') - server.start_background - - elsif ENV['FILE_STORE'] - require 'tmpdir' - require 'chef_zero/data_store/raw_file_store' - tmpdir = Dir.mktmpdir - data_store = ChefZero::DataStore::RawFileStore.new(tmpdir, true) - data_store = ChefZero::DataStore::DefaultFacade.new(data_store, true, false) - server = ChefZero::Server.new(:port => 8889, :single_org => 'chef', :data_store => data_store) - server.start_background - - else - server = ChefZero::Server.new(:port => 8889, :single_org => false, :osc_compat => true) - server.data_store.create_dir([ 'organizations' ], 'pedant') - server.start_background - end - - unless ENV['SKIP_PEDANT'] - require 'pedant' - require 'pedant/opensource' - - #Pedant::Config.rerun = true - - Pedant.config.suite = 'api' - Pedant.config[:config_file] = 'spec/support/pedant.rb' - - Pedant.setup([ - '--skip-knife', - '--skip-validation', - '--skip-authentication', - '--skip-authorization', - '--skip-keys', - '--skip-omnibus', - '--skip-cookbook_artifacts' - ]) - - result = RSpec::Core::Runner.run(Pedant.config.rspec_args) - else - require 'net/http' - response = Net::HTTP.new('127.0.0.1', 8889).get("/environments", { 'Accept' => 'application/json'}).body - if response =~ /_default/ - result = 0 - else - puts "GET /environments returned #{response}. Expected _default!" - result = 1 - end - end - - server.stop if server.running? -ensure - FileUtils.remove_entry_secure(tmpdir) if tmpdir -end - -exit(result) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 60e3629..1db663e 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -132,3 +132,4 @@ verify_error_messages false ruby_users_endpoint? false ruby_acls_endpoint? false ruby_org_assoc? false +chef_12? true diff --git a/spec/support/pedant.rb b/spec/support/pedant.rb deleted file mode 100644 index 29a0ec1..0000000 --- a/spec/support/pedant.rb +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright: Copyright (c) 2012 Opscode, Inc. -# License: Apache License, Version 2.0 -# -# 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. - -# This annotated Pedant configuration file details the various -# configuration settings available to you. It is separate from the -# actual Pedant::Config class because not all settings have sane -# defaults, and not all settings are appropriate in all settings. - -################################################################################ -# You MUST specify the address of the server the API requests will be -# sent to. Only specify protocol, hostname, and port. -if ENV['SINGLE_ORG'] || ENV['FILE_STORE'] - chef_server 'http://127.0.0.1:8889' -else - chef_server 'http://127.0.0.1:8889/organizations/pedant' -end - -# If you are doing development testing, you can specify the address of -# the Solr server. The presence of this parameter will enable tests -# to force commits to Solr, greatly decreasing the amout of time -# needed for testing the search endpoint. This is only an -# optimization for development! If you are testing a "live" Chef -# Server, or otherwise do not have access to the Solr server from your -# testing location, you should not specify a value for this parameter. -# The tests will still run, albeit slower, as they will now need to -# poll for a period to ensure they are querying committed results. -#search_server "http://localhost:8983" - -# Related to the 'search_server' parameter, this specifies the maximum -# amout of time (in seconds) that search endpoint requests should be -# retried before giving up. If not explicitly set, it will default to -# 65 seconds; only set it if you know that your Solr commit interval -# differs significantly from this. -maximum_search_time 0 - -# OSC sends erchef a host header with a port, so this option needs -# # to be enabled for Pedant tests to work correctly -explicit_port_url true - -# We're starting to break tests up into groups based on different -# criteria. The proper API tests (the results of which are viewable -# to OPC customers) should be the only ones run by Pedant embedded in -# OPC installs. There are other specs that help us keep track of API -# cruft that we want to come back and fix later; these shouldn't be -# viewable to customers, but we should be able to run them in -# development and CI environments. If this parameter is missing or -# explicitly `false` only the customer-friendly tests will be run. -# -# This is mainly here for documentation purposes, since the -# command-line `opscode-pedant` utility ultimately determines this -# value. -include_internal false - -# Test users. The five users specified below are required; their -# names (:user, :non_org_user, etc.) are indicative of their role -# within the tests. All users must have a ':name' key. If they have -# a ':create_me' key, Pedant will create these users for you. If you -# are using pre-existing users, you must supply a ':key_file' key, -# which should be the fully-qualified path /on the machine Pedant is -# running on/ to a private key for that user. -key = 'spec/support/stickywicket.pem' -superuser_name 'admin' -superuser_key key -webui_key key - -# The Policies endpoint is feature-flagged during development. Zero supports -# the policies endpoint, so turn it on: -policies? true - -# Set the platform_class -platform_class Pedant::OpenSourcePlatform - -requestors({ - :clients => { - # The the admin user, for the purposes of getting things rolling - :admin => { - :name => "pedant_admin_client", - :create_me => true, - :create_knife => true, - :admin => true - }, - :non_admin => { - :name => 'pedant_client', - :create_me => true, - :create_knife => true - }, - :bad => { - :name => 'bad_client', - :bogus => true - } - }, - :users => { - :admin => { - :name => "admin", - :key_file => key, - :create_me => false, - :create_knife => false, - :admin => true - }, - :non_admin => { - :name => "pedant_non_admin_user", - :create_me => true, - :create_knife => true, - :admin => false - }, - # A user for Knife tests. A knife.rb and key files will be set up - # for this user - :knife_user => { - :name => "knifey", - :create_me => true, - :create_knife => true - } - } -}) - -self[:tags] = [:validation, :authentication, :authorization] -verify_error_messages false |