summaryrefslogtreecommitdiff
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
* Add an apt_repository resourcetm/apt_repositoryThom May2016-04-082-0/+212
| | | | | More or less stolen from the apt cookbook, but tweaked and fixes a heap of bugs.
* Make notifications recursive.lcg/notify-scopesLamont Granquist2016-04-041-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to poise's approach but has a few differences. Similarly to poise, the base behavior of notifications and find() and lookup() on the resource collection is changed to be 'recursive' and to search in outer contexts for resources and will return them by default. There are find_local() and lookup_local() methods added to allow for bypassing the recursion and making sure to throw exceptions if the current run_context does not have any matching resources. The CHEF-3694 resource cloning code has been modified to call the lookup_local() API and not to be recursive because we believe that nobody in their right mind would want that behavior (and resource cloning should eventually be removed). So the behavior of resource cloning should remain unchanged. The behavior of delayed notifications to resources outside of the current run_context is slightly different than what Poise has been implementing. The delayed notification will run in the run_context of the resource that is being notified. I think Poise tends to bubble up to the nextmost wrapping resource context (as opposed to Poise's subcontext_block or notifying_block contexts). This code I think is conceptually simpler to reason about, and I think it gets the use case right where if you're notifying a service resource in the outermost run_context from within multiple wrapping resources that it correctly bubbles out to the outermost run context and will notify with all the other delayed notifications at the end of the chef client run. Another useful feature of the delayed notification behavior is that if we do implement notifying_block or subcontext_block that each block can get its own delayed notification run and any resources that are inside of that block can run in the delayed notification phase of that block (while still being able to notify resources outside of the block and having those delayed notifications run in the receiving resources run_context). This will let us implement an often-requested feature for having "notifications delayed to the end of a block/recipe" instead of having to do all notifications absolutely immediately or delayed to the end of the chef run. This code also cleans up the object model a little bit. All of the state about notification collection is now hanging off of the run_context -- the delayed_actions have been moved from the Chef::Runner to the Chef::RunContext. Hanging it off of the Chef::Runner would have been very difficult to 'target' from other run_context's without adding a pointer back from the RunContext to the Runner and that feels like the wrong object model. The RunContext is now responsible for all of its notification state, while the Runner is responsible for wiring up the notifications across different run_contexts. Note that it will not be possible to send a notification to a run_context which has already been converged. That seems to make sense to me and the search API on the resource collection does not support returning resources from run_contexts that are children, only parents (and we don't actually hold onto pointers to child run_contexts and they may be garbage collected).
* Revert "Spec break on Windows due to temp dir and short path names"Salim Alam2016-03-312-2/+2
| | | | This reverts commit e25b75e9fcd26ccc9c9094a43b614306de1047db.
* Merge pull request #4775 from chef/cd/mount-remount-optionsBryan McLellan2016-03-314-41/+1
|\ | | | | Revert PR #1796: make mount resource options-ignorant again.
| * Revert PR #1796.cd/mount-remount-optionsChris Doherty2016-03-314-41/+1
| | | | | | | | | | Closes issue #4056, although as discussed in that issue, we still need followup design and implementation work to make the mount resource behave in a safe and unsurprising way.
* | Spec break on Windows due to temp dir and short path namesadamedx/windows-ruby22-unit-tmpdirAdam Edwards2016-03-312-2/+2
|/
* Merge pull request #4757 from tas50/better_mdLamont Granquist2016-03-311-48/+48
|\ | | | | Improve the docs generated by knife cookbook create
| * Chef the specsTim Smith2016-03-261-48/+48
| |
* | Merge pull request #4767 from chef/salam/timeoutSalim Alam2016-03-301-0/+17
|\ \ | | | | | | Add option to set knife ssh timeout
| * | Add option to set ssh timeoutsalam/timeoutSalim Alam2016-03-291-0/+17
| | |
* | | Add optional integer argument for --daemonize optionJordan Running2016-03-291-64/+124
| | |
* | | Add shorthand :syslog and :win_evt for log_location configjr/logger-configJordan Running2016-03-291-0/+27
| |/ |/|
* | supresses parser gem errorsLamont Granquist2016-03-253-6/+6
|/ | | | | | see https://github.com/whitequark/parser/issues/283 if rubocop works around this bug then we can revert this patch.
* Merge pull request #4744 from chef/salam/subversion-fixSalim Alam2016-03-231-14/+68
|\ | | | | Subversion provider should respect proxies
| * Subversion provider should respect proxiesSalim Alam2016-03-221-14/+68
| |
* | Merge pull request #4670 from tas50/knife_wording-3Tim Smith2016-03-232-3/+3
|\ \ | |/ |/| Improve wording in Knife
| * Fix failing specsTim Smith2016-03-062-3/+3
| |
* | Merge pull request #4732 from chef/lcg/use-inline-resources-coreLamont Granquist2016-03-222-11/+11
|\ \ | | | | | | allow use_inline_resources for core chef providers
| * | allow use_inline_resources for core chef providersLamont Granquist2016-03-212-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * removes the DSL from InlineResources class * ActionClass is now responsible for mixing the DSL into action classes * apt_update provider converted over to use new syntax - does not need to mixin DeclareResource DSL - declares use_inline_resources - uses declare_resource instead of build_resource - converts def action_stuff to action :stuff - uses an execute resource instead of shell_out! - does not need the converge_by to update the action
* | | Fix proxified socketSalim Alam2016-03-211-3/+6
| | |
* | | Update config specSalim Alam2016-03-211-1/+1
|/ /
* | Update launchd spec for doctype changedanielsdeleo2016-03-211-1/+1
| |
* | Merge pull request #4348 from chef/nls/proxy-cleanupChris Doherty2016-03-183-152/+69
|\ \ | | | | | | Make handling of proxies more consistent
| * | Rubocop.Chris Doherty2016-03-171-4/+4
| | |
| * | Make handling of proxies more consistentNathan L Smith2016-03-173-154/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Always use `*_proxy` environment variables. * Make a `ChefConfig::Config.proxy_uri` method that gets used by `Chef::Provider::RemoteFile::FTP` and `Chef::HTTP::BasicClient`. * Remove `env` method from `Chef::HTTP::BasicClient` (using `stub_const("ENV", ...)` in specs instead.) * Remove `http_proxy_user` and `http_proxy_pass` methods from `Chef::HTTP::BasicClient` (replaced by functionality in `ChefConfig`.)
* | | Merge pull request #4714 from chef/cd/log-platformJordan Running2016-03-181-0/+96
|\ \ \ | | | | | | | | Log platform along with client version and pid.
| * | | Log platform in pretty error outputcd/log-platformJordan Running2016-03-181-0/+96
| |/ /
* | | deprecate Chef::DSL::Recipe::FullDSLlcg/deprecate-fulldslLamont Granquist2016-03-161-3/+3
|/ / | | | | | | | | | | | | | | this module was created out of a bit of excessive paranoia instead of simply adding mixins that we always use with Chef::DSL::Recipe directly to Chef::DSL::Recipe. lets try and YAGNI this class and just add it directly. these modules are already injected into everyone's recipes and providers, so I can't imagine a huge amount of backcompat breaks.
* | lazy module inclusion into DSL moduleslcg/use-and-lazy-module-includeLamont Granquist2016-03-154-0/+142
| | | | | | | | | | | | Chef::DSL::Recipe::FullDSL.send(:include, MyModule) will now patch all its descendants that it has been included into (works the way actual inheritance works now).
* | Merge pull request #4658 from chef/tm/remote_file_download_progress11.9Thom May2016-03-152-0/+35
|\ \ | | | | | | Remote file download progress
| * | Enable progress output to be configuredtm/remote_file_download_progressThom May2016-03-042-0/+35
| | | | | | | | | | | | Add tests around progress output and tidy up
* | | chefstyle Style/AndOr fixesLamont Granquist2016-03-143-5/+5
| | | | | | | | | | | | | | | this is part of our informal style guide, lets make it formal since clearly its not getting followed very well.
* | | Update specSalim Alam2016-03-111-0/+12
| | |
* | | Merge pull request #4661 from davide125/systemd-userPhil Dibowitz2016-03-081-40/+66
|\ \ \ | | | | | | | | Extend service resource to support systemd user services
| * | | rubocop fixesDavide Cavalca2016-03-071-4/+4
| | | |
| * | | add a test for user servicesDavide Cavalca2016-03-041-8/+34
| | | |
| * | | Extend service resource to support systemd user servicesDavide Cavalca2016-03-031-36/+36
| | | |
* | | | preferred_manifest_record: fix pretty print.David Duponchel2016-03-071-1/+24
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `preferred_manifest_record` function pretty prints the list of existing files when the asked file can't be found. To do that, the root path of the cookbook is removed from each existing file but the update is done on the `existing_files` variable, not on a copy. When called several times, this variable will eventually be equals to `[nil]`, leading to a NoMethodError. Without the fix, the new unit test fails with > expected Chef::Exceptions::FileNotFound, got #<NoMethodError: undefined method `[]' for nil:NilClass> with backtrace: > # ./lib/chef/cookbook_version.rb:321:in `block in preferred_manifest_record' > # ./lib/chef/cookbook_version.rb:319:in `map!' > # ./lib/chef/cookbook_version.rb:319:in `preferred_manifest_record' > # ./spec/unit/cookbook_version_file_specificity_spec.rb:318:in `block (3 levels) in <top (required)>' > # ./spec/unit/cookbook_version_file_specificity_spec.rb:317:in `block (2 levels) in <top (required)>' Fixes #2561.
* | | Merge pull request #4617 from chef/lcg/chefstyle-perfLamont Granquist2016-03-045-8/+8
|\ \ \ | | | | | | | | Autofixing new Perf cops in 0.37.2
| * | | remove unused block argumentslcg/chefstyle-perfLamont Granquist2016-02-232-2/+2
| | | |
| * | | Autofixing new Perf cops in 0.37.2Lamont Granquist2016-02-234-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6 Performance/Casecmp 18 Performance/Detect 1 Performance/RangeInclude 27 Performance/RedundantBlockCall 6 Performance/RedundantMatch 5 Performance/RedundantMerge 18 Performance/StringReplacement
* | | | Adding specs for rehash updatetyler-ball2016-03-043-0/+29
| | | |
* | | | Merge pull request #4663 from chef/lcg/better-chef-rspec-constraintsLamont Granquist2016-03-048-12/+12
|\ \ \ \ | | | | | | | | | | better chef+ruby rspec constraints
| * | | | better chef+ruby rspec constraintsLamont Granquist2016-03-038-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lets us use Gem::Dependency constraints directly as rspec constraints for matching Chef::Version and RUBY_VERSION. copies some magic sauce from bundler that does something similar
* | | | | Merge pull request #4664 from chef/salam/databag-fixThom May2016-03-041-2/+55
|\ \ \ \ \ | | | | | | | | | | | | Data bag item hash can have name key
| * | | | | Data bag item hash can have name keysalam/databag-fixSalim Alam2016-03-031-2/+55
| |/ / / /
* | | | | Merge pull request #4478 from chef/lcg/rfc-060-gem-metadataLamont Granquist2016-03-032-1/+31
|\ \ \ \ \ | |/ / / / |/| | | | RFC-060 gem metadata MVP
| * | | | add some metadata specs around 'gem' methodLamont Granquist2016-02-091-0/+27
| | | | |
| * | | | fix broken specsLamont Granquist2016-02-092-1/+4
| | | | |
* | | | | Merge pull request #4655 from coderanger/solobagNoah Kantrowitz2016-03-031-0/+5
|\ \ \ \ \ | |_|_|/ / |/| | | | Clearer exception for loading non-existent data bag items in solo mode.