From 0ff36efafb6c4fa9d5cd7d3e81b7bbcae5d34144 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 11:22:25 -0800 Subject: Add :cheffs and :filestore targets to Rakefile. --- Rakefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Rakefile b/Rakefile index f89acbb..e786f4d 100644 --- a/Rakefile +++ b/Rakefile @@ -15,6 +15,16 @@ task :pedant do require File.expand_path('spec/run_oc_pedant') end +task :cheffs do + ENV['CHEF_FS'] = "yes" + require File.expand_path('spec/run_oc_pedant') +end + +task :filestore do + ENV['FILE_STORE'] = "yes" + require File.expand_path('spec/run_oc_pedant') +end + desc "run oc pedant" task :oc_pedant do require File.expand_path('spec/run_oc_pedant') -- cgit v1.2.1 From 274a4dd9bfb5d65ac2e23f98c66756c40ae0621a Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 11:40:53 -0800 Subject: use local oc-chef-pedant. --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 58df349..7540d97 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ gemspec gem 'rest-client', :github => 'chef/rest-client' # we were using e9bf7fe4440afd34856401831b30636100be958b, but now float on latest release. -gem 'oc-chef-pedant', :github => 'chef/chef-server' +# gem 'oc-chef-pedant', :github => 'chef/chef-server' +gem 'oc-chef-pedant', :path => "#{ENV['HOME']}/repos/chef-server" gem 'chef', :github => 'chef/chef' -- cgit v1.2.1 From e1981f2a49f7902da96e43e732f9593570c23dcd Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:33:27 -0800 Subject: open_source_endpoints() -> endpoints() --- lib/chef_zero/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb index d9e3931..1686301 100644 --- a/lib/chef_zero/server.rb +++ b/lib/chef_zero/server.rb @@ -485,7 +485,7 @@ module ChefZero private - def open_source_endpoints + def endpoints result = if options[:osc_compat] # OSC-only [ @@ -581,7 +581,7 @@ module ChefZero def app return @app if @app - router = RestRouter.new(open_source_endpoints) + router = RestRouter.new(endpoints) router.not_found = NotFoundEndpoint.new if options[:single_org] -- cgit v1.2.1 From 10d474450b4fc768c640edb139c9a11e043aea7d Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:37:18 -0800 Subject: Convert ChefFS data to use DefaultFacade. --- spec/run_oc_pedant.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index b5cecec..55f6ec9 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -26,8 +26,17 @@ def start_server(chef_repo_path) 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, :single_org => false, :data_store => data_store)#, :log_level => :debug) + data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'pedant-testorg') + data_store = ChefZero::DataStore::DefaultFacade.new(data_store, 'pedant-testorg', false) + + server = ChefZero::Server.new( + port: 8889, + data_store: data_store, + single_org: false, + #log_level: :debug + ) server.start_background server end -- cgit v1.2.1 From 409371275f66ac8a4a0de86cd8041f901351345d Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:39:23 -0800 Subject: Move the 'server_api_version 0' thing into oc_pedant.rb. --- spec/run_oc_pedant.rb | 1 - spec/support/oc_pedant.rb | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 55f6ec9..d084ea2 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -77,7 +77,6 @@ begin Pedant::Config.search_url_fmt = "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json" Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' - Pedant.config[:server_api_version] = 0 # "the goal is that only authorization, authentication and validation tests are turned off" - @jkeiser Pedant.setup([ diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index e3bcf27..91ad533 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -45,6 +45,8 @@ maximum_search_time 0 # # to be enabled for Pedant tests to work correctly explicit_port_url true +server_api_version 0 + # 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 -- cgit v1.2.1 From 61322db2fcbf1c5fa56bb7a52a35070e0a9fe12c Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:43:13 -0800 Subject: oc_pedant.rb: add validator_key to org(). --- spec/support/oc_pedant.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 91ad533..c16ac60 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -61,9 +61,12 @@ server_api_version 0 # value. include_internal false -# This is the bit that is different from pedant.rb -org({:name => "pedant-testorg", - :create_me => true}) +key = 'spec/support/stickywicket.pem' + +org(name: "pedant-testorg", + create_me: true, + validator_key: key) + internal_account_url chef_server delete_org true -- cgit v1.2.1 From adc16239316d4e67929db12211700c7cd96b1c67 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:48:24 -0800 Subject: Use 'pivotal' for requestor admin user under CHEF_FS. --- spec/support/oc_pedant.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index c16ac60..1be7ddf 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -82,6 +82,10 @@ superuser_name 'pivotal' superuser_key key webui_key key +def cheffs_or_else_user(value) + ENV['CHEF_FS'] ? "pivotal" : value +end + requestors({ :clients => { # The the admin user, for the purposes of getting things rolling @@ -107,20 +111,20 @@ requestors({ :users => { # An administrator in the testing organization :admin => { - :name => "pedant_admin_user", + :name => cheffs_or_else_user("pedant_admin_user"), :create_me => true, :create_knife => true }, :non_admin => { - :name => "pedant_user", + :name => cheffs_or_else_user("pedant_user"), :create_me => true, :create_knife => true }, # A user that is not a member of the testing organization :bad => { - :name => "pedant-nobody", + :name => cheffs_or_else_user("pedant-nobody"), :create_me => true, :create_knife => true, :associate => false -- cgit v1.2.1 From 2434845d9c6adea0bfb834f9ba9a0db4a17f43ad Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:50:24 -0800 Subject: Set admin requestor users' :create_me to !ENV['CHEF_FS']. --- spec/support/oc_pedant.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 1be7ddf..1359321 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -112,20 +112,20 @@ requestors({ # An administrator in the testing organization :admin => { :name => cheffs_or_else_user("pedant_admin_user"), - :create_me => true, + :create_me => !ENV['CHEF_FS'], :create_knife => true }, :non_admin => { :name => cheffs_or_else_user("pedant_user"), - :create_me => true, + :create_me => !ENV['CHEF_FS'], :create_knife => true }, # A user that is not a member of the testing organization :bad => { :name => cheffs_or_else_user("pedant-nobody"), - :create_me => true, + :create_me => !ENV['CHEF_FS'], :create_knife => true, :associate => false }, -- cgit v1.2.1 From 1f842beed8941a4cc6500786703c51445d30dba1 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:54:38 -0800 Subject: Set :associate to !ENV['CHEF_FS']. --- spec/support/oc_pedant.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 1359321..645b27c 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -113,12 +113,14 @@ requestors({ :admin => { :name => cheffs_or_else_user("pedant_admin_user"), :create_me => !ENV['CHEF_FS'], + :associate => !ENV['CHEF_FS'], :create_knife => true }, :non_admin => { :name => cheffs_or_else_user("pedant_user"), :create_me => !ENV['CHEF_FS'], + :associate => !ENV['CHEF_FS'], :create_knife => true }, -- cgit v1.2.1 From a7668328c1133c80f103954ddeb82e35d65c1694 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:57:45 -0800 Subject: oc_pedant.rb: Add :key_file. --- spec/support/oc_pedant.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index 645b27c..c0d7648 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -86,6 +86,8 @@ def cheffs_or_else_user(value) ENV['CHEF_FS'] ? "pivotal" : value end +keyfile_maybe = ENV['CHEF_FS'] ? { key_file: key } : { key_file: nil } + requestors({ :clients => { # The the admin user, for the purposes of getting things rolling @@ -115,14 +117,14 @@ requestors({ :create_me => !ENV['CHEF_FS'], :associate => !ENV['CHEF_FS'], :create_knife => true - }, + }.merge(keyfile_maybe), :non_admin => { :name => cheffs_or_else_user("pedant_user"), :create_me => !ENV['CHEF_FS'], :associate => !ENV['CHEF_FS'], :create_knife => true - }, + }.merge(keyfile_maybe), # A user that is not a member of the testing organization :bad => { @@ -130,7 +132,7 @@ requestors({ :create_me => !ENV['CHEF_FS'], :create_knife => true, :associate => false - }, + }.merge(keyfile_maybe), } }) -- cgit v1.2.1 From 5ae58d225ffc0e3a83da3b627d135937dbb2dcc3 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 13:59:35 -0800 Subject: oc_pedant.rb: Set org[:create_me] to !ENV['CHEF_FS']. --- spec/support/oc_pedant.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index c0d7648..bc78408 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -64,7 +64,7 @@ include_internal false key = 'spec/support/stickywicket.pem' org(name: "pedant-testorg", - create_me: true, + create_me: !ENV['CHEF_FS'], validator_key: key) internal_account_url chef_server -- cgit v1.2.1 From 0c475039992d4c0f46e5ae25e9769d344a11d335 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 14:33:28 -0800 Subject: add 'server = start_server'. --- spec/run_oc_pedant.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index d084ea2..01ec4d8 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -56,7 +56,7 @@ begin elsif ENV['CHEF_FS'] require 'tmpdir' tmpdir = Dir.mktmpdir - start_server(tmpdir) + server = start_server(tmpdir) else server = ChefZero::Server.new(:port => 8889, :single_org => false)#, :log_level => :debug) -- cgit v1.2.1 From bf7ecbc1845133d07ca53098f86d2bcb5a97e834 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Tue, 10 Nov 2015 16:24:11 -0800 Subject: Move search-related config to oc_pedant.rb. --- Gemfile | 1 + spec/run_oc_pedant.rb | 6 ------ spec/support/oc_pedant.rb | 8 ++++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 7540d97..3604608 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,4 @@ gem 'rest-client', :github => 'chef/rest-client' gem 'oc-chef-pedant', :path => "#{ENV['HOME']}/repos/chef-server" gem 'chef', :github => 'chef/chef' +# gem 'chef', :path => "#{ENV['HOME']}/repos/chef" diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 01ec4d8..a522998 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -70,11 +70,6 @@ begin # Pedant::Config.rerun = true Pedant.config.suite = 'api' - Pedant.config.internal_server = Pedant::Config.search_server = 'http://localhost:8889' - - # see dummy_endpoint.rb. - Pedant.config.search_commit_url = "/dummy" - Pedant::Config.search_url_fmt = "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json" Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' @@ -96,7 +91,6 @@ begin '--skip-cookbook-artifacts', '--skip-containers', '--skip-api-v1' - ]) result = RSpec::Core::Runner.run(Pedant.config.rspec_args) diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb index bc78408..cc62dd4 100644 --- a/spec/support/oc_pedant.rb +++ b/spec/support/oc_pedant.rb @@ -47,6 +47,14 @@ explicit_port_url true server_api_version 0 +internal_server chef_server + +# see dummy_endpoint.rb for details. +search_server chef_server +search_commit_url "/dummy" +search_url_fmt "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json" + + # 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 -- cgit v1.2.1 From 08c7c217c5dc02d68b611c0eb6c50990c45a6f79 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 09:31:35 -0800 Subject: start_server -> start_cheffs_server --- spec/run_oc_pedant.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index a522998..8aa4821 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -5,7 +5,7 @@ require 'bundler/setup' require 'chef_zero/server' require 'rspec/core' -def start_server(chef_repo_path) +def start_cheffs_server(chef_repo_path) require 'chef/version' require 'chef/config' require 'chef/chef_fs/config' @@ -56,7 +56,7 @@ begin elsif ENV['CHEF_FS'] require 'tmpdir' tmpdir = Dir.mktmpdir - server = start_server(tmpdir) + server = start_cheffs_server(tmpdir) else server = ChefZero::Server.new(:port => 8889, :single_org => false)#, :log_level => :debug) -- cgit v1.2.1 From 0207a056c562ad3bd5ec17f020727df7bc57d6e9 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 09:58:40 -0800 Subject: debugging stuff in Gemfile. --- Gemfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 3604608..2c7bde9 100644 --- a/Gemfile +++ b/Gemfile @@ -7,5 +7,8 @@ gem 'rest-client', :github => 'chef/rest-client' # gem 'oc-chef-pedant', :github => 'chef/chef-server' gem 'oc-chef-pedant', :path => "#{ENV['HOME']}/repos/chef-server" -gem 'chef', :github => 'chef/chef' -# gem 'chef', :path => "#{ENV['HOME']}/repos/chef" +# bundler resolve failure on "rspec_junit_formatter" +# gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => "server-cli-option" + +# gem 'chef', :github => 'chef/chef' +gem 'chef', :path => "#{ENV['HOME']}/repos/chef" -- cgit v1.2.1 From e01280b38e5f048f89e692f69399b982317cc6ce Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 09:59:04 -0800 Subject: set Pedant::Config.rerun = true for now. --- spec/run_oc_pedant.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 8aa4821..405fe0e 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -67,7 +67,7 @@ begin require 'pedant' require 'pedant/organization' - # Pedant::Config.rerun = true + Pedant::Config.rerun = true Pedant.config.suite = 'api' -- cgit v1.2.1 From ef3afcde61932545ec7e8de5454345bd6f81f755 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 12:16:40 -0800 Subject: Include additional tags to skip under CHEF_FS. --- spec/run_oc_pedant.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 405fe0e..6dd503d 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -67,12 +67,18 @@ begin require 'pedant' require 'pedant/organization' - Pedant::Config.rerun = true + # Pedant::Config.rerun = true Pedant.config.suite = 'api' Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' + chef_fs_skips = if ENV['CHEF_FS'] + [ '--skip-association' ] + else + [] + end + # "the goal is that only authorization, authentication and validation tests are turned off" - @jkeiser Pedant.setup([ '--skip-knife', @@ -91,9 +97,12 @@ begin '--skip-cookbook-artifacts', '--skip-containers', '--skip-api-v1' - ]) + ] + chef_fs_skips) + + # fail_fast = ["--fail-fast"] + fail_fast = [] - result = RSpec::Core::Runner.run(Pedant.config.rspec_args) + result = RSpec::Core::Runner.run(Pedant.config.rspec_args + fail_fast) server.stop if server.running? ensure -- cgit v1.2.1 From ad52b81b69390eb6569962112c42a00da4a80d7e Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 13:36:50 -0800 Subject: 'everything' -> 'hosted_everything'; add tag exclusions for stuff chef-zero doesn't do. --- spec/run_oc_pedant.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 6dd503d..0ce9f7a 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -22,7 +22,7 @@ def start_cheffs_server(chef_repo_path) end # Start the new server - Chef::Config.repo_mode = 'everything' + Chef::Config.repo_mode = 'hosted_everything' Chef::Config.chef_repo_path = chef_repo_path Chef::Config.versioned_cookbooks = true chef_fs = Chef::ChefFS::Config.new.local_fs @@ -74,7 +74,11 @@ begin Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' chef_fs_skips = if ENV['CHEF_FS'] - [ '--skip-association' ] + [ '--skip-association', + '--skip-users', + '--skip-organizations', + '--skip-policies' # these are expected to be broken. + ] else [] end @@ -99,8 +103,8 @@ begin '--skip-api-v1' ] + chef_fs_skips) - # fail_fast = ["--fail-fast"] fail_fast = [] + # fail_fast = ["--fail-fast"] result = RSpec::Core::Runner.run(Pedant.config.rspec_args + fail_fast) -- cgit v1.2.1 From 5defb1acbea9e501a489f22bdd20d35cea5b43c7 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 12 Nov 2015 14:49:37 -0800 Subject: Add descriptions to filestore/cheffs Rakefile tasks. --- Rakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Rakefile b/Rakefile index e786f4d..209d056 100644 --- a/Rakefile +++ b/Rakefile @@ -15,11 +15,13 @@ task :pedant do require File.expand_path('spec/run_oc_pedant') end +desc "run pedant with CHEF_FS set" task :cheffs do ENV['CHEF_FS'] = "yes" require File.expand_path('spec/run_oc_pedant') end +desc "run pedant with FILE_STORE set" task :filestore do ENV['FILE_STORE'] = "yes" require File.expand_path('spec/run_oc_pedant') -- cgit v1.2.1 From 2e8d5e7ac657faa49e439931db8436a69b7e88ab Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Fri, 13 Nov 2015 10:22:29 -0800 Subject: run_oc_pedant.rb: Extend a comment. --- spec/run_oc_pedant.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 0ce9f7a..7960894 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -77,7 +77,7 @@ begin [ '--skip-association', '--skip-users', '--skip-organizations', - '--skip-policies' # these are expected to be broken. + '--skip-policies' # these are expected to be broken, they're what we're trying to fix. ] else [] -- cgit v1.2.1 From bc1921cb2ba1d68456e410f8838609b14c05973d Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Fri, 13 Nov 2015 10:38:29 -0800 Subject: Bug-for-bug compatibility with Server, where pedant expects an "actors" list of ["pivotal", "pivotal"], but chef-zero has been returning ["pivotal"]. --- lib/chef_zero/chef_data/default_creator.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/chef_zero/chef_data/default_creator.rb b/lib/chef_zero/chef_data/default_creator.rb index d1a0118..8a5b7fb 100644 --- a/lib/chef_zero/chef_data/default_creator.rb +++ b/lib/chef_zero/chef_data/default_creator.rb @@ -378,11 +378,12 @@ module ChefZero # Non-default containers do not get superusers added to them, # because reasons. unless path.size == 4 && path[0] == 'organizations' && path[2] == 'containers' && !exists?(path) - owners |= superusers + owners += superusers end end - owners.uniq + # we don't de-dup this list, because pedant expects to see ["pivotal", "pivotal"] in some cases. + owners end def default_acl(acl_path, acl={}) -- cgit v1.2.1 From 0638635dcd860b76169de2a4b333511ed4ef200c Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Fri, 13 Nov 2015 14:24:35 -0800 Subject: principal_endpoint.rb: comments. --- lib/chef_zero/endpoints/principal_endpoint.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/chef_zero/endpoints/principal_endpoint.rb b/lib/chef_zero/endpoints/principal_endpoint.rb index 8cad07c..b1f4efb 100644 --- a/lib/chef_zero/endpoints/principal_endpoint.rb +++ b/lib/chef_zero/endpoints/principal_endpoint.rb @@ -8,16 +8,20 @@ module ChefZero class PrincipalEndpoint < RestBase def get(request) name = request.rest_path[-1] + # If /organizations/ORG/users/NAME exists, use this user (only org members have precedence over clients). hey are an org member. json = get_data(request, request.rest_path[0..1] + [ 'users', name ], :nil) if json type = 'user' org_member = true else + # If /organizations/ORG/clients/NAME exists, use the client. json = get_data(request, request.rest_path[0..1] + [ 'clients', name ], :nil) if json type = 'client' org_member = true else + # If there is no client with that name, check for a user (/users/NAME) and return that with + # org_member = false. json = get_data(request, [ 'users', name ], :nil) if json type = 'user' -- cgit v1.2.1 From 2d71904941dc80097f8d3ef59e6662a3edebcd93 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Fri, 13 Nov 2015 16:05:50 -0800 Subject: Associate pivotal with the org before going in --- Gemfile | 4 ++-- spec/run_oc_pedant.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 2c7bde9..46d8928 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,10 @@ gem 'rest-client', :github => 'chef/rest-client' # we were using e9bf7fe4440afd34856401831b30636100be958b, but now float on latest release. # gem 'oc-chef-pedant', :github => 'chef/chef-server' -gem 'oc-chef-pedant', :path => "#{ENV['HOME']}/repos/chef-server" +gem 'oc-chef-pedant', :path => "../chef-server" # bundler resolve failure on "rspec_junit_formatter" # gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => "server-cli-option" # gem 'chef', :github => 'chef/chef' -gem 'chef', :path => "#{ENV['HOME']}/repos/chef" +gem 'chef', :path => "../chef" diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 7960894..45a4499 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -30,6 +30,7 @@ def start_cheffs_server(chef_repo_path) data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs) data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'pedant-testorg') data_store = ChefZero::DataStore::DefaultFacade.new(data_store, 'pedant-testorg', false) + data_store.create(%w(organizations pedant-testorg users), 'pivotal', '{}') server = ChefZero::Server.new( port: 8889, -- cgit v1.2.1 From cd08fa83083f132dd36b5d8c51ae8c8670de3319 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Fri, 13 Nov 2015 16:11:24 -0800 Subject: Skip multiuser tests --- spec/run_oc_pedant.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 45a4499..55a1f39 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -74,10 +74,13 @@ begin Pedant.config[:config_file] = 'spec/support/oc_pedant.rb' + # Because ChefFS can only ever have one user (pivotal), we can't do most of the + # tests that involve multiple chef_fs_skips = if ENV['CHEF_FS'] [ '--skip-association', '--skip-users', '--skip-organizations', + '--skip-multiuser', '--skip-policies' # these are expected to be broken, they're what we're trying to fix. ] else -- cgit v1.2.1 From eac29ed6cc33acbec509a147a240a9ca1a078cc3 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Mon, 16 Nov 2015 11:09:22 -0800 Subject: Add pivotal to admins and users group of new org --- spec/run_oc_pedant.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 55a1f39..254b7be 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -31,6 +31,8 @@ def start_cheffs_server(chef_repo_path) data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'pedant-testorg') data_store = ChefZero::DataStore::DefaultFacade.new(data_store, 'pedant-testorg', false) data_store.create(%w(organizations pedant-testorg users), 'pivotal', '{}') + data_store.set(%w(organizations pedant-testorg groups admins), '{ "users": [ "pivotal" ] }') + data_store.set(%w(organizations pedant-testorg groups users), '{ "users": [ "pivotal" ] }') server = ChefZero::Server.new( port: 8889, -- cgit v1.2.1 From 85351c925cc550c209abfa2d590ff3a5f9892db5 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Mon, 16 Nov 2015 11:28:30 -0800 Subject: Point to the relevant oc-chef-pedant and chef/chef branches. --- Gemfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 46d8928..10835bd 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,12 @@ gemspec gem 'rest-client', :github => 'chef/rest-client' # we were using e9bf7fe4440afd34856401831b30636100be958b, but now float on latest release. -# gem 'oc-chef-pedant', :github => 'chef/chef-server' -gem 'oc-chef-pedant', :path => "../chef-server" +gem 'oc-chef-pedant', :github => 'chef/chef-server', :branch => 'jk/multiuser_tag' + +# gem 'oc-chef-pedant', :path => "../chef-server" # bundler resolve failure on "rspec_junit_formatter" # gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => "server-cli-option" -# gem 'chef', :github => 'chef/chef' -gem 'chef', :path => "../chef" +gem 'chef', :github => 'chef/chef', :branch => 'invitations-and-members' +# gem 'chef', :path => "../chef" -- cgit v1.2.1 From 0344829524c43f2872fe54f8b89198d04441b44e Mon Sep 17 00:00:00 2001 From: John Keiser Date: Mon, 16 Nov 2015 11:28:24 -0800 Subject: Pass chef_config to ChefFS so that it knows we are a multi-org server --- spec/run_oc_pedant.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb index 254b7be..726279f 100644 --- a/spec/run_oc_pedant.rb +++ b/spec/run_oc_pedant.rb @@ -25,9 +25,9 @@ def start_cheffs_server(chef_repo_path) Chef::Config.repo_mode = 'hosted_everything' Chef::Config.chef_repo_path = chef_repo_path Chef::Config.versioned_cookbooks = true - chef_fs = Chef::ChefFS::Config.new.local_fs + chef_fs_config = Chef::ChefFS::Config.new - data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs) + data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs_config.local_fs, chef_fs_config.chef_config) data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'pedant-testorg') data_store = ChefZero::DataStore::DefaultFacade.new(data_store, 'pedant-testorg', false) data_store.create(%w(organizations pedant-testorg users), 'pivotal', '{}') -- cgit v1.2.1