summaryrefslogtreecommitdiff
path: root/spec/unit/file_bucket/file_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-08-15(PUP-1044) Make FileBucket::File use a local file whenever possibleHenrik Lindberg1-2/+2
2014-04-28(maint) replace `using_checksums_describe` with `with_digest_algorithms`Adrien Thebo1-12/+14
2014-04-28(maint) Remove redundant and useless testsAndrew Parker1-62/+6
Some of these tests were preserved simply because they are there. On closer inspection many were not needed because either they tested functionality that simply doesn't exist (and it isn't very useful to state that the functionality doesn't exist), stated the condition incorrectly and misleadingly, or are handled in other places.
2014-04-28(PUP-1840) Remove use of "use"Andrew Parker1-12/+0
Puppet.settings.use isn't needed in these areas of code and we can rely on the setting having a value. Also by putting the validation on the setting itself no other areas need to validate it.
2014-04-28(PUP-1840) Use configured digest_algorithm as default checksum_type for file ↵Jared Jennings1-0/+1
resources Without this patch, file resources will always try to checksum themselves using MD5. On FIPS 140-2 compliant hosts, this will fail. This patch adds sha256 as a permissible value for the File resource's checksum parameter, and makes the checksum parameter default to using the digest_algorithm, as set in the puppet.conf.
2014-04-28(PUP-1840) Respect digest algorithm in filebucket fileAdrien Thebo1-46/+59
Original code implemented by Jared Jennings <jared.jennings.ctr@us.af.mil>
2013-09-19(#22608) Restore the ability for master to accept pson file backupsJosh Cooper1-13/+19
Commit 769dcdf for #22375 removed the ability for newer masters to accept pson encoded file backups from older agents. This commit ensures that masters can deserialize `s` or `pson` encoded file backups, while agents will serialize using `s` by default. It also restores the ability to serialize to pson, but adds a deprecation warning if that happens. Since pson is not the `default_format` the agent will never serialize file bucket files to pson.
2013-09-03(#22375) Prefer raw-like serialization formatJosh Cooper1-3/+19
Previously, agents would backup files using PSON serialization, which is not reliable for binary content, and incredibly inefficient due to the applying a regexp to the entire in-memory file content. Ideally, I would like to switch the Puppet::FileBucket::File class to just use the `:raw` serialization format as is done for Puppet::FileServing::Content. But this cannot be done in a minor series without breaking compatibility between newer 3.x agents talking to older 3.x masters. However, we can achieve the same effect by using the `:s` serialization format, and we don't have the same compatibility problem because the `from_s` method has been defined since 2.6.0 in commit e5a78009f. If a newer master receives a file bucket request from an older agent that sends a PSON encoded file, then the master will generate a deprecation warning to update the agent. Originally filed as #8229.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2011-11-01(#9983) Use binary mode when reading and writing FileBucketFilesJosh Cooper1-28/+22
Previously, the Puppet::FileBucketFile terminus used text mode in its save and find methods. It also used text mode when validating that a file that it was asked to save matched what was already in the file bucket. This commit changes these methods to use binary mode, which is a noop on Unix.
2011-08-19Clarify logic and error messages when initializing Puppet::FileBucket::FileJacob Helwig1-3/+9
Rather than stating the logic as 'if !thing', the two checks done when initializing a new Puppet::FileBucket::File are now phrased as 'unless thing', which should lessen the likelihood of overlooking the '!'. We also now provide a reason for the ArgumentError being raised, which should help users of Puppet::FileBucket::File quickly figure out what is the problem when these exceptions are raised. In addition to updating the tests to look for these new error messages, we update the existing tests to specify which type of exception, and what message it should have, when something is raised. Reviewed-by: Nick Lewis <nick@puppetlabs.com> (cherry picked from commit b4cacfd8f95577c514999b4dd6bcb7ad57e37207)
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-2/+1
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08maint: just require 'spec_helper', thanks rspec2Daniel Pittman1-1/+1
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-03-07Merge branch '2.6.next' into nextMatt Robinson1-35/+0
This was a particularly nasty merge, so rather than hold up merges into next any longer, I'm going to push this merge with a few outstanding problems. The tests that were failing in the following areas have been marked pending, and will be addressed separately, immediately following this push. TODO: Verify that brice's rdoc change is still valid: tests to show that line numbers from class, define and node get into the ast Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb * 2.6.next: (85 commits) (#5148) Fix failing spec due to timezone (#5148) Add support for PSON to facts (#6338) Remove inventory indirection, and move to facts indirection (#6445) Fix inline docs: puppet agent does not accept --mkusers Update CHANGELOG and version for 2.6.6rc1 (#6541) Fix content with checksum truncation bug (#6418) Recursive files shouldn't be audited (#6541) maint: whitespace cleanup on the file integration spec (#6541) Fix content with checksum truncation bug (#5466) Write specs for output of puppet resource (#5466) Monkey patch Symbol so that you can sort them (#5466) Fixed puppet resource bug with trailing , Update CHANGELOG for 2.6.5 (#4922) Don't truncate remotely-sourced files on 404 (#6338) Remove unused version control tags Maint: Align tabs in a code block in the Augeas type. (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type Maint: Rewrite comments about symlinks to reflect best practice. (#6509) Inline docs: Fix broken lists in Launchd provider. (#6509) Inline docs: Fix broken code blocks in zpool type ... Manually Resolved Conflicts: lib/puppet/application/inspect.rb lib/puppet/defaults.rb lib/puppet/file_bucket/dipper.rb lib/puppet/network/http/handler.rb lib/puppet/node/facts.rb lib/puppet/parser/parser.rb lib/puppet/parser/parser_support.rb lib/puppet/util/command_line/puppet lib/puppet/util/command_line/puppetd lib/puppet/util/command_line/puppetmasterd lib/puppet/util/monkey_patches.rb lib/puppet/util/rdoc/parser.rb spec/unit/application/agent_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector/file_bucket_file/file_spec.rb spec/unit/network/http/handler_spec.rb spec/unit/parser/parser_spec.rb spec/unit/provider/mount/parsed_spec.rb
2011-02-21(#6353) Restore the ability to store paths in the filebucketPaul Berry1-35/+0
Commit 2274d5104f6e413a2b8899a3c3111a17bbb2f4d7 optimized network usage for the case where a file is already in the filebucket. However, it took away the ability to store paths. This change restores the ability to store paths while maintaining optimal network usage for the case where the file is already in the filebucket with the given path. This is expected to be the most common case. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
2011-01-19Merge branch '2.6.x' into nextMatt Robinson1-94/+14
* 2.6.x: (21 commits) (#5900) Include ResourceStatus#failed in serialized reports (#5882) Added error-handling for bucketing files in puppet inspect (#5882) Added error-handling to puppet inspect when auditing (#5171) Made "puppet inspect" upload audited files to a file bucket Prep for #5171: Added a missing require to inspect application. Locked Puppet license to GPLv2 (#5838) Support paths as part of file bucket requests. (#5838) Improve the quality of file bucket specs. (#5838) Make file bucket dipper efficient when saving a file that already exists (#5838) Implemented the "head" method for FileBucketFile::File terminus. (#5838) Reworked file dipper spec to perform less stubbing. (#5838) Added support for HEAD requests to the indirector. (#5838) Refactored error handling logic into find_in_cache. (#5838) Refactored Puppet::Network::Rights#fail_on_deny maint: Remove unused Rakefile in spec directory (#5171) Made filebucket able to perform diffs (#5710) Removed unnecessary calls to insync? Prep for fixing #5710: Refactor stub provider in resource harness spec Maint: test partial resource failure maint: Inspect reports should have audited = true on events ... Manually Resolved Conflicts: lib/puppet/file_bucket/dipper.rb lib/puppet/indirector.rb lib/puppet/network/rest_authconfig.rb spec/unit/file_bucket/dipper_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector_spec.rb
2011-01-12(#5838) Implemented the "head" method for FileBucketFile::File terminus.Paul Berry1-94/+14
In order to do this it was necessary to refactor FileBucketFile to untangle responsibilities for computing paths, reading files, etc. In the process, removed speculative generalizations and unused functionality. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
2010-11-30Maint: Modified tests of indirector.save to call the indirection directly.Paul Berry1-5/+5
This change replaces calls to <model object>.save with calls to <model class>.indirection.save(<model object>). This makes the use of the indirector explicit rather than implicit so that it will be easier to search for all indirector call sites using grep. This is an intermediate refactor on the way towards allowing indirector calls to be explicitly routed to multiple termini. This patch affects tests only; the next patch will make the corresponding change to the code.
2010-11-29Maint: Refactor tests to use <class>.indirection.<method>Paul Berry1-12/+4
Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. This change affects tests only.
2010-07-09Code smell: Two space indentationMarkus Roberts1-167/+167
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-06-28[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts1-0/+230
Part 2 re-did the change on the spec files, which it shouldn't have.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts1-230/+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-06-23[#3994] rename the specs to have _spec.rb at the endMarkus Roberts1-0/+230
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