summaryrefslogtreecommitdiff
path: root/spec/integration/network
AgeCommit message (Collapse)AuthorFilesLines
2010-08-03[#4284] Fix failing specs run as root due to missing puppet groupNick Lewis1-0/+1
These specs 'use' some settings which create directories belonging to the 'service' user/group. If the default service group doesn't exist, these fail. This patch explicitly sets the service group to the gid of the process, which is known to be accessible by the user.
2010-07-09Code smell: Two space indentationMarkus Roberts5-222/+222
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
2010-07-09Code smell: Use string interpolationMarkus Roberts1-1/+1
* Replaced 83 occurances of (.*)" *[+] *([$@]?[\w_0-9.:]+?)(.to_s\b)?(?! *[*(%\w_0-9.:{\[]) with \1#{\2}" 3 Examples: The code: puts "PUPPET " + status + ": " + process + ", " + state becomes: puts "PUPPET " + status + ": " + process + ", #{state}" The code: puts "PUPPET " + status + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" The code: }.compact.join( "\n" ) + "\n" + t + "]\n" becomes: }.compact.join( "\n" ) + "\n#{t}" + "]\n" * Replaced 21 occurances of (.*)" *[+] *" with \1 3 Examples: The code: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}, #{state}" The code: puts "PUPPET #{status}" + ": #{process}, #{state}" becomes: puts "PUPPET #{status}: #{process}, #{state}" The code: res = self.class.name + ": #{@name}" + "\n" becomes: res = self.class.name + ": #{@name}\n" * Don't use string concatenation to split lines unless they would be very long. Replaced 11 occurances of (.*)(['"]) *[+] *(['"])(.*) with 3 Examples: The code: o.define_head "The check_puppet Nagios plug-in checks that specified " + "Puppet process is running and the state file is no " + becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + The code: o.separator "Mandatory arguments to long options are mandatory for " + "short options too." becomes: o.separator "Mandatory arguments to long options are mandatory for short options too." The code: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + "older than specified interval." becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no older than specified interval." * Replaced no occurances of do (.*?) end with {\1} * Replaced 1488 occurances of "([^"\n]*%s[^"\n]*)" *% *(.+?)(?=$| *\b(do|if|while|until|unless|#)\b) with 20 Examples: The code: args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") becomes: args[0].split(/\./).map do |s| "dc=#{s}" end.join(",") The code: puts "%s" % Puppet.version becomes: puts "#{Puppet.version}" The code: raise "Could not find information for %s" % node becomes: raise "Could not find information for #{node}" The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file" The code: Puppet.err "Could not run %s: %s" % [client_class, detail] becomes: Puppet.err "Could not run #{client_class}: #{detail}" The code: raise "Could not find handler for %s" % arg becomes: raise "Could not find handler for #{arg}" The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}" The code: raise Puppet::Error, "Could not deserialize catalog from pson: %s" % detail becomes: raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}" The code: raise "Could not find facts for %s" % Puppet[:certname] becomes: raise "Could not find facts for #{Puppet[:certname]}" The code: raise ArgumentError, "%s is not readable" % path becomes: raise ArgumentError, "#{path} is not readable" The code: raise ArgumentError, "Invalid handler %s" % name becomes: raise ArgumentError, "Invalid handler #{name}" The code: debug "Executing '%s' in zone %s with '%s'" % [command, @resource[:name], str] becomes: debug "Executing '#{command}' in zone #{@resource[:name]} with '#{str}'" The code: raise Puppet::Error, "unknown cert type '%s'" % hash[:type] becomes: raise Puppet::Error, "unknown cert type '#{hash[:type]}'" The code: Puppet.info "Creating a new certificate request for %s" % Puppet[:certname] becomes: Puppet.info "Creating a new certificate request for #{Puppet[:certname]}" The code: "Cannot create alias %s: object already exists" % [name] becomes: "Cannot create alias #{name}: object already exists" The code: return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum] becomes: return "replacing from source #{metadata.source} with contents #{metadata.checksum}" The code: it "should have a %s parameter" % param do becomes: it "should have a #{param} parameter" do The code: describe "when registring '%s' messages" % log do becomes: describe "when registring '#{log}' messages" do The code: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l } becomes: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration#{l}test" } The code: assert_raise(Puppet::Error, "Check '%s' did not fail on false" % check) do becomes: assert_raise(Puppet::Error, "Check '#{check}' did not fail on false") do
2010-07-06[#4136] Specs should listen on localhostJesse Wolfe1-5/+4
This patch prevents specs from opening IP ports to the world. Some specs had to be adjusted to unset this setting so they could test the non-spec default value.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts5-0/+0
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
2010-02-17Feature #3383 Part 2: Remove RAL XMLRPCJesse Wolfe2-2/+2
The XMLRPC interface for RAL resources was broken, and has been completely replaced by the REST interface. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
2010-02-17Feature #3347 REST-ified FileBucketJesse Wolfe1-1/+1
FileBucket Files have been reimplemented as an indirector terminus so that they can be transmitted over REST. The old Network::Client.dipper has been replaced with a compatibility later in FileBucket::Dipper that uses the indirector to access filebucket termini. Slightly revised patch: * No longer allows nil contents in FileBucket outside of initialization * Uses File.exist? instead of the deprecated File.exists? * Tweaks JSON serialization and de-serialization to include "path" Deferred issues: * Feature #3371 "FileBucket should not keep files in memory". * Feature #3372 "Replace FileBucket Dipper with more idiomatic calls"
2009-10-17Bundling of pure ruby json lib as "pson"0.25.1rc2Markus Roberts1-36/+36
Bundeling and renaming the pure ruby json library to addresses a number of cross version serliaization bugs (#2615, et al). This patch adds a subset of the files from the json_pure gem to lib/puppet/external/pson (renamed to avoid conflicts with rails) so that we will always have a known-good erialization format available. The pure ruby json gem as distibuted defers to the compiled version if it is installed. This is problematic in some circumstances so the files that have been brought over have been modified to always and only use the bundled version. It's a large patch, so here's a breakdown of the change categories: The majority of the lines are only marginally interesting: * The json lib itself (in lib/puppet/external/pson) make up the bulk of the lines. * Renaming of json to pson make up the second largest group. Somewhat more interesting are the following, which can be located by searching the diffs for the indicated strings: * Adjusting tests to reflect the changes * Changing the encoding/decoding behavior so that nested structures (e.g. resources) don't serialize as escaped strings. This should make it much easier to process the results with external tools, if needed. Search for "to_pson" and "to_pson_data_hash" * Cleaning up the envelope/metadata * Now provides a document_type (as opposed to a ruby class name) by using a symple registration scheme instead of constant lookup (search for "document_type") * Added an api_version (search for "api_version") * Added a hash for document metadata (search for "metadata") * Removing the yaml monkeypatch and instead disabling yaml serialization on ruby 1.8.1 in favor of pson (search for "yaml") * Cleaning up the json/rails feature interaction (they're now totally independent) (search for "feature")
2009-08-10Fixing more tests broken from missing librariesLuke Kanies1-1/+5
Signed-off-by: Luke Kanies <luke@madstop.com>
2009-08-03Fixes #2444 - Various JSON test failuresMarkus Roberts1-3/+17
2009-08-02Migrating Handler base tests from test/ to spec/Luke Kanies1-0/+25
Signed-off-by: Luke Kanies <luke@madstop.com>
2009-08-02Migrating tests to spec and removing an obsolete testLuke Kanies1-0/+19
Signed-off-by: Luke Kanies <luke@madstop.com>
2009-06-06Adding a JSON formatLuke Kanies1-0/+73
Also making some log messages more informative.
2009-06-06Removed extra whitespace from end of linesIan Taylor2-16/+16
2009-05-15Fixing #2234 - fixing all of the tests broken by my bindaddress fixLuke Kanies2-2/+36
Signed-off-by: Luke Kanies <luke@madstop.com>
2008-12-18Renaming Puppet::Node::Catalog to Puppet::Resource::CatalogLuke Kanies1-1/+1
Signed-off-by: Luke Kanies <luke@madstop.com>
2008-11-11Changing the Cacher.invalidate method to Cacher.expire.Luke Kanies1-1/+1
Signed-off-by: Luke Kanies <luke@madstop.com>
2008-08-20Fixing the String format (fixes #1522).Luke Kanies1-0/+19
The string format no longer provides any support methods, which means that I had to create to_multiple_s and from_multiple_s methods on the SSL classes. I created them in the base class and tested them just in the cert class. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-06-14Merge branch '0.24.x'Luke Kanies2-39/+41
Also added the fixes to make the certhandler tests pass even when certs exist; I'll deal with the conflict later. Conflicts: CHANGELOG bin/puppetd lib/puppet/network/http/handler.rb lib/puppet/network/http/mongrel/rest.rb spec/integration/indirector/rest.rb spec/integration/network/server/mongrel.rb spec/integration/network/server/webrick.rb spec/unit/network/http/webrick.rb
2008-06-13Replacing all two-space indents with four-spaceLuke Kanies2-74/+74
2008-06-13Adding ruby interpreter lines to the tests missing them.Luke Kanies2-2/+6
2008-06-13Adding execute bits to every test currently missing them.Luke Kanies2-0/+0
2008-05-13Using the new Cacher class for handling cached data.Luke Kanies1-4/+1
This provides a single, global bit for determining whether a given piece of cached data is still valid.
2008-05-07The master and client now successfully speak xmlrpc using the new system.Luke Kanies1-0/+2
The server is actually serving REST, but the client can't use it until we resolve the format and security issues that REST hasn't yet tackled.
2008-05-05Fixing the webrick integration tests to use the newly-functionalLuke Kanies1-1/+7
SSL code.
2008-05-02Adding xmlrpc backward compatibility to the new Mongrel code.Luke Kanies1-1/+1
2008-05-02Adding xmlrpc support to webrick.Luke Kanies2-1/+3
This provides the backward compatibility for webrick, and only Mongrel is left.
2008-04-28I think I've now got the Webrick SSL support working.Luke Kanies1-0/+1
Now I just need to get xmlrpc working alongside REST in both mongrel and webrick.
2008-04-28Interim commit, since I want to work but have no network available.Luke Kanies1-43/+55
2008-04-17The certificate authority now uses a Host instance named 'ca'.Luke Kanies1-1/+1
It previously was a subclass of Host, but this should make it easier to separate between the thing doing the signing and the thing managing the necessary files.
2008-04-15Oops; final fix on the integration test failures resultingLuke Kanies1-1/+5
from my partial support for ssl in webrick.
2008-04-11ensure that we only run the mongrel specs when mongrel is available as a featureRick Bradley1-0/+2
2008-04-11Much larger commit than I would like to land at once. This is all ↵Rick Bradley2-40/+45
REST-related code. Two specs are failing related to how Mongrel is initialized for REST; will fix those shortly. REST indirector now supports find, with deserialization. Network code in indirector now. Will still need to un-hardwire address/port for outbound connections. Will still need to urlencode path parameters. Code for search, destroy, update is coming, should be similar to find. Reworked how the Handler module is used. Needed to be included, rather than inherited. Needed to sidestep initializers for actual web servers (webrick, mongrel), needed to be possible to have handler-including class be used as a class (aka servlet) instead of as an instance. Webrick handler registration is now abstracted to "above" the servlet. Provided a #model method to use instead of @model in handler module. This allows neutering during testing. Brought class_for_protocol up into http/webrick class as a (tested) class method. Integration tests for rest indirection. Split server integration tests into mongrel and webrick tests. Got Node/REST working properly wrt the crazy-ass autoloader thing. We're now actually passing traffic w/ webrick, fwiw.
2008-04-11This is the first version where mongrel and webrick are reliably startable ↵Rick Bradley1-0/+85
and stoppable via Puppet::Network::Server. Added a network/server integration spec, testing startup, shutdown, reachability, and collision of webrick and mongrel servers in the new network code. Converted Puppet::Network::HTTP::Handler class to a module, as mongrel Handler should be subclassed; converting subclasses to include the module instead. Mongrel will actually stop if you .stop it, graceful_shutdown didn't seem quite so reliable. Webrick requires running in its own Thread to avoid hanging the entire process; this requires introduction of a Mutex to make things safe. We're only supporting the REST protocol. Made this explicit. Fixed http server setup args, w/ specs, ah the glory of integration testing.