chef-zero 15.0.17 → 15.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +36 -31
  3. data/LICENSE +201 -201
  4. data/Rakefile +73 -68
  5. data/bin/chef-zero +111 -111
  6. data/chef-zero.gemspec +34 -33
  7. data/lib/chef_zero/chef_data/acl_path.rb +140 -140
  8. data/lib/chef_zero/chef_data/cookbook_data.rb +237 -237
  9. data/lib/chef_zero/chef_data/data_normalizer.rb +276 -276
  10. data/lib/chef_zero/chef_data/default_creator.rb +476 -476
  11. data/lib/chef_zero/data_store/data_already_exists_error.rb +29 -29
  12. data/lib/chef_zero/data_store/data_error.rb +32 -32
  13. data/lib/chef_zero/data_store/data_not_found_error.rb +29 -29
  14. data/lib/chef_zero/data_store/default_facade.rb +143 -147
  15. data/lib/chef_zero/data_store/interface_v1.rb +67 -67
  16. data/lib/chef_zero/data_store/interface_v2.rb +18 -18
  17. data/lib/chef_zero/data_store/memory_store.rb +33 -33
  18. data/lib/chef_zero/data_store/memory_store_v2.rb +159 -159
  19. data/lib/chef_zero/data_store/raw_file_store.rb +143 -143
  20. data/lib/chef_zero/data_store/v1_to_v2_adapter.rb +150 -150
  21. data/lib/chef_zero/data_store/v2_to_v1_adapter.rb +105 -105
  22. data/lib/chef_zero/dist.rb +9 -9
  23. data/lib/chef_zero/endpoints/acl_endpoint.rb +39 -39
  24. data/lib/chef_zero/endpoints/acls_endpoint.rb +41 -41
  25. data/lib/chef_zero/endpoints/actor_default_key_endpoint.rb +78 -78
  26. data/lib/chef_zero/endpoints/actor_endpoint.rb +184 -184
  27. data/lib/chef_zero/endpoints/actor_key_endpoint.rb +62 -62
  28. data/lib/chef_zero/endpoints/actor_keys_endpoint.rb +129 -129
  29. data/lib/chef_zero/endpoints/actors_endpoint.rb +104 -104
  30. data/lib/chef_zero/endpoints/authenticate_user_endpoint.rb +32 -32
  31. data/lib/chef_zero/endpoints/container_endpoint.rb +22 -22
  32. data/lib/chef_zero/endpoints/containers_endpoint.rb +25 -25
  33. data/lib/chef_zero/endpoints/controls_endpoint.rb +16 -16
  34. data/lib/chef_zero/endpoints/cookbook_artifact_endpoint.rb +24 -24
  35. data/lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb +68 -68
  36. data/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb +34 -34
  37. data/lib/chef_zero/endpoints/cookbook_endpoint.rb +39 -39
  38. data/lib/chef_zero/endpoints/cookbook_version_endpoint.rb +136 -136
  39. data/lib/chef_zero/endpoints/cookbooks_base.rb +80 -80
  40. data/lib/chef_zero/endpoints/cookbooks_endpoint.rb +19 -19
  41. data/lib/chef_zero/endpoints/data_bag_endpoint.rb +45 -45
  42. data/lib/chef_zero/endpoints/data_bag_item_endpoint.rb +25 -25
  43. data/lib/chef_zero/endpoints/data_bags_endpoint.rb +23 -23
  44. data/lib/chef_zero/endpoints/dummy_endpoint.rb +29 -29
  45. data/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb +24 -24
  46. data/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +126 -126
  47. data/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb +22 -22
  48. data/lib/chef_zero/endpoints/environment_endpoint.rb +33 -33
  49. data/lib/chef_zero/endpoints/environment_nodes_endpoint.rb +23 -23
  50. data/lib/chef_zero/endpoints/environment_recipes_endpoint.rb +22 -22
  51. data/lib/chef_zero/endpoints/environment_role_endpoint.rb +36 -36
  52. data/lib/chef_zero/endpoints/file_store_file_endpoint.rb +22 -22
  53. data/lib/chef_zero/endpoints/group_endpoint.rb +20 -20
  54. data/lib/chef_zero/endpoints/groups_endpoint.rb +13 -13
  55. data/lib/chef_zero/endpoints/license_endpoint.rb +25 -25
  56. data/lib/chef_zero/endpoints/node_endpoint.rb +34 -34
  57. data/lib/chef_zero/endpoints/node_identifiers_endpoint.rb +22 -22
  58. data/lib/chef_zero/endpoints/nodes_endpoint.rb +34 -34
  59. data/lib/chef_zero/endpoints/not_found_endpoint.rb +11 -11
  60. data/lib/chef_zero/endpoints/organization_association_request_endpoint.rb +22 -22
  61. data/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb +30 -30
  62. data/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb +26 -26
  63. data/lib/chef_zero/endpoints/organization_endpoint.rb +47 -47
  64. data/lib/chef_zero/endpoints/organization_user_base.rb +15 -15
  65. data/lib/chef_zero/endpoints/organization_user_default_key_endpoint.rb +16 -16
  66. data/lib/chef_zero/endpoints/organization_user_endpoint.rb +26 -26
  67. data/lib/chef_zero/endpoints/organization_user_key_endpoint.rb +17 -17
  68. data/lib/chef_zero/endpoints/organization_user_keys_endpoint.rb +17 -17
  69. data/lib/chef_zero/endpoints/organization_users_endpoint.rb +43 -43
  70. data/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb +20 -20
  71. data/lib/chef_zero/endpoints/organizations_endpoint.rb +61 -61
  72. data/lib/chef_zero/endpoints/policies_endpoint.rb +26 -26
  73. data/lib/chef_zero/endpoints/policy_endpoint.rb +24 -24
  74. data/lib/chef_zero/endpoints/policy_group_endpoint.rb +46 -46
  75. data/lib/chef_zero/endpoints/policy_group_policy_endpoint.rb +83 -83
  76. data/lib/chef_zero/endpoints/policy_groups_endpoint.rb +38 -38
  77. data/lib/chef_zero/endpoints/policy_revision_endpoint.rb +66 -66
  78. data/lib/chef_zero/endpoints/policy_revisions_endpoint.rb +15 -15
  79. data/lib/chef_zero/endpoints/principal_endpoint.rb +55 -55
  80. data/lib/chef_zero/endpoints/rest_list_endpoint.rb +42 -42
  81. data/lib/chef_zero/endpoints/rest_object_endpoint.rb +78 -78
  82. data/lib/chef_zero/endpoints/role_endpoint.rb +16 -16
  83. data/lib/chef_zero/endpoints/role_environments_endpoint.rb +14 -14
  84. data/lib/chef_zero/endpoints/sandbox_endpoint.rb +27 -27
  85. data/lib/chef_zero/endpoints/sandboxes_endpoint.rb +51 -51
  86. data/lib/chef_zero/endpoints/search_endpoint.rb +208 -208
  87. data/lib/chef_zero/endpoints/searches_endpoint.rb +18 -18
  88. data/lib/chef_zero/endpoints/server_api_version_endpoint.rb +14 -14
  89. data/lib/chef_zero/endpoints/system_recovery_endpoint.rb +30 -30
  90. data/lib/chef_zero/endpoints/universe_endpoint.rb +15 -15
  91. data/lib/chef_zero/endpoints/user_association_request_endpoint.rb +41 -41
  92. data/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb +19 -19
  93. data/lib/chef_zero/endpoints/user_association_requests_endpoint.rb +19 -19
  94. data/lib/chef_zero/endpoints/user_organizations_endpoint.rb +22 -22
  95. data/lib/chef_zero/endpoints/version_endpoint.rb +13 -13
  96. data/lib/chef_zero/log.rb +7 -7
  97. data/lib/chef_zero/rest_base.rb +332 -332
  98. data/lib/chef_zero/rest_error_response.rb +11 -11
  99. data/lib/chef_zero/rest_request.rb +84 -88
  100. data/lib/chef_zero/rest_router.rb +72 -72
  101. data/lib/chef_zero/rspec.rb +355 -355
  102. data/lib/chef_zero/server.rb +730 -730
  103. data/lib/chef_zero/socketless_server_map.rb +92 -93
  104. data/lib/chef_zero/solr/query/binary_operator.rb +52 -52
  105. data/lib/chef_zero/solr/query/phrase.rb +23 -23
  106. data/lib/chef_zero/solr/query/range_query.rb +46 -46
  107. data/lib/chef_zero/solr/query/regexpable_query.rb +30 -30
  108. data/lib/chef_zero/solr/query/subquery.rb +37 -37
  109. data/lib/chef_zero/solr/query/term.rb +45 -45
  110. data/lib/chef_zero/solr/query/unary_operator.rb +41 -41
  111. data/lib/chef_zero/solr/solr_doc.rb +53 -53
  112. data/lib/chef_zero/solr/solr_parser.rb +208 -208
  113. data/lib/chef_zero/version.rb +3 -3
  114. data/lib/chef_zero.rb +10 -10
  115. data/spec/run_oc_pedant.rb +226 -226
  116. data/spec/search_spec.rb +36 -36
  117. data/spec/server_spec.rb +96 -96
  118. data/spec/socketless_server_map_spec.rb +74 -74
  119. data/spec/support/oc_pedant.rb +149 -149
  120. data/spec/support/secrets.json +6 -6
  121. data/spec/support/stickywicket.pem +27 -27
  122. metadata +35 -18
data/spec/server_spec.rb CHANGED
@@ -1,96 +1,96 @@
1
- require "chef_zero/server"
2
- require "net/http" unless defined?(Net::HTTP)
3
- require "uri" unless defined?(URI)
4
-
5
- describe ChefZero::Server do
6
- context "with a server bound to port 8889" do
7
- before :each do
8
- @server = ChefZero::Server.new(port: 8889)
9
- @server.start_background
10
- end
11
- after :each do
12
- @server.stop
13
- end
14
-
15
- it "a second server bound to port 8889 throws EADDRINUSE" do
16
- expect { ChefZero::Server.new(port: 8889).start }.to raise_error Errno::EADDRINUSE
17
- end
18
-
19
- it "a server bound to range 8889-9999 binds to a port > 8889" do
20
- server = ChefZero::Server.new(port: 8889.upto(9999))
21
- server.start_background
22
- expect(server.port).to be > 8889
23
- expect(URI(server.url).port).to be > 8889
24
- end
25
-
26
- it "a server bound to range 8889-8889 throws an exception" do
27
- expect { ChefZero::Server.new(port: 8889.upto(8889)).start_background }.to raise_error Errno::EADDRINUSE
28
- end
29
-
30
- it "has a very patient request timeout" do
31
- expect(@server.server.config[:RequestTimeout]).to eq 300
32
- end
33
-
34
- context "accept headers" do
35
- def get_nodes(accepts)
36
- uri = URI(@server.url)
37
- httpcall = Net::HTTP.new(uri.host, uri.port)
38
- httpcall.get("/nodes", "Accept" => accepts)
39
- end
40
-
41
- def get_version
42
- uri = URI(@server.url)
43
- httpcall = Net::HTTP.new(uri.host, uri.port)
44
- httpcall.get("/version", "Accept" => "text/plain, application/json")
45
- end
46
-
47
- it "accepts requests with no accept header" do
48
- request = Net::HTTP::Get.new("/nodes")
49
- request.delete("Accept")
50
- uri = URI(@server.url)
51
- response = Net::HTTP.new(uri.host, uri.port).request(request)
52
- expect(response.code).to eq "200"
53
- end
54
-
55
- it "accepts requests with accept: application/json" do
56
- expect(get_nodes("application/json").code).to eq "200"
57
- end
58
-
59
- it "accepts requests with accept: application/*" do
60
- expect(get_nodes("application/*").code).to eq "200"
61
- end
62
-
63
- it "accepts requests with accept: application/*" do
64
- expect(get_nodes("*/*").code).to eq "200"
65
- end
66
-
67
- it "denies requests with accept: application/blah" do
68
- expect(get_nodes("application/blah").code).to eq "406"
69
- end
70
-
71
- it "denies requests with accept: blah/json" do
72
- expect(get_nodes("blah/json").code).to eq "406"
73
- end
74
-
75
- it "denies requests with accept: blah/*" do
76
- expect(get_nodes("blah/*").code).to eq "406"
77
- end
78
-
79
- it "denies requests with accept: blah/*" do
80
- expect(get_nodes("blah/*").code).to eq "406"
81
- end
82
-
83
- it "denies requests with accept: <empty string>" do
84
- expect(get_nodes("").code).to eq "406"
85
- end
86
-
87
- it "accepts requests with accept: a/b;a=b;c=d, application/json;a=b, application/xml;a=b" do
88
- expect(get_nodes("a/b;a=b;c=d, application/json;a=b, application/xml;a=b").code).to eq "200"
89
- end
90
-
91
- it "accepts /version" do
92
- expect(get_version.body.start_with?("chef-zero")).to be true
93
- end
94
- end
95
- end
96
- end
1
+ require "chef_zero/server"
2
+ require "net/http" unless defined?(Net::HTTP)
3
+ require "uri" unless defined?(URI)
4
+
5
+ describe ChefZero::Server do
6
+ context "with a server bound to port 8889" do
7
+ before :each do
8
+ @server = ChefZero::Server.new(port: 8889)
9
+ @server.start_background
10
+ end
11
+ after :each do
12
+ @server.stop
13
+ end
14
+
15
+ it "a second server bound to port 8889 throws EADDRINUSE" do
16
+ expect { ChefZero::Server.new(port: 8889).start }.to raise_error Errno::EADDRINUSE
17
+ end
18
+
19
+ it "a server bound to range 8889-9999 binds to a port > 8889" do
20
+ server = ChefZero::Server.new(port: 8889.upto(9999))
21
+ server.start_background
22
+ expect(server.port).to be > 8889
23
+ expect(URI(server.url).port).to be > 8889
24
+ end
25
+
26
+ it "a server bound to range 8889-8889 throws an exception" do
27
+ expect { ChefZero::Server.new(port: 8889.upto(8889)).start_background }.to raise_error Errno::EADDRINUSE
28
+ end
29
+
30
+ it "has a very patient request timeout" do
31
+ expect(@server.server.config[:RequestTimeout]).to eq 300
32
+ end
33
+
34
+ context "accept headers" do
35
+ def get_nodes(accepts)
36
+ uri = URI(@server.url)
37
+ httpcall = Net::HTTP.new(uri.host, uri.port)
38
+ httpcall.get("/nodes", "Accept" => accepts)
39
+ end
40
+
41
+ def get_version
42
+ uri = URI(@server.url)
43
+ httpcall = Net::HTTP.new(uri.host, uri.port)
44
+ httpcall.get("/version", "Accept" => "text/plain, application/json")
45
+ end
46
+
47
+ it "accepts requests with no accept header" do
48
+ request = Net::HTTP::Get.new("/nodes")
49
+ request.delete("Accept")
50
+ uri = URI(@server.url)
51
+ response = Net::HTTP.new(uri.host, uri.port).request(request)
52
+ expect(response.code).to eq "200"
53
+ end
54
+
55
+ it "accepts requests with accept: application/json" do
56
+ expect(get_nodes("application/json").code).to eq "200"
57
+ end
58
+
59
+ it "accepts requests with accept: application/*" do
60
+ expect(get_nodes("application/*").code).to eq "200"
61
+ end
62
+
63
+ it "accepts requests with accept: application/*" do
64
+ expect(get_nodes("*/*").code).to eq "200"
65
+ end
66
+
67
+ it "denies requests with accept: application/blah" do
68
+ expect(get_nodes("application/blah").code).to eq "406"
69
+ end
70
+
71
+ it "denies requests with accept: blah/json" do
72
+ expect(get_nodes("blah/json").code).to eq "406"
73
+ end
74
+
75
+ it "denies requests with accept: blah/*" do
76
+ expect(get_nodes("blah/*").code).to eq "406"
77
+ end
78
+
79
+ it "denies requests with accept: blah/*" do
80
+ expect(get_nodes("blah/*").code).to eq "406"
81
+ end
82
+
83
+ it "denies requests with accept: <empty string>" do
84
+ expect(get_nodes("").code).to eq "406"
85
+ end
86
+
87
+ it "accepts requests with accept: a/b;a=b;c=d, application/json;a=b, application/xml;a=b" do
88
+ expect(get_nodes("a/b;a=b;c=d, application/json;a=b, application/xml;a=b").code).to eq "200"
89
+ end
90
+
91
+ it "accepts /version" do
92
+ expect(get_version.body.start_with?("chef-zero")).to be true
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,74 +1,74 @@
1
- require "chef_zero/socketless_server_map"
2
-
3
- describe "Socketless Mode" do
4
-
5
- let(:server_map) { ChefZero::SocketlessServerMap.instance.tap(&:reset!) }
6
-
7
- let(:server) { instance_double("ChefZero::Server") }
8
-
9
- let(:second_server) { instance_double("ChefZero::Server") }
10
-
11
- it "registers a socketful server" do
12
- server_map.register_port(8889, server)
13
- expect(server_map).to have_server_on_port(8889)
14
- end
15
-
16
- it "retrieves a server by port" do
17
- server_map.register_port(8889, server)
18
- expect(ChefZero::SocketlessServerMap.server_on_port(8889)).to eq(server)
19
- end
20
-
21
- context "when a no-listen server is registered" do
22
-
23
- let!(:port) { server_map.register_no_listen_server(server) }
24
-
25
- it "assigns the server a low port number" do
26
- expect(port).to eq(1)
27
- end
28
-
29
- context "and another server is registered" do
30
-
31
- let!(:next_port) { server_map.register_no_listen_server(second_server) }
32
-
33
- it "assigns another port when another server is registered" do
34
- expect(next_port).to eq(2)
35
- end
36
-
37
- it "raises NoSocketlessPortAvailable when too many servers are registered" do
38
- expect { 1000.times { server_map.register_no_listen_server(server) } }.to raise_error(ChefZero::NoSocketlessPortAvailable)
39
- end
40
-
41
- it "deregisters a server" do
42
- expect(server_map).to have_server_on_port(1)
43
- server_map.deregister(1)
44
- expect(server_map).to_not have_server_on_port(1)
45
- end
46
-
47
- describe "routing requests to a server" do
48
-
49
- let(:rack_req) do
50
- r = {}
51
- r["REQUEST_METHOD"] = "GET"
52
- r["SCRIPT_NAME"] = ""
53
- r["PATH_INFO"] = "/clients"
54
- r["QUERY_STRING"] = ""
55
- r["rack.input"] = StringIO.new("")
56
- r
57
- end
58
-
59
- let(:rack_response) { [200, {}, ["this is the response body"] ] }
60
-
61
- it "routes a request to the registered port" do
62
- expect(server).to receive(:handle_socketless_request).with(rack_req).and_return(rack_response)
63
- response = server_map.request(1, rack_req)
64
- expect(response).to eq(rack_response)
65
- end
66
-
67
- it "raises ServerNotFound when a request is sent to an unregistered port" do
68
- expect { server_map.request(99, rack_req) }.to raise_error(ChefZero::ServerNotFound)
69
- end
70
- end
71
- end
72
- end
73
-
74
- end
1
+ require "chef_zero/socketless_server_map"
2
+
3
+ describe "Socketless Mode" do
4
+
5
+ let(:server_map) { ChefZero::SocketlessServerMap.instance.tap(&:reset!) }
6
+
7
+ let(:server) { instance_double("ChefZero::Server") }
8
+
9
+ let(:second_server) { instance_double("ChefZero::Server") }
10
+
11
+ it "registers a socketful server" do
12
+ server_map.register_port(8889, server)
13
+ expect(server_map).to have_server_on_port(8889)
14
+ end
15
+
16
+ it "retrieves a server by port" do
17
+ server_map.register_port(8889, server)
18
+ expect(ChefZero::SocketlessServerMap.server_on_port(8889)).to eq(server)
19
+ end
20
+
21
+ context "when a no-listen server is registered" do
22
+
23
+ let!(:port) { server_map.register_no_listen_server(server) }
24
+
25
+ it "assigns the server a low port number" do
26
+ expect(port).to eq(1)
27
+ end
28
+
29
+ context "and another server is registered" do
30
+
31
+ let!(:next_port) { server_map.register_no_listen_server(second_server) }
32
+
33
+ it "assigns another port when another server is registered" do
34
+ expect(next_port).to eq(2)
35
+ end
36
+
37
+ it "raises NoSocketlessPortAvailable when too many servers are registered" do
38
+ expect { 1000.times { server_map.register_no_listen_server(server) } }.to raise_error(ChefZero::NoSocketlessPortAvailable)
39
+ end
40
+
41
+ it "deregisters a server" do
42
+ expect(server_map).to have_server_on_port(1)
43
+ server_map.deregister(1)
44
+ expect(server_map).to_not have_server_on_port(1)
45
+ end
46
+
47
+ describe "routing requests to a server" do
48
+
49
+ let(:rack_req) do
50
+ r = {}
51
+ r["REQUEST_METHOD"] = "GET"
52
+ r["SCRIPT_NAME"] = ""
53
+ r["PATH_INFO"] = "/clients"
54
+ r["QUERY_STRING"] = ""
55
+ r["rack.input"] = StringIO.new("")
56
+ r
57
+ end
58
+
59
+ let(:rack_response) { [200, {}, ["this is the response body"] ] }
60
+
61
+ it "routes a request to the registered port" do
62
+ expect(server).to receive(:handle_socketless_request).with(rack_req).and_return(rack_response)
63
+ response = server_map.request(1, rack_req)
64
+ expect(response).to eq(rack_response)
65
+ end
66
+
67
+ it "raises ServerNotFound when a request is sent to an unregistered port" do
68
+ expect { server_map.request(99, rack_req) }.to raise_error(ChefZero::ServerNotFound)
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ end
@@ -1,149 +1,149 @@
1
- # Copyright: Copyright (c) 2012 Opscode, Inc.
2
- # License: Apache License, Version 2.0
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # https://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- # This annotated Pedant configuration file details the various
17
- # configuration settings available to you. It is separate from the
18
- # actual Pedant::Config class because not all settings have sane
19
- # defaults, and not all settings are appropriate in all settings.
20
-
21
- ################################################################################
22
- # You MUST specify the address of the server the API requests will be
23
- # sent to. Only specify protocol, hostname, and port.
24
- chef_server "http://127.0.0.1:8889"
25
-
26
- # If you are doing development testing, you can specify the address of
27
- # the Solr server. The presence of this parameter will enable tests
28
- # to force commits to Solr, greatly decreasing the amout of time
29
- # needed for testing the search endpoint. This is only an
30
- # optimization for development! If you are testing a "live" Chef
31
- # Server, or otherwise do not have access to the Solr server from your
32
- # testing location, you should not specify a value for this parameter.
33
- # The tests will still run, albeit slower, as they will now need to
34
- # poll for a period to ensure they are querying committed results.
35
- # search_server "http://localhost:8983"
36
-
37
- # Related to the 'search_server' parameter, this specifies the maximum
38
- # amout of time (in seconds) that search endpoint requests should be
39
- # retried before giving up. If not explicitly set, it will default to
40
- # 65 seconds; only set it if you know that your Solr commit interval
41
- # differs significantly from this.
42
- maximum_search_time 0
43
-
44
- # OSC sends erchef a host header with a port, so this option needs
45
- # # to be enabled for Pedant tests to work correctly
46
- explicit_port_url true
47
-
48
- server_api_version 0
49
-
50
- internal_server chef_server
51
-
52
- # see dummy_endpoint.rb for details.
53
- search_server chef_server
54
- search_commit_url "/dummy"
55
- search_url_fmt "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json"
56
-
57
- # We're starting to break tests up into groups based on different
58
- # criteria. The proper API tests (the results of which are viewable
59
- # to OPC customers) should be the only ones run by Pedant embedded in
60
- # OPC installs. There are other specs that help us keep track of API
61
- # cruft that we want to come back and fix later; these shouldn't be
62
- # viewable to customers, but we should be able to run them in
63
- # development and CI environments. If this parameter is missing or
64
- # explicitly `false` only the customer-friendly tests will be run.
65
- #
66
- # This is mainly here for documentation purposes, since the
67
- # command-line `opscode-pedant` utility ultimately determines this
68
- # value.
69
- include_internal false
70
-
71
- key = "spec/support/stickywicket.pem"
72
-
73
- org(name: "pedant-testorg",
74
- create_me: !ENV["CHEF_FS"],
75
- validator_key: key)
76
-
77
- internal_account_url chef_server
78
- delete_org true
79
-
80
- # Test users. The five users specified below are required; their
81
- # names (:user, :non_org_user, etc.) are indicative of their role
82
- # within the tests. All users must have a ':name' key. If they have
83
- # a ':create_me' key, Pedant will create these users for you. If you
84
- # are using pre-existing users, you must supply a ':key_file' key,
85
- # which should be the fully-qualified path /on the machine Pedant is
86
- # running on/ to a private key for that user.
87
- superuser_name "pivotal"
88
-
89
- def cheffs_or_else_user(value)
90
- ENV["CHEF_FS"] ? "pivotal" : value
91
- end
92
-
93
- keyfile_maybe = ENV["CHEF_FS"] ? { key_file: key } : { key_file: nil }
94
-
95
- requestors({
96
- clients: {
97
- # The the admin user, for the purposes of getting things rolling
98
- admin: {
99
- name: "pedant_admin_client",
100
- create_me: true,
101
- create_knife: true,
102
- admin: true,
103
- },
104
- non_admin: {
105
- name: "pedant_client",
106
- create_me: true,
107
- create_knife: true,
108
- },
109
- bad: {
110
- name: "bad_client",
111
- create_me: true,
112
- create_knife: true,
113
- bogus: true,
114
- },
115
- },
116
-
117
- users: {
118
- # An administrator in the testing organization
119
- admin: {
120
- name: cheffs_or_else_user("pedant_admin_user"),
121
- create_me: !ENV["CHEF_FS"],
122
- associate: !ENV["CHEF_FS"],
123
- create_knife: true,
124
- }.merge(keyfile_maybe),
125
-
126
- non_admin: {
127
- name: cheffs_or_else_user("pedant_user"),
128
- create_me: !ENV["CHEF_FS"],
129
- associate: !ENV["CHEF_FS"],
130
- create_knife: true,
131
- }.merge(keyfile_maybe),
132
-
133
- # A user that is not a member of the testing organization
134
- bad: {
135
- name: cheffs_or_else_user("pedant-nobody"),
136
- create_me: !ENV["CHEF_FS"],
137
- create_knife: true,
138
- associate: false,
139
- }.merge(keyfile_maybe),
140
- },
141
- })
142
-
143
- self[:tags] = %i{validation authentication authorization}
144
- verify_error_messages false
145
-
146
- ruby_users_endpoint? false
147
- ruby_acls_endpoint? false
148
- ruby_org_assoc? false
149
- chef_12? true
1
+ # Copyright: Copyright (c) 2012 Opscode, Inc.
2
+ # License: Apache License, Version 2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # https://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # This annotated Pedant configuration file details the various
17
+ # configuration settings available to you. It is separate from the
18
+ # actual Pedant::Config class because not all settings have sane
19
+ # defaults, and not all settings are appropriate in all settings.
20
+
21
+ ################################################################################
22
+ # You MUST specify the address of the server the API requests will be
23
+ # sent to. Only specify protocol, hostname, and port.
24
+ chef_server "http://127.0.0.1:8889"
25
+
26
+ # If you are doing development testing, you can specify the address of
27
+ # the Solr server. The presence of this parameter will enable tests
28
+ # to force commits to Solr, greatly decreasing the amout of time
29
+ # needed for testing the search endpoint. This is only an
30
+ # optimization for development! If you are testing a "live" Chef
31
+ # Server, or otherwise do not have access to the Solr server from your
32
+ # testing location, you should not specify a value for this parameter.
33
+ # The tests will still run, albeit slower, as they will now need to
34
+ # poll for a period to ensure they are querying committed results.
35
+ # search_server "http://localhost:8983"
36
+
37
+ # Related to the 'search_server' parameter, this specifies the maximum
38
+ # amout of time (in seconds) that search endpoint requests should be
39
+ # retried before giving up. If not explicitly set, it will default to
40
+ # 65 seconds; only set it if you know that your Solr commit interval
41
+ # differs significantly from this.
42
+ maximum_search_time 0
43
+
44
+ # OSC sends erchef a host header with a port, so this option needs
45
+ # # to be enabled for Pedant tests to work correctly
46
+ explicit_port_url true
47
+
48
+ server_api_version 0
49
+
50
+ internal_server chef_server
51
+
52
+ # see dummy_endpoint.rb for details.
53
+ search_server chef_server
54
+ search_commit_url "/dummy"
55
+ search_url_fmt "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json"
56
+
57
+ # We're starting to break tests up into groups based on different
58
+ # criteria. The proper API tests (the results of which are viewable
59
+ # to OPC customers) should be the only ones run by Pedant embedded in
60
+ # OPC installs. There are other specs that help us keep track of API
61
+ # cruft that we want to come back and fix later; these shouldn't be
62
+ # viewable to customers, but we should be able to run them in
63
+ # development and CI environments. If this parameter is missing or
64
+ # explicitly `false` only the customer-friendly tests will be run.
65
+ #
66
+ # This is mainly here for documentation purposes, since the
67
+ # command-line `opscode-pedant` utility ultimately determines this
68
+ # value.
69
+ include_internal false
70
+
71
+ key = "spec/support/stickywicket.pem"
72
+
73
+ org(name: "pedant-testorg",
74
+ create_me: !ENV["CHEF_FS"],
75
+ validator_key: key)
76
+
77
+ internal_account_url chef_server
78
+ delete_org true
79
+
80
+ # Test users. The five users specified below are required; their
81
+ # names (:user, :non_org_user, etc.) are indicative of their role
82
+ # within the tests. All users must have a ':name' key. If they have
83
+ # a ':create_me' key, Pedant will create these users for you. If you
84
+ # are using pre-existing users, you must supply a ':key_file' key,
85
+ # which should be the fully-qualified path /on the machine Pedant is
86
+ # running on/ to a private key for that user.
87
+ superuser_name "pivotal"
88
+
89
+ def cheffs_or_else_user(value)
90
+ ENV["CHEF_FS"] ? "pivotal" : value
91
+ end
92
+
93
+ keyfile_maybe = ENV["CHEF_FS"] ? { key_file: key } : { key_file: nil }
94
+
95
+ requestors({
96
+ clients: {
97
+ # The the admin user, for the purposes of getting things rolling
98
+ admin: {
99
+ name: "pedant_admin_client",
100
+ create_me: true,
101
+ create_knife: true,
102
+ admin: true,
103
+ },
104
+ non_admin: {
105
+ name: "pedant_client",
106
+ create_me: true,
107
+ create_knife: true,
108
+ },
109
+ bad: {
110
+ name: "bad_client",
111
+ create_me: true,
112
+ create_knife: true,
113
+ bogus: true,
114
+ },
115
+ },
116
+
117
+ users: {
118
+ # An administrator in the testing organization
119
+ admin: {
120
+ name: cheffs_or_else_user("pedant_admin_user"),
121
+ create_me: !ENV["CHEF_FS"],
122
+ associate: !ENV["CHEF_FS"],
123
+ create_knife: true,
124
+ }.merge(keyfile_maybe),
125
+
126
+ non_admin: {
127
+ name: cheffs_or_else_user("pedant_user"),
128
+ create_me: !ENV["CHEF_FS"],
129
+ associate: !ENV["CHEF_FS"],
130
+ create_knife: true,
131
+ }.merge(keyfile_maybe),
132
+
133
+ # A user that is not a member of the testing organization
134
+ bad: {
135
+ name: cheffs_or_else_user("pedant-nobody"),
136
+ create_me: !ENV["CHEF_FS"],
137
+ create_knife: true,
138
+ associate: false,
139
+ }.merge(keyfile_maybe),
140
+ },
141
+ })
142
+
143
+ self[:tags] = %i{validation authentication authorization}
144
+ verify_error_messages false
145
+
146
+ ruby_users_endpoint? false
147
+ ruby_acls_endpoint? false
148
+ ruby_org_assoc? false
149
+ chef_12? true