summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-11-09 17:41:09 -0800
committerJohn Keiser <john@johnkeiser.com>2015-11-09 17:43:36 -0800
commit4a20aa1d4aa7be9255d693d7b8cb6d79dc68c862 (patch)
tree317e4465249e0258b73eb2c43af7fd29fcfcb347
parent8e016a339f02f8a71ba0d4a04d3ba163c318bec7 (diff)
downloadchef-zero-4a20aa1d4aa7be9255d693d7b8cb6d79dc68c862.tar.gz
Make chef-zero run pedant tests against ChefFS
-rw-r--r--lib/chef_zero/server.rb4
-rw-r--r--spec/run_oc_pedant.rb10
-rw-r--r--spec/support/oc_pedant.rb28
3 files changed, 27 insertions, 15 deletions
diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb
index 016f299..2b39046 100644
--- a/lib/chef_zero/server.rb
+++ b/lib/chef_zero/server.rb
@@ -481,7 +481,7 @@ module ChefZero
private
- def open_source_endpoints
+ def endpoints
result = if options[:osc_compat]
# OSC-only
[
@@ -570,7 +570,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]
diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb
index 74be329..5383a51 100644
--- a/spec/run_oc_pedant.rb
+++ b/spec/run_oc_pedant.rb
@@ -27,7 +27,14 @@ def start_server(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
@@ -63,7 +70,6 @@ begin
Pedant.config.suite = 'api'
Pedant.config.internal_server = 'http://localhost:8889'
Pedant.config[:config_file] = 'spec/support/oc_pedant.rb'
- Pedant.config[:server_api_version] = 0
Pedant.setup([
'--skip-knife',
'--skip-keys',
diff --git a/spec/support/oc_pedant.rb b/spec/support/oc_pedant.rb
index e3bcf27..c717c0f 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
@@ -60,8 +62,8 @@ explicit_port_url true
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", validator_key: key)
internal_account_url chef_server
delete_org true
@@ -72,7 +74,6 @@ delete_org true
# 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 'pivotal'
superuser_key key
webui_key key
@@ -102,21 +103,26 @@ requestors({
:users => {
# An administrator in the testing organization
:admin => {
- :name => "pedant_admin_user",
- :create_me => true,
- :create_knife => true
+ :name => ENV['CHEF_FS'] ? "pivotal" : 'pedant_admin_user',
+ :create_me => !ENV['CHEF_FS'],
+ :key_file => ENV['CHEF_FS'] ? key : nil,
+ :create_knife => true,
+ :associate => !ENV['CHEF_FS']
},
:non_admin => {
- :name => "pedant_user",
- :create_me => true,
- :create_knife => true
+ :name => ENV['CHEF_FS'] ? "pivotal" : 'pedant_user',
+ :create_me => !ENV['CHEF_FS'],
+ :key_file => ENV['CHEF_FS'] ? key : nil,
+ :create_knife => true,
+ :associate => !ENV['CHEF_FS']
},
# A user that is not a member of the testing organization
:bad => {
- :name => "pedant-nobody",
- :create_me => true,
+ :name => ENV['CHEF_FS'] ? "pivotal" : 'pedant-nobody',
+ :create_me => !ENV['CHEF_FS'],
+ :key_file => ENV['CHEF_FS'] ? key : nil,
:create_knife => true,
:associate => false
},