summaryrefslogtreecommitdiff
path: root/spec/unit/settings/file_setting_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-08-29(PUP-3069) Add spec test for new default optionsBritt Gresham1-4/+4
Added tests for checking that default_manifest behaves properly when given $environment. Also when restrict_environment_manifest is true with a non-relative default_manifest. This commit also fixed the hook on the :default_manifest setting to validate that $environment was not present when setting the value.
2014-04-26(PUP-1381) make file_setting spec test more robustFelix Frank1-0/+1
A new call to self.resource_type in Puppet::Resource#initialize can cause the loading of type code as a side effect. This interfered with the mocking for the test Puppet::Settings::FileSetting when being converted to a resource should manage existent files even if 'create_files' is not enabled Add a stubs call to one of the uncritical expectations so that additional calls are not considered as spurious.
2014-01-17Revert "Merge branch 'ticket/master/18342-windows-file-setting-owner-group'"Iristyle1-9/+27
This reverts commit cf4501c7a97c106994c2ef81756c2081f56feeef, reversing changes made to fcf482aa85708fe20f38cd96d6d92fc58ee78cf6.
2014-01-14(PUP-266) Puppet manages group and owner on configEthan J. Brown1-27/+9
- Previously, Puppet would ignore the configuration in defaults.rb for setting a group / owner on a given file or directory -- even when the Windows machine was running with administrative permissions - Since Windows now has the capability of properly setting a group and owner, allow Windows to manage these permissions when appropriate - The existing Puppet::Settings::FileSettings::Service class depends on looking up the appropriate default service accounts for use in a number of locations. To fall in line with this usage pattern, "Administrators" is set as the default owner and the "Service" group S-1-5-6 is set as the default group. This special OS managed group includes all accounts with the logon as a service token privilege.
2014-01-06(PUP-761) Make most FileSystem API change related test passHenrik Lindberg1-2/+2
2013-11-08(#19447) Puppet::FileSystem::File.exist?Ethan J. Brown1-2/+2
- All previous File and FileTest calls to exist? or exists? go through the new FileSystem::File abstraction so that the implementation can later be swapped for a Windows specific one to support symlinks
2013-09-06(maint) Windows failing spec fixesIristyle1-3/+1
- The usage of Dir.getwd in tests has been simplified to File.expand_path to properly handle mixed case CWD - util_spec.rb ensures 'FOO' Env var cleared before test starts - Windows SID checks should be performed as a regex match to properly handle all accounts starting with S-1-5-*, which denotes accounts with an identifier authority of SECURITY_NT_AUTHORITY instead of hardcoding S-1-5-32-544, the Administrators group
2013-04-25(maint) Make sqlite3 use an in-memory DB (try 2)Jeff McCune1-1/+7
The previous attempt to enable in-memory sqlite3 database testing for the spec tests in 58e1c23 is insufficient because the Puppet[:dblocation] setting is a type of FileSetting which munges values using File.expand_path. This is a problem because the path expansion caused the database to be written to the filesystem rather than memory, as intended. This patch addresses the problem by adding a special case for all file settings. The munge operation is a no-op if the special value of ':memory:' is passed.
2013-01-02(Maint) Ensure tests are hitting the right ascpectAndrew Parker1-2/+4
The previous tests were not very careful about making sure that they were going to be going down the right branches to test the path that they wanted. This makes some of the branch selection more explicit so make the tests a bit more robust to change.
2012-12-18(#9862) Do not manage the group if it doesn't existAndrew Parker1-4/+22
The previous behavior for managing the group of a file meant that if the group didn't exist puppet errored when trying to set permissions. This changes the behavior to check for the existance of the group and in the case of the group not existing (and we don't expect it to be created because `:mkusers` is false) then the group is not managed. There were several alternatives that were possible: * use the primary group of the "root" user * use the primary group of the `:owner` for the file Neither of these were compellingly better alternatives, since this should only be happening when puppet hasn't been fully configured on the system.
2012-12-18(#9862) Allow group to be rootAndrew Parker1-2/+2
The previous behavior allowed the group parameter to be set to root, but it still selected the configured "service" group. This is contrary to what is done for the owner parameter and seems to have been an accidental behavior. This commit brings this portion of the group handling in line with user.
2012-12-18(Maint) Show the actual allowed values for groupAndrew Parker1-1/+1
The error message for the group parameter had gotten out of sync with what the allowed values actually were. This updates the message to include all of the allowed values.
2012-12-18(Maint) Clarify error message for invalid group and ownerAndrew Parker1-4/+4
The previous error message for an invalid owner looked like: Error: Could not intialize global default settings: Internal error: The :owner setting for Where Puppet stores dynamic and growing data. The default for this setting is calculated specially, like `confdir`_.: vardir must be either 'root' or 'service', not 'gnats' That message was not very clear as to what had just gone wrong because it is providing far too much information. This commit changes the message too: Error: Could not intialize global default settings: The :owner parameter for the setting 'vardir' must be either 'root' or 'service', not 'gnats' This applies to both the owner and group parameters.
2012-12-18(Maint) Remove duplicate testsAndrew Parker1-28/+11
Now that the behavior around selecting the right owner and group is explicitly tested there is no need for the tests around the internal method to determine whether to use a service user or not. This removes those tests and fixes up the names of some of the replacement tests.
2012-12-18(Maint) Move variable closer to point of useAndrew Parker1-4/+1
2012-12-17(Maint) Cleanup tests for group to actually test the logicAndrew Parker1-48/+45
The previous tests for group behaviour of the file setting was not very clear as to the logic it tried to implement. This changes the tests and makes clear that the group behavior is a little odd in that if 'root' is specified it still uses the service group.
2012-12-17(Maint) Cleanup tests for owner to actually test the logicAndrew Parker1-30/+36
The previous tests around the owner behavior for a file setting did very little to test the logic around what actual owner will be used when. This commit changes the tests to make them more clearly define the behavior of the owner selection.
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-05-11Move settings out of utilPatrick Carlisle1-0/+290