puppet 2.7.3 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +166 -0
- data/install.rb +27 -7
- data/lib/puppet/application/agent.rb +29 -29
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/inspect.rb +9 -1
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/application/queue.rb +1 -1
- data/lib/puppet/application/resource.rb +3 -0
- data/lib/puppet/application.rb +4 -5
- data/lib/puppet/configurer.rb +1 -4
- data/lib/puppet/defaults.rb +45 -15
- data/lib/puppet/feature/base.rb +28 -17
- data/lib/puppet/feature/rails.rb +0 -3
- data/lib/puppet/feature/rubygems.rb +0 -3
- data/lib/puppet/file_bucket/dipper.rb +3 -2
- data/lib/puppet/file_bucket/file.rb +3 -3
- data/lib/puppet/file_serving/base.rb +4 -5
- data/lib/puppet/file_serving/configuration.rb +7 -13
- data/lib/puppet/file_serving/content.rb +0 -4
- data/lib/puppet/file_serving/fileset.rb +7 -6
- data/lib/puppet/file_serving/indirection_hooks.rb +1 -4
- data/lib/puppet/file_serving/metadata.rb +0 -4
- data/lib/puppet/file_serving/mount/file.rb +9 -12
- data/lib/puppet/file_serving/mount.rb +0 -5
- data/lib/puppet/file_serving/terminus_helper.rb +0 -4
- data/lib/puppet/file_serving.rb +0 -4
- data/lib/puppet/indirector/catalog/compiler.rb +0 -18
- data/lib/puppet/indirector/catalog/store_configs.rb +5 -0
- data/lib/puppet/indirector/direct_file_server.rb +0 -4
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/store_configs.rb +5 -0
- data/lib/puppet/indirector/file_content/file.rb +0 -4
- data/lib/puppet/indirector/file_content/file_server.rb +0 -4
- data/lib/puppet/indirector/file_content/rest.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file_server.rb +0 -4
- data/lib/puppet/indirector/file_metadata/rest.rb +0 -4
- data/lib/puppet/indirector/file_server.rb +1 -5
- data/lib/puppet/indirector/indirection.rb +3 -5
- data/lib/puppet/indirector/node/store_configs.rb +5 -0
- data/lib/puppet/indirector/request.rb +3 -1
- data/lib/puppet/indirector/resource/active_record.rb +97 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/ssl_file.rb +5 -1
- data/lib/puppet/indirector/store_configs.rb +30 -0
- data/lib/puppet/indirector/yaml.rb +5 -0
- data/lib/puppet/indirector.rb +7 -0
- data/lib/puppet/network/client.rb +0 -5
- data/lib/puppet/network/http_pool.rb +0 -56
- data/lib/puppet/node/environment.rb +9 -11
- data/lib/puppet/parameter/path.rb +1 -5
- data/lib/puppet/parameter.rb +1 -7
- data/lib/puppet/parser/ast/collection.rb +2 -2
- data/lib/puppet/parser/ast/collexpr.rb +10 -39
- data/lib/puppet/parser/collector.rb +41 -90
- data/lib/puppet/parser/compiler.rb +0 -3
- data/lib/puppet/parser/functions/create_resources.rb +22 -10
- data/lib/puppet/parser/functions/versioncmp.rb +9 -6
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/provider/augeas/augeas.rb +5 -3
- data/lib/puppet/provider/cron/crontab.rb +2 -2
- data/lib/puppet/provider/exec/posix.rb +23 -96
- data/lib/puppet/provider/exec/shell.rb +11 -2
- data/lib/puppet/provider/exec/windows.rb +35 -0
- data/lib/puppet/provider/exec.rb +79 -0
- data/lib/puppet/provider/group/windows_adsi.rb +48 -0
- data/lib/puppet/provider/host/parsed.rb +3 -0
- data/lib/puppet/provider/macauthorization/macauthorization.rb +4 -4
- data/lib/puppet/provider/mount.rb +0 -3
- data/lib/puppet/provider/naginator.rb +0 -3
- data/lib/puppet/provider/package/appdmg.rb +0 -1
- data/lib/puppet/provider/package/apple.rb +3 -7
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/aptitude.rb +0 -1
- data/lib/puppet/provider/package/aptrpm.rb +0 -1
- data/lib/puppet/provider/package/blastwave.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +5 -6
- data/lib/puppet/provider/package/fink.rb +3 -4
- data/lib/puppet/provider/package/freebsd.rb +0 -1
- data/lib/puppet/provider/package/gem.rb +0 -1
- data/lib/puppet/provider/package/hpux.rb +3 -3
- data/lib/puppet/provider/package/macports.rb +0 -1
- data/lib/puppet/provider/package/msi.rb +82 -0
- data/lib/puppet/provider/package/openbsd.rb +18 -19
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +0 -1
- data/lib/puppet/provider/package/pkgdmg.rb +9 -7
- data/lib/puppet/provider/package/pkgutil.rb +0 -1
- data/lib/puppet/provider/package/ports.rb +0 -1
- data/lib/puppet/provider/package/portupgrade.rb +183 -193
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +0 -1
- data/lib/puppet/provider/package/sunfreeware.rb +0 -2
- data/lib/puppet/provider/package/up2date.rb +0 -1
- data/lib/puppet/provider/package/urpmi.rb +0 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package.rb +4 -3
- data/lib/puppet/provider/service/systemd.rb +64 -0
- data/lib/puppet/provider/service/windows.rb +110 -0
- data/lib/puppet/provider/user/windows_adsi.rb +71 -0
- data/lib/puppet/rails/resource.rb +1 -1
- data/lib/puppet/relationship.rb +0 -3
- data/lib/puppet/reports/tagmail.rb +15 -11
- data/lib/puppet/resource/catalog.rb +17 -24
- data/lib/puppet/ssl/certificate_authority.rb +7 -5
- data/lib/puppet/ssl/host.rb +6 -10
- data/lib/puppet/type/augeas.rb +19 -13
- data/lib/puppet/type/cron.rb +13 -12
- data/lib/puppet/type/exec.rb +17 -17
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/source.rb +14 -9
- data/lib/puppet/type/file.rb +44 -23
- data/lib/puppet/type/filebucket.rb +13 -5
- data/lib/puppet/type/package.rb +14 -1
- data/lib/puppet/type/service.rb +11 -1
- data/lib/puppet/type/ssh_authorized_key.rb +3 -1
- data/lib/puppet/type.rb +8 -17
- data/lib/puppet/util/adsi.rb +278 -0
- data/lib/puppet/util/autoload.rb +0 -2
- data/lib/puppet/util/cacher.rb +15 -67
- data/lib/puppet/util/feature.rb +0 -3
- data/lib/puppet/util/graph.rb +0 -3
- data/lib/puppet/util/ldap/connection.rb +0 -3
- data/lib/puppet/util/ldap/generator.rb +0 -3
- data/lib/puppet/util/ldap.rb +0 -3
- data/lib/puppet/util/log_paths.rb +0 -3
- data/lib/puppet/util/network_device/cisco/device.rb +2 -1
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/pidlock.rb +5 -1
- data/lib/puppet/util/rdoc/parser.rb +3 -1
- data/lib/puppet/util/run_mode.rb +2 -2
- data/lib/puppet/util/settings/file_setting.rb +3 -2
- data/lib/puppet/util/settings.rb +4 -6
- data/lib/puppet/util/suidmanager.rb +62 -15
- data/lib/puppet/util.rb +113 -131
- data/lib/puppet.rb +1 -1
- data/spec/integration/application/doc_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +22 -17
- data/spec/integration/file_serving/content_spec.rb +0 -6
- data/spec/integration/file_serving/metadata_spec.rb +0 -6
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/integration/indirector/direct_file_server_spec.rb +5 -7
- data/spec/integration/indirector/file_content/file_server_spec.rb +2 -6
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -5
- data/spec/integration/network/server/webrick_spec.rb +6 -9
- data/spec/integration/node/facts_spec.rb +0 -6
- data/spec/integration/node_spec.rb +3 -4
- data/spec/integration/parser/compiler_spec.rb +2 -1
- data/spec/integration/parser/parser_spec.rb +2 -4
- data/spec/integration/provider/mount_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +13 -3
- data/spec/integration/provider/ssh_authorized_key_spec.rb +4 -4
- data/spec/integration/reports_spec.rb +0 -4
- data/spec/integration/resource/catalog_spec.rb +0 -5
- data/spec/integration/ssl/certificate_authority_spec.rb +6 -14
- data/spec/integration/ssl/certificate_request_spec.rb +10 -17
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +8 -13
- data/spec/integration/ssl/host_spec.rb +8 -14
- data/spec/integration/transaction/report_spec.rb +0 -5
- data/spec/integration/transaction_spec.rb +11 -13
- data/spec/integration/type/file_spec.rb +16 -16
- data/spec/integration/type/tidy_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +2 -2
- data/spec/integration/util_spec.rb +13 -0
- data/spec/lib/puppet_spec/files.rb +18 -10
- data/spec/shared_behaviours/file_server_terminus.rb +1 -5
- data/spec/shared_behaviours/file_serving.rb +0 -4
- data/spec/shared_behaviours/memory_terminus.rb +0 -4
- data/spec/shared_behaviours/path_parameters.rb +20 -18
- data/spec/shared_behaviours/store_configs_terminus.rb +21 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/agent_spec.rb +0 -4
- data/spec/unit/application/apply_spec.rb +8 -2
- data/spec/unit/application/certificate_spec.rb +2 -0
- data/spec/unit/application/device_spec.rb +8 -6
- data/spec/unit/application/inspect_spec.rb +2 -1
- data/spec/unit/application/master_spec.rb +7 -2
- data/spec/unit/application/queue_spec.rb +3 -4
- data/spec/unit/application/resource_spec.rb +26 -0
- data/spec/unit/application/secret_agent_spec.rb +3 -1
- data/spec/unit/application_spec.rb +4 -0
- data/spec/unit/configurer/downloader_spec.rb +4 -3
- data/spec/unit/configurer_spec.rb +11 -4
- data/spec/unit/daemon_spec.rb +3 -1
- data/spec/unit/face/ca_spec.rb +1 -1
- data/spec/unit/face/node_spec.rb +5 -1
- data/spec/unit/face/secret_agent_spec.rb +3 -1
- data/spec/unit/file_bucket/dipper_spec.rb +4 -4
- data/spec/unit/file_bucket/file_spec.rb +9 -3
- data/spec/unit/file_serving/configuration_spec.rb +26 -37
- data/spec/unit/file_serving/fileset_spec.rb +71 -55
- data/spec/unit/file_serving/indirection_hooks_spec.rb +0 -4
- data/spec/unit/file_serving/mount/file_spec.rb +163 -169
- data/spec/unit/file_serving/terminus_helper_spec.rb +0 -4
- data/spec/unit/indirector/catalog/compiler_spec.rb +0 -22
- data/spec/unit/indirector/catalog/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -5
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_status/file_spec.rb +1 -1
- data/spec/unit/indirector/direct_file_server_spec.rb +0 -4
- data/spec/unit/indirector/facts/facter_spec.rb +0 -4
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +3 -0
- data/spec/unit/indirector/facts/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -3
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_content/file_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_spec.rb +0 -4
- data/spec/unit/indirector/file_server_spec.rb +1 -5
- data/spec/unit/indirector/indirection_spec.rb +0 -4
- data/spec/unit/indirector/key/ca_spec.rb +0 -4
- data/spec/unit/indirector/key/file_spec.rb +0 -4
- data/spec/unit/indirector/node/store_configs_spec.rb +16 -0
- data/spec/unit/indirector/report/processor_spec.rb +0 -4
- data/spec/unit/indirector/resource/active_record_spec.rb +192 -0
- data/spec/unit/indirector/resource/ral_spec.rb +1 -1
- data/spec/unit/indirector/resource/store_configs_spec.rb +12 -0
- data/spec/unit/indirector/resource_type/parser_spec.rb +3 -3
- data/spec/unit/indirector/ssl_file_spec.rb +25 -6
- data/spec/unit/indirector/store_configs_spec.rb +8 -0
- data/spec/unit/indirector/yaml_spec.rb +14 -0
- data/spec/unit/module_spec.rb +2 -2
- data/spec/unit/network/handler/fileserver_spec.rb +5 -5
- data/spec/unit/network/http/mongrel_spec.rb +0 -4
- data/spec/unit/network/http/webrick_spec.rb +5 -9
- data/spec/unit/network/http_pool_spec.rb +4 -75
- data/spec/unit/network/http_spec.rb +0 -4
- data/spec/unit/network/server_spec.rb +0 -4
- data/spec/unit/node/environment_spec.rb +18 -31
- data/spec/unit/node/facts_spec.rb +0 -4
- data/spec/unit/node_spec.rb +1 -8
- data/spec/unit/other/selinux_spec.rb +3 -1
- data/spec/unit/parameter_spec.rb +0 -10
- data/spec/unit/parser/ast/collexpr_spec.rb +17 -13
- data/spec/unit/parser/collector_spec.rb +147 -263
- data/spec/unit/parser/compiler_spec.rb +3 -1
- data/spec/unit/parser/files_spec.rb +7 -4
- data/spec/unit/parser/functions/extlookup_spec.rb +6 -3
- data/spec/unit/parser/functions/sprintf_spec.rb +2 -1
- data/spec/unit/parser/type_loader_spec.rb +7 -7
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -0
- data/spec/unit/provider/exec/posix_spec.rb +102 -106
- data/spec/unit/provider/exec/shell_spec.rb +1 -1
- data/spec/unit/provider/exec/windows_spec.rb +119 -0
- data/spec/unit/provider/group/ldap_spec.rb +0 -4
- data/spec/unit/provider/group/windows_adsi_spec.rb +79 -0
- data/spec/unit/provider/ldap_spec.rb +0 -4
- data/spec/unit/provider/macauthorization_spec.rb +5 -0
- data/spec/unit/provider/mount/parsed_spec.rb +1 -5
- data/spec/unit/provider/package/msi_spec.rb +170 -0
- data/spec/unit/provider/service/redhat_spec.rb +2 -0
- data/spec/unit/provider/service/smf_spec.rb +3 -0
- data/spec/unit/provider/service/systemd_spec.rb +25 -0
- data/spec/unit/provider/service/windows_spec.rb +166 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/ldap_spec.rb +0 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +110 -0
- data/spec/unit/relationship_spec.rb +0 -4
- data/spec/unit/resource/catalog_spec.rb +37 -25
- data/spec/unit/resource/status_spec.rb +4 -2
- data/spec/unit/resource_spec.rb +5 -5
- data/spec/unit/simple_graph_spec.rb +0 -4
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -2
- data/spec/unit/ssl/host_spec.rb +12 -13
- data/spec/unit/ssl/inventory_spec.rb +2 -2
- data/spec/unit/sslcertificates/ca_spec.rb +6 -10
- data/spec/unit/transaction/event_manager_spec.rb +4 -2
- data/spec/unit/transaction/event_spec.rb +3 -1
- data/spec/unit/transaction/report_spec.rb +2 -6
- data/spec/unit/transaction/resource_harness_spec.rb +9 -5
- data/spec/unit/transaction_spec.rb +3 -1
- data/spec/unit/type/cron_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +80 -47
- data/spec/unit/type/file/checksum_spec.rb +9 -8
- data/spec/unit/type/file/content_spec.rb +2 -1
- data/spec/unit/type/file/selinux_spec.rb +10 -8
- data/spec/unit/type/file/source_spec.rb +18 -36
- data/spec/unit/type/file_spec.rb +170 -217
- data/spec/unit/type/group_spec.rb +1 -1
- data/spec/unit/type/mount_spec.rb +5 -5
- data/spec/unit/type/noop_metaparam_spec.rb +3 -1
- data/spec/unit/type/package_spec.rb +15 -3
- data/spec/unit/type/resources_spec.rb +2 -2
- data/spec/unit/type/service_spec.rb +19 -4
- data/spec/unit/type/ssh_authorized_key_spec.rb +10 -4
- data/spec/unit/type/tidy_spec.rb +3 -1
- data/spec/unit/type/user_spec.rb +1 -1
- data/spec/unit/type_spec.rb +29 -34
- data/spec/unit/util/adsi_spec.rb +202 -0
- data/spec/unit/util/autoload_spec.rb +23 -19
- data/spec/unit/util/backups_spec.rb +16 -13
- data/spec/unit/util/cacher_spec.rb +64 -141
- data/spec/unit/util/checksums_spec.rb +0 -4
- data/spec/unit/util/constant_inflector_spec.rb +0 -4
- data/spec/unit/util/execution_stub_spec.rb +1 -1
- data/spec/unit/util/ldap/connection_spec.rb +0 -4
- data/spec/unit/util/ldap/generator_spec.rb +0 -4
- data/spec/unit/util/ldap/manager_spec.rb +0 -4
- data/spec/unit/util/log_spec.rb +4 -2
- data/spec/unit/util/logging_spec.rb +2 -2
- data/spec/unit/util/nagios_maker_spec.rb +0 -4
- data/spec/unit/util/network_device/cisco/device_spec.rb +2 -1
- data/spec/unit/util/network_device/cisco/facts_spec.rb +3 -1
- data/spec/unit/util/network_device/config_spec.rb +5 -3
- data/spec/unit/util/rdoc/parser_spec.rb +7 -1
- data/spec/unit/util/run_mode_spec.rb +6 -2
- data/spec/unit/util/settings/file_setting_spec.rb +29 -2
- data/spec/unit/util/settings_spec.rb +28 -15
- data/spec/unit/util/storage_spec.rb +1 -1
- data/spec/unit/util/suidmanager_spec.rb +310 -0
- data/spec/unit/util/tagging_spec.rb +0 -4
- data/spec/unit/util_spec.rb +335 -0
- data/test/language/ast/variable.rb +0 -4
- data/test/lib/puppettest/support/resources.rb +0 -4
- data/test/lib/puppettest/testcase.rb +0 -4
- data/test/lib/puppettest.rb +0 -1
- data/test/network/handler/master.rb +0 -5
- data/test/network/server/webrick.rb +5 -22
- data/test/ral/manager/attributes.rb +0 -4
- data/test/ral/manager/instances.rb +0 -4
- data/test/ral/manager/manager.rb +0 -4
- data/test/ral/providers/cron/crontab.rb +1 -0
- data/test/ral/providers/service/base.rb +0 -4
- data/test/ral/type/filesources.rb +0 -1
- data/test/ral/type/resources.rb +0 -4
- data/test/util/utiltest.rb +0 -13
- metadata +36 -9
- data/spec/unit/network/client_spec.rb +0 -45
- data/test/puppet/tc_suidmanager.rb +0 -120
@@ -0,0 +1,192 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'sqlite3'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'puppet/rails'
|
10
|
+
require 'puppet/node/facts'
|
11
|
+
|
12
|
+
describe "Puppet::Resource::ActiveRecord", :if => (Puppet.features.rails? and defined? SQLite3) do
|
13
|
+
include PuppetSpec::Files
|
14
|
+
|
15
|
+
before :each do
|
16
|
+
dir = Pathname(tmpdir('puppet-var'))
|
17
|
+
Puppet[:vardir] = dir.to_s
|
18
|
+
Puppet[:dbadapter] = 'sqlite3'
|
19
|
+
Puppet[:dblocation] = (dir + 'storeconfigs.sqlite').to_s
|
20
|
+
Puppet[:storeconfigs] = true
|
21
|
+
end
|
22
|
+
|
23
|
+
after :each do
|
24
|
+
ActiveRecord::Base.remove_connection
|
25
|
+
end
|
26
|
+
|
27
|
+
subject {
|
28
|
+
require 'puppet/indirector/resource/active_record'
|
29
|
+
Puppet::Resource.indirection.terminus(:active_record)
|
30
|
+
}
|
31
|
+
|
32
|
+
it "should automatically initialize Rails" do
|
33
|
+
# Other tests in the suite may have established the connection, which will
|
34
|
+
# linger; the assertion is just to enforce our assumption about the call,
|
35
|
+
# not because I *really* want to test ActiveRecord works. Better to have
|
36
|
+
# an early failure than wonder why the test overall doesn't DTRT.
|
37
|
+
ActiveRecord::Base.remove_connection
|
38
|
+
ActiveRecord::Base.should_not be_connected
|
39
|
+
subject.should be
|
40
|
+
ActiveRecord::Base.should be_connected
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#search" do
|
44
|
+
before :each do Puppet::Rails.init end
|
45
|
+
|
46
|
+
def search(type, host = 'default.local', filter = nil)
|
47
|
+
args = { :host => host, :filter => filter }
|
48
|
+
subject.search(Puppet::Resource.indirection.request(:search, type, args))
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should fail if the type is not known to Puppet" do
|
52
|
+
expect { search("banana") }.to raise_error Puppet::Error, /Could not find type/
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should return an empty array if no resources match" do
|
56
|
+
search("exec").should == []
|
57
|
+
end
|
58
|
+
|
59
|
+
# Assert that this is a case-insensitive rule, too.
|
60
|
+
%w{and or AND OR And Or anD oR}.each do |op|
|
61
|
+
it "should fail if asked to search with #{op.inspect}" do
|
62
|
+
filter = [%w{tag == foo}, op, %w{title == bar}]
|
63
|
+
expect { search("notify", 'localhost', filter) }.
|
64
|
+
to raise_error Puppet::Error, /not supported/
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "with a matching resource" do
|
69
|
+
before :each do
|
70
|
+
host = Puppet::Rails::Host.create!(:name => 'one.local')
|
71
|
+
Puppet::Rails::Resource.
|
72
|
+
create!(:host => host,
|
73
|
+
:restype => 'exec', :title => 'whammo',
|
74
|
+
:exported => true)
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should return something responding to `to_resource` if a resource matches" do
|
79
|
+
found = search("exec")
|
80
|
+
found.length.should == 1
|
81
|
+
found.map do |item|
|
82
|
+
item.should respond_to :to_resource
|
83
|
+
item.restype.should == "exec"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should not filter resources that have been found before" do
|
88
|
+
search("exec").should == search("exec")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "#build_active_record_query" do
|
94
|
+
before :each do
|
95
|
+
Puppet::Rails.init
|
96
|
+
end
|
97
|
+
|
98
|
+
let :type do
|
99
|
+
Puppet::Type.type('notify').name
|
100
|
+
end
|
101
|
+
|
102
|
+
def query(type, host, filter = nil)
|
103
|
+
subject.send :build_active_record_query, type, host, filter
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should exclude all database resources from the host" do
|
107
|
+
host = Puppet::Rails::Host.create! :name => 'one.local'
|
108
|
+
got = query(type, host.name)
|
109
|
+
got.keys.should =~ [:conditions]
|
110
|
+
got[:conditions][0] =~ /\(host_id != \?\)/
|
111
|
+
got[:conditions].last.should == host.id
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should join appropriately when filtering on parameters" do
|
115
|
+
filter = %w{propname == propval}
|
116
|
+
got = query(type, 'whatever', filter)
|
117
|
+
got.keys.should =~ [:conditions, :joins]
|
118
|
+
got[:joins].should == { :param_values => :param_name }
|
119
|
+
got[:conditions][0].should =~ /param_names\.name = \?/
|
120
|
+
got[:conditions][0].should =~ /param_values\.value = \?/
|
121
|
+
got[:conditions].should be_include filter.first
|
122
|
+
got[:conditions].should be_include filter.last
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should join appropriately when filtering on tags" do
|
126
|
+
filter = %w{tag == test}
|
127
|
+
got = query(type, 'whatever', filter)
|
128
|
+
got.keys.should =~ [:conditions, :joins]
|
129
|
+
got[:joins].should == {:resource_tags => :puppet_tag}
|
130
|
+
got[:conditions].first.should =~ /puppet_tags/
|
131
|
+
got[:conditions].should_not be_include filter.first
|
132
|
+
got[:conditions].should be_include filter.last
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should only search for exported resources with the matching type" do
|
136
|
+
got = query(type, 'whatever')
|
137
|
+
got.keys.should =~ [:conditions]
|
138
|
+
got[:conditions][0].should be_include "(exported=? AND restype=?)"
|
139
|
+
got[:conditions][1].should == true
|
140
|
+
got[:conditions][2].should == type.to_s
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "#filter_to_active_record" do
|
145
|
+
def filter_to_active_record(input)
|
146
|
+
subject.send :filter_to_active_record, input
|
147
|
+
end
|
148
|
+
|
149
|
+
[nil, '', 'whatever', 12].each do |input|
|
150
|
+
it "should fail if filter is not an array (with #{input.inspect})" do
|
151
|
+
expect { filter_to_active_record(input) }.
|
152
|
+
to raise_error ArgumentError, /must be arrays/
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Not exhaustive, just indicative.
|
157
|
+
['=', '<>', '=~', '+', '-', '!'].each do |input|
|
158
|
+
it "should fail with unexpected comparison operators (with #{input.inspect})" do
|
159
|
+
expect { filter_to_active_record(["one", input, "two"]) }.
|
160
|
+
to raise_error ArgumentError, /unknown operator/
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
{
|
165
|
+
["title", "==", "whatever"] => ["title = ?", ["whatever"]],
|
166
|
+
["title", "!=", "whatever"] => ["title != ?", ["whatever"]],
|
167
|
+
|
168
|
+
# Technically, these are not supported by Puppet yet, but as we pay
|
169
|
+
# approximately zero cost other than a few minutes writing the tests,
|
170
|
+
# and it would be *harder* to fail on them, nested queries.
|
171
|
+
[["title", "==", "foo"], "or", ["title", "==", "bar"]] =>
|
172
|
+
["(title = ?) OR (title = ?)", ["foo", "bar"]],
|
173
|
+
|
174
|
+
[["title", "==", "foo"], "or", ["tag", "==", "bar"]] =>
|
175
|
+
["(title = ?) OR (puppet_tags.name = ?)", ["foo", "bar"]],
|
176
|
+
|
177
|
+
[["title", "==", "foo"], "or", ["param", "==", "bar"]] =>
|
178
|
+
["(title = ?) OR (param_names.name = ? AND param_values.value = ?)",
|
179
|
+
["foo", "param", "bar"]],
|
180
|
+
|
181
|
+
[[["title","==","foo"],"or",["tag", "==", "bar"]],"and",["param","!=","baz"]] =>
|
182
|
+
["((title = ?) OR (puppet_tags.name = ?)) AND "+
|
183
|
+
"(param_names.name = ? AND param_values.value != ?)",
|
184
|
+
["foo", "bar", "param", "baz"]]
|
185
|
+
|
186
|
+
}.each do |input, expect|
|
187
|
+
it "should map #{input.inspect} to #{expect.inspect}" do
|
188
|
+
filter_to_active_record(input).should == expect
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/resource'
|
4
|
+
require 'puppet/indirector/memory'
|
5
|
+
require 'puppet/indirector/resource/store_configs'
|
6
|
+
|
7
|
+
class Puppet::Resource::StoreConfigsTesting < Puppet::Indirector::Memory
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Puppet::Resource::StoreConfigs do
|
11
|
+
it_should_behave_like "a StoreConfigs terminus"
|
12
|
+
end
|
@@ -25,7 +25,7 @@ describe Puppet::Indirector::ResourceType::Parser do
|
|
25
25
|
@terminus.find(@request).should == type
|
26
26
|
end
|
27
27
|
|
28
|
-
it "should attempt to load the type if none is found in memory" do
|
28
|
+
it "should attempt to load the type if none is found in memory", :fails_on_windows => true do
|
29
29
|
dir = tmpdir("find_a_type")
|
30
30
|
FileUtils.mkdir_p(dir)
|
31
31
|
Puppet[:modulepath] = dir
|
@@ -122,13 +122,13 @@ describe Puppet::Indirector::ResourceType::Parser do
|
|
122
122
|
@terminus.search(@request).should be_nil
|
123
123
|
end
|
124
124
|
|
125
|
-
it "should load all resource types from all search paths" do
|
125
|
+
it "should load all resource types from all search paths", :fails_on_windows => true do
|
126
126
|
dir = tmpdir("searching_in_all")
|
127
127
|
first = File.join(dir, "first")
|
128
128
|
second = File.join(dir, "second")
|
129
129
|
FileUtils.mkdir_p(first)
|
130
130
|
FileUtils.mkdir_p(second)
|
131
|
-
Puppet[:modulepath] = "#{first}
|
131
|
+
Puppet[:modulepath] = "#{first}#{File::PATH_SEPARATOR}#{second}"
|
132
132
|
|
133
133
|
# Make a new request, since we've reset the env
|
134
134
|
@request = Puppet::Indirector::Request.new(:resource_type, :search, "*")
|
@@ -1,13 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
3
|
-
# Created by Luke Kanies on 2008-3-10.
|
4
|
-
# Copyright (c) 2007. All rights reserved.
|
5
|
-
|
6
2
|
require 'spec_helper'
|
7
3
|
|
8
4
|
require 'puppet/indirector/ssl_file'
|
9
5
|
|
10
6
|
describe Puppet::Indirector::SslFile do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
11
9
|
before :all do
|
12
10
|
@indirection = stub 'indirection', :name => :testing, :model => @model
|
13
11
|
Puppet::Indirector::Indirection.expects(:instance).with(:testing).returns(@indirection)
|
@@ -21,7 +19,7 @@ describe Puppet::Indirector::SslFile do
|
|
21
19
|
|
22
20
|
@setting = :certdir
|
23
21
|
@file_class.store_in @setting
|
24
|
-
@path = "/
|
22
|
+
@path = make_absolute("/thisdoesntexist/my_directory")
|
25
23
|
Puppet[:noop] = false
|
26
24
|
Puppet[@setting] = @path
|
27
25
|
Puppet[:trace] = false
|
@@ -45,7 +43,9 @@ describe Puppet::Indirector::SslFile do
|
|
45
43
|
it "should fail if no store directory or file location has been set" do
|
46
44
|
@file_class.store_in nil
|
47
45
|
@file_class.store_at nil
|
48
|
-
|
46
|
+
FileTest.expects(:exists?).with(File.dirname(@path)).at_least(0).returns(true)
|
47
|
+
Dir.stubs(:mkdir).with(@path)
|
48
|
+
lambda { @file_class.new }.should raise_error(Puppet::DevError, /No file or directory setting provided/)
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "when managing ssl files" do
|
@@ -88,6 +88,25 @@ describe Puppet::Indirector::SslFile do
|
|
88
88
|
it "should set them in the setting directory, with the certificate name plus '.pem', if a directory setting is available" do
|
89
89
|
@searcher.path(@cert.name).should == @certpath
|
90
90
|
end
|
91
|
+
|
92
|
+
['../foo', '..\\foo', './../foo', '.\\..\\foo',
|
93
|
+
'/foo', '//foo', '\\foo', '\\\\goo',
|
94
|
+
"test\0/../bar", "test\0\\..\\bar",
|
95
|
+
"..\\/bar", "/tmp/bar", "/tmp\\bar", "tmp\\bar",
|
96
|
+
" / bar", " /../ bar", " \\..\\ bar",
|
97
|
+
"c:\\foo", "c:/foo", "\\\\?\\UNC\\bar", "\\\\foo\\bar",
|
98
|
+
"\\\\?\\c:\\foo", "//?/UNC/bar", "//foo/bar",
|
99
|
+
"//?/c:/foo",
|
100
|
+
].each do |input|
|
101
|
+
it "should resist directory traversal attacks (#{input.inspect})" do
|
102
|
+
expect { @searcher.path(input) }.to raise_error
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# REVISIT: Should probably test MS-DOS reserved names here, too, since
|
107
|
+
# they would represent a vulnerability on a Win32 system, should we ever
|
108
|
+
# support that path. Don't forget that 'CON.foo' == 'CON'
|
109
|
+
# --daniel 2011-09-24
|
91
110
|
end
|
92
111
|
|
93
112
|
describe "when finding certificates on disk" do
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'puppet/indirector/store_configs'
|
5
|
+
|
6
|
+
describe Puppet::Indirector::StoreConfigs do
|
7
|
+
pending "REVISIT: creating an instance requires ludicrous amounts of stubbing, and there is relatively little to actually test here. What to do? Shared behaviours allow us to push down a lot of the testing into the implementation class tests anyhow..."
|
8
|
+
end
|
@@ -63,6 +63,20 @@ describe Puppet::Indirector::Yaml, " when choosing file location" do
|
|
63
63
|
it "should use the object's name to determine the file name" do
|
64
64
|
@store.path(:me).should =~ %r{me.yaml$}
|
65
65
|
end
|
66
|
+
|
67
|
+
['../foo', '..\\foo', './../foo', '.\\..\\foo',
|
68
|
+
'/foo', '//foo', '\\foo', '\\\\goo',
|
69
|
+
"test\0/../bar", "test\0\\..\\bar",
|
70
|
+
"..\\/bar", "/tmp/bar", "/tmp\\bar", "tmp\\bar",
|
71
|
+
" / bar", " /../ bar", " \\..\\ bar",
|
72
|
+
"c:\\foo", "c:/foo", "\\\\?\\UNC\\bar", "\\\\foo\\bar",
|
73
|
+
"\\\\?\\c:\\foo", "//?/UNC/bar", "//foo/bar",
|
74
|
+
"//?/c:/foo",
|
75
|
+
].each do |input|
|
76
|
+
it "should resist directory traversal attacks (#{input.inspect})" do
|
77
|
+
expect { @store.path(input) }.to raise_error
|
78
|
+
end
|
79
|
+
end
|
66
80
|
end
|
67
81
|
|
68
82
|
describe Puppet::Indirector::Yaml, " when storing objects as YAML" do
|
data/spec/unit/module_spec.rb
CHANGED
@@ -275,7 +275,7 @@ describe Puppet::Module do
|
|
275
275
|
|
276
276
|
FileUtils.mkdir_p(first)
|
277
277
|
FileUtils.mkdir_p(second)
|
278
|
-
Puppet[:modulepath] = "#{first}
|
278
|
+
Puppet[:modulepath] = "#{first}#{File::PATH_SEPARATOR}#{second}"
|
279
279
|
|
280
280
|
modpath = File.join(first, "foo")
|
281
281
|
FileUtils.mkdir_p(modpath)
|
@@ -294,7 +294,7 @@ describe Puppet::Module do
|
|
294
294
|
|
295
295
|
FileUtils.mkdir_p(first)
|
296
296
|
FileUtils.mkdir_p(second)
|
297
|
-
Puppet[:modulepath] = "#{first}
|
297
|
+
Puppet[:modulepath] = "#{first}#{File::PATH_SEPARATOR}#{second}"
|
298
298
|
|
299
299
|
modpath = File.join(second, "foo")
|
300
300
|
FileUtils.mkdir_p(modpath)
|
@@ -73,12 +73,12 @@ describe Puppet::Network::Handler::FileServer do
|
|
73
73
|
@mount.list("/no_such_file", false, false).should be(nil)
|
74
74
|
end
|
75
75
|
|
76
|
-
it "should list a symbolic link as a file when given the link path" do
|
76
|
+
it "should list a symbolic link as a file when given the link path", :unless => Puppet.features.microsoft_windows? do
|
77
77
|
File.symlink(@file, @link)
|
78
78
|
@mount.list("/aLink", false, false).should == [["/", "file"]]
|
79
79
|
end
|
80
80
|
|
81
|
-
it "should return nil for a dangling symbolic link when given the link path" do
|
81
|
+
it "should return nil for a dangling symbolic link when given the link path", :unless => Puppet.features.microsoft_windows? do
|
82
82
|
File.symlink("/some/where", @link)
|
83
83
|
@mount.list("/aLink", false, false).should be(nil)
|
84
84
|
end
|
@@ -138,18 +138,18 @@ describe Puppet::Network::Handler::FileServer do
|
|
138
138
|
list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
|
139
139
|
end
|
140
140
|
|
141
|
-
it "should list a valid symbolic link as a file when recursing base dir" do
|
141
|
+
it "should list a valid symbolic link as a file when recursing base dir", :unless => Puppet.features.microsoft_windows? do
|
142
142
|
File.symlink(@file, @link)
|
143
143
|
list = @mount.list("/", true, false)
|
144
144
|
list.sort.should == [ ["/", "directory"], ["/aFile", "file"], ["/aLink", "file"] ].sort
|
145
145
|
end
|
146
146
|
|
147
|
-
it "should not error when a dangling symlink is present" do
|
147
|
+
it "should not error when a dangling symlink is present", :unless => Puppet.features.microsoft_windows? do
|
148
148
|
File.symlink("/some/where", @link)
|
149
149
|
lambda { @mount.list("/", true, false) }.should_not raise_error
|
150
150
|
end
|
151
151
|
|
152
|
-
it "should return the directory contents of valid entries when a dangling symlink is present" do
|
152
|
+
it "should return the directory contents of valid entries when a dangling symlink is present", :unless => Puppet.features.microsoft_windows? do
|
153
153
|
File.symlink("/some/where", @link)
|
154
154
|
list = @mount.list("/", true, false)
|
155
155
|
list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ].sort
|
@@ -1,20 +1,16 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
3
|
-
# Created by Rick Bradley on 2007-10-15.
|
4
|
-
# Copyright (c) 2007. All rights reserved.
|
5
|
-
|
6
2
|
require 'spec_helper'
|
7
3
|
require 'puppet/network/handler'
|
8
4
|
require 'puppet/network/http'
|
9
5
|
require 'puppet/network/http/webrick'
|
10
6
|
|
11
|
-
describe Puppet::Network::HTTP::WEBrick, "after initializing" do
|
7
|
+
describe Puppet::Network::HTTP::WEBrick, "after initializing", :unless => Puppet.features.microsoft_windows? do
|
12
8
|
it "should not be listening" do
|
13
9
|
Puppet::Network::HTTP::WEBrick.new.should_not be_listening
|
14
10
|
end
|
15
11
|
end
|
16
12
|
|
17
|
-
describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do
|
13
|
+
describe Puppet::Network::HTTP::WEBrick, "when turning on listening", :unless => Puppet.features.microsoft_windows? do
|
18
14
|
before do
|
19
15
|
@mock_webrick = stub('webrick', :[] => {}, :listeners => [], :status => :Running)
|
20
16
|
[:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
|
@@ -143,7 +139,7 @@ describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do
|
|
143
139
|
end
|
144
140
|
|
145
141
|
|
146
|
-
describe Puppet::Network::HTTP::WEBrick, "when looking up the class to handle a protocol" do
|
142
|
+
describe Puppet::Network::HTTP::WEBrick, "when looking up the class to handle a protocol", :unless => Puppet.features.microsoft_windows? do
|
147
143
|
it "should require a protocol" do
|
148
144
|
lambda { Puppet::Network::HTTP::WEBrick.class_for_protocol }.should raise_error(ArgumentError)
|
149
145
|
end
|
@@ -161,7 +157,7 @@ describe Puppet::Network::HTTP::WEBrick, "when looking up the class to handle a
|
|
161
157
|
end
|
162
158
|
end
|
163
159
|
|
164
|
-
describe Puppet::Network::HTTP::WEBrick, "when turning off listening" do
|
160
|
+
describe Puppet::Network::HTTP::WEBrick, "when turning off listening", :unless => Puppet.features.microsoft_windows? do
|
165
161
|
before do
|
166
162
|
@mock_webrick = stub('webrick', :[] => {}, :listeners => [], :status => :Running)
|
167
163
|
[:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
|
@@ -188,7 +184,7 @@ describe Puppet::Network::HTTP::WEBrick, "when turning off listening" do
|
|
188
184
|
end
|
189
185
|
end
|
190
186
|
|
191
|
-
describe Puppet::Network::HTTP::WEBrick do
|
187
|
+
describe Puppet::Network::HTTP::WEBrick, :unless => Puppet.features.microsoft_windows? do
|
192
188
|
before do
|
193
189
|
@mock_webrick = stub('webrick', :[] => {})
|
194
190
|
[:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
|
@@ -1,22 +1,12 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
3
|
-
# Created by Luke Kanies on 2007-11-26.
|
4
|
-
# Copyright (c) 2007. All rights reserved.
|
5
|
-
|
6
2
|
require 'spec_helper'
|
7
3
|
require 'puppet/network/http_pool'
|
8
4
|
|
9
5
|
describe Puppet::Network::HttpPool do
|
10
6
|
after do
|
11
|
-
Puppet::Util::Cacher.expire
|
12
|
-
Puppet::Network::HttpPool.clear_http_instances
|
13
7
|
Puppet::Network::HttpPool.instance_variable_set("@ssl_host", nil)
|
14
8
|
end
|
15
9
|
|
16
|
-
it "should have keep-alive disabled" do
|
17
|
-
Puppet::Network::HttpPool::HTTP_KEEP_ALIVE.should be_false
|
18
|
-
end
|
19
|
-
|
20
10
|
it "should use the global SSL::Host instance to get its certificate information" do
|
21
11
|
host = mock 'host'
|
22
12
|
Puppet::SSL::Host.expects(:localhost).with.returns host
|
@@ -58,71 +48,10 @@ describe Puppet::Network::HttpPool do
|
|
58
48
|
Puppet::Network::HttpPool.http_instance("me", 54321).open_timeout.should == 120
|
59
49
|
end
|
60
50
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
it "should cache http instances" do
|
67
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
68
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
69
|
-
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should have a mechanism for getting a new http instance instead of the cached instance" do
|
73
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
74
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
75
|
-
Puppet::Network::HttpPool.http_instance("me", 54321, true).should_not equal(old)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should close existing, open connections when requesting a new connection" do
|
79
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
80
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
81
|
-
old.expects(:started?).returns(true)
|
82
|
-
old.expects(:finish)
|
83
|
-
Puppet::Network::HttpPool.http_instance("me", 54321, true)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should have a mechanism for clearing the http cache" do
|
87
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
88
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
89
|
-
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
|
90
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
91
|
-
Puppet::Network::HttpPool.clear_http_instances
|
92
|
-
Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should close open http connections when clearing the cache" do
|
96
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
97
|
-
one = Puppet::Network::HttpPool.http_instance("me", 54321)
|
98
|
-
one.expects(:started?).returns(true)
|
99
|
-
one.expects(:finish).returns(true)
|
100
|
-
Puppet::Network::HttpPool.clear_http_instances
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should not close unopened http connections when clearing the cache" do
|
104
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
105
|
-
one = Puppet::Network::HttpPool.http_instance("me", 54321)
|
106
|
-
one.expects(:started?).returns(false)
|
107
|
-
one.expects(:finish).never
|
108
|
-
Puppet::Network::HttpPool.clear_http_instances
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "and http keep-alive is disabled" do
|
113
|
-
before do
|
114
|
-
Puppet::Network::HttpPool.stubs(:keep_alive?).returns false
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should not cache http instances" do
|
118
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
119
|
-
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
120
|
-
Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
after do
|
125
|
-
Puppet::Network::HttpPool.clear_http_instances
|
51
|
+
it "should not cache http instances" do
|
52
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
53
|
+
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
54
|
+
Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
|
126
55
|
end
|
127
56
|
end
|
128
57
|
|