summaryrefslogtreecommitdiff
path: root/spec/unit/util/execution_stub_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
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.
2012-02-23Merge branch '2.7.x'Patrick Carlisle1-2/+1
* 2.7.x: (63 commits) Maint: Fix bad copy and paste (#12725) Fix puppet agent --listen on Windows (#11740) Wait on the handle from the PROCESS_INFORMATION structure (#12564) Stub CHILDSTATUS in all test cases, not just failure cases. Updating CHANGELOG and lib/puppet.rb for 2.7.11 (#12412) Mark symbolic file modes test as pending on Windows Symbolic file mode test fixes when no mode change happens. Fix spec ordering failure on environment Updating CHANGELOG and lib/puppet.rb for 2.7.11 Disable specs that use replace_file on Windows Disable replace_file on Windows Remove unnecessary fallbacks in change_{user,group} Document uid/gid-related methods in Puppet::Util Copy owner/group in replace_file (#12463) eliminate `secure_open` in favour of `replace_file` (#12460) use `replace_file` for the .k5login file (#12462) user_role_add: use `replace_file` for /etc/shadow (#12463) add secure `replace_file` to Puppet::Util (#12459) drop supplementary groups when permanently dropping UID (#12458) default to users primary group, not root, in `asuser` ... Conflicts: lib/puppet/application/queue.rb lib/puppet/provider/package/openbsd.rb lib/puppet/util.rb spec/unit/network/http/webrick_spec.rb spec/unit/util_spec.rb test/lib/puppettest/servertest.rb
2012-02-20(#11740) Wait on the handle from the PROCESS_INFORMATION structureJosh Cooper1-2/+1
Previously, the `Puppet::Util.execute` method was using `waitpid2` to wait for the child process to exit and retrieve its exit status. On Windows, this method (as implemented by the win32-process gem) opens a handle to the process with the given pid, and then calls `WaitForSingleObject` and `GetExitCodeProcess` on the process handle. However, the pid-to-handle lookup will raise an exception if the child process has exited. As a result there was a race condition whereby puppet could sometimes fail to retrieve the exit status of child processes. The normal way of getting the exit code for a child process on Windows is to use the child process handle contained in the `PROCESS_INFORMATION` structure returned by `CreateProcess`. This works regardless of whether the child process is currently executing or not. This commit reworks the `Puppet::Util.execute_windows` method to wait on the child process handle contained in the process information structure. This requires that we pass the `:close_handles => false` option to the win32-process gem so that it doesn't close the handles. This commit also re-enables tests that were previously being skipped due to this bug.
2012-02-02(#12309) Refactor deprecated uses of Util.executecprice1-3/+3
* Improve logic of deprecation_warning * Add utility method for logging deprecation warnings to a file * Refactored all references of Puppet::Util.execute to call Puppet::Util::Execution.execute
2012-01-06(#11740) Disable failing test on WindowsJosh Cooper1-1/+2
Jenkins uncovered a race condition on Windows when a parent process tries to get the exit code of its child process. If the child exits before the parent calls OpenProcessToken, then the parent cannot get the child's exit code. This issue has been present for a long time, and isn't trival to fix, because the spec tests assume waitpid2 behaves consistently on POSIX and Windows. I'm disabling the test on Windows for now, and will revert this change when I have a real fix for #11740. Reviewed-By: Jeff McCune <jeff@puppetlabs.com>
2011-10-05Update test due to lack of 'true' on WindowsJosh Cooper1-5/+10
The tests were previously failing because 'true' is not an executable on Windows, but a similar effect can be achieved by executing: cmd.exe /c "exit 0" Modified the tests and removed the fails_on_windows tag.
2011-08-19Maint: Tagged spec tests that are known to fail on WindowsJosh Cooper1-1/+1
Many spec tests fail on Windows because there are no default providers implemented for Windows yet. Several others are failing due to Puppet::Util::Cacher not working correctly, so for now the tests that are known to fail are marked with :fails_on_windows => true. To skip these tests, you can run: rspec --tag ~fails_on_windows spec Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 255c5b4663bd389d2c87a2d39ec350034421a6f0) Conflicts: spec/unit/resource/catalog_spec.rb
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-07Maint: Added the ability to replace the behavior ofPaul Berry1-0/+35
Puppet::Util.execute with an arbitrary code block for ease in spec testing. Reviewed-by: Max Martin <max@puppetlabs.com>