summaryrefslogtreecommitdiff
path: root/spec/unit/face/module
AgeCommit message (Collapse)AuthorFilesLines
2014-07-22Merge branch 'stable'Adrien Thebo1-8/+8
2014-07-21(maint) Cleanup specs for the `module` Face’s `install` action.Pieter van de Bruggen1-8/+8
Prior to this change, the specs relied on a fragile chain of stubbed expectations, which changes elsewhere in the application have rendered incorrect and non-operational. This change aims to improve these specs by stubbing less and making more robust assertions about the data.
2014-07-11(PUP-2918) Clarify missing Modulefile errorBrandon High1-2/+2
Prior to this commit, when building a module without a Modulefile or metadata.json, the builder would blow up with a cryptic 'Unable to find module root at DIRECTORY' It's not entirely clear what that means to an end user. This commit clarifies that metadata.json or a Modulefile are what need to be found at the module root. Also removes some duplicated logic for checking module root.
2014-04-21Merge remote-tracking branch 'upstream/master' into PE-3182Pieter van de Bruggen1-6/+6
Conflicts: spec/unit/face/module/install_spec.rb spec/unit/face/module/list_spec.rb spec/unit/face/module/uninstall_spec.rb spec/unit/module_tool/applications/installer_spec.rb spec/unit/module_tool/applications/uninstaller_spec.rb spec/unit/module_tool_spec.rb
2014-04-07(PUP-2158) Default a missing manifest to no_manifestAndrew Parker3-5/+5
The tests were often creating environments that didn't need to have manifests. Since we didn't have a way of specifying that when they were written, we used '' to fill in the blank. This actually caused a large number of tests to try to find code to load in the PWD, which caused tests to break if a developer had parse errors in manifests being used for testing in the root directory of their puppet project. This changes the manifest to be optional and removes '' from those tests. The tests no longer fail if a bad manifest is in the PWD :D
2014-04-04(PUP-2093) Migrate PMT to /v3 API.Pieter van de Bruggen4-190/+144
Prior to this commit, the PMT managed all communication with the Forge via the (now legacy) /v1 API. That API has been deprecated (primarily due to scalability concerns), which is less of an issue since it was never officially a public API. This commit migrates all communication to the Forge to the new /v3 API, which is expected to be launched as our official public API "soon". This commit also integrates a standalone dependency resolver, as the /v3 API contains no implicit dependency resolution (as the /v1 API did); consequently, large portions of the PMT code have been changed, and others have become unreachable. This commit also changes the default host that the PMT communicates with, from https://forge.puppetlabs.com to https://forgeapi.puppetlabs.com (the natural URL for the Forge API service). Since the tool now expects to communicate with a completely different service, it will be unable to communicate with services that do not implement the same /v3 API.
2014-03-07(maint) Add rake task for parallelizing specs.Peter Huene1-0/+1
Adding a 'parallel:spec' task that will group specs and then run those groups in a parallel set of processes. By default, parallel:spec will bunch the specs into groups of approximately 1000 and concurrently run each group up to the number of processors reported by facter. The task takes two parameters: process_count and group_size. Running with a process_count of 1 (parallel:spec[1]) will behave like the existing 'spec' task, except it will still group the tests and recycle the spec running process between groups. This has the added benefit of limiting the spec running process' working set, at the cost of being a little slower.
2014-02-19(PUP-1584) Expand some modulepath settings for windowsJosh Partlow1-1/+1
A couple of module_tool specs modified for PUP-1584 were not being expanded such that they would work properly on Windows or POSIX.
2014-02-18(PUP-1584) module_tool uses current_environment with target_dir overridesJosh Partlow2-129/+39
The module tool was relying on the implicit creation and caching of legacy environments based on puppet settings for environment and modulepath. But this does not work for the new directory style of environments. So we are being explicit about using the current environment from the context, and overriding modulepath to prepend a target_dir if given, and then directly inserting the environment to be used into the options rather than expecting the module_tool applications to retrieve the correct environment from any other loaders. Testing is now simpler, but because we are now comparing different but equal environments, I added equality and hash to node/environment to facilitate this. This in turn broke tests, because of Puppet::Node::Environment#known_resource_types which caches using the global $known_resource_types. Previously this would always clear itself when called if $known_resource_types.environment != self, but with the new node equality, state was now leaking between tests. The test_helper now sets $known_resource_types nil after each test.
2014-01-29(PUP-1118) Stop using Environment.newAndrew Parker1-8/+10
Instead of creating environments directly, we need to go through the configured environment loaders, otherwise environments can't come from other places.
2014-01-17(PUP-1118) Move global context methods to PuppetAndrew Parker1-2/+2
This moves the global context handling out of the Puppet::Context class and onto the Puppet module, which allows Puppet::Context to be a more generic, overridable context system. It also allows references to context information to be a little bit shorter. This doesn't tackle making settings information available in the context, and so there might be a little confusion between Puppet[] and Puppet.lookup.
2014-01-16(PUP-1118) Introduce "create" to make specific environmentsAndrew Parker1-28/+42
Environments are more than just a name, they are also a modulepath and a manifest. This commit makes a "create" method for setting up environments with specific modulepaths and manifests rather than relying on the Puppet Settings at the time that methods are called. In order to control environments for module installation they now take advantage of this in order to control the modulepath that things will be installed into.
2012-07-31(Maint): Re-enable tests on WindowsJosh Cooper1-34/+29
These tests now pass on Windows. Removed the `pending` block and re-indented, no code changes.
2012-07-16(#15533) Change puppet module build to build the module in cwd (or parents)Ken Barber1-0/+68
Previously 'puppet module build' required a full path to build a module. This change will add the ability to run the command from within a module itself and have the package built correctly. Through changes to find_module_root it will also support running the command is a sub-directory of the module as well. Due to some lack of system and unit testing, I've added that as well as part of this patch and included tests for the new behaviour.
2012-07-11Merge commit 'ecc52ed' into 3.0rcPatrick Carlisle1-1/+12
* commit 'ecc52ed': (33 commits) (#11868) Use `Installer` automation interface to query package state Eliminate require calls at runtime. Fix broken TransBucket transformation tests. Fix broken ability to remove resources from the catalog. Fix type check when transforming catalog. Fix all trivial "should to must" errors in our tests. Enforce "must not should" on Puppet::Type instances in tests. Initialize resources strictly in backup specs Refactor file backup specs (maint) Add tags to .gitingore Use in memory sqlite database for unit tests (#14715) Use gtar with 'puppet module install' on Solaris Stub pkginfo when installing in openbsd spec (#14962) PMT doesn't support setting a relative modulepath (#15078) Document USR2 log rotation signal (#14909) Update createpackage.sh to resolve permissions issues (maint) Add --test to puppet run (maint) Add symlink stub to gentoo service provider spec Add comment to upstart provider explaining exclusion of 'wait-for-state' Upstart code cleanup, init provider improvement ... Conflicts: lib/puppet/face/module/install.rb lib/puppet/network/handler/fileserver.rb lib/puppet/parser/functions/fqdn_rand.rb lib/puppet/parser/type_loader.rb lib/puppet/ssl/base.rb lib/puppet/util.rb lib/puppet/util/autoload.rb man/man8/puppetmasterd.8 spec/lib/puppet_spec/database.rb spec/unit/face/module/install_spec.rb spec/unit/other/transbucket_spec.rb spec/unit/provider/augeas/augeas_spec.rb spec/unit/util/backups_spec.rb spec/unit/util_spec.rb
2012-07-06Merge pull request #891 from ↵Kelsey Hightower1-47/+79
kbarber/ticket/3.0rc/14598-interact_with_the_forge_using_ssl Ticket/3.0rc/14598 interact with the forge using ssl
2012-07-05Refactor module to require path and environment argsPatrick Carlisle1-13/+13
2012-07-02(#15202) Handle paths with files in themAndrew Parker1-1/+7
When creating the install path, if there is a file in the way then there was an unhandled exception. This commit extracts out a install directory handling code for ease of testing and adds handling for this case. This class excapsulates the logic of preparing the installation directory for modules. As we find more operations on the installation directory we should try to move them to this class.
2012-06-27(#14598) Add SSL support for forge interactionKen Barber1-47/+79
This patch turn on SSL support when an HTTPS url is provided, and also changes the default URL to https://forge.puppetlabs.com so that now all interaction is done via SSL. As not all Ruby setups on weird operating systems are proven to work, effort was spent in making sure validation errors are captured and returned as a meaningful error to the user. This was also captured as a simple acceptance test by testing against a self-signed certificate (in our case, a puppet master). The forge error handling in Puppet::Forge::Repository was changed to return a new set of exceptions specific to the Puppet::Forge API set, so they can be captured by consumers and displayed. This also helps a lot with test mocking and tests have been changed accordingly. To reflect the new error handling in Puppet::Forge::Repository the search face was changed to capture exceptions and hand them off to the rendering parts as data in a hash, to mimic how the rest of the puppet/face/module components work. All the existing acceptance tests were changed to now test against SSL, and existing unit tests were also changed to reflect changes herein. New tests were added for Puppet::ModuleTool::Applications::Searcher as previously this had no coverage.
2012-06-24(#14962) PMT doesn't support setting a relative modulepathKen Barber1-2/+13
We previously fixed expansion for the target_dir, but this only worked when the target_dir was set explicitly, it didn't support relative paths being passed in the modulepath. This patch fixes that and adds tests. As a side-effect, this should also fixes cases where the first modulepath defined in the configuration file is relative. It also corrects the tests previously applied for expanding the target_dir, as it used to rely on expanding the target_dir before adding it to the modulepath. This wasn't necessary, so now we don't bother testing that the targetdir is expanded in the modulepath after being added. Acceptance tests have been added for testing modulepath, with absolute and relative paths.
2012-05-14(maint) Manually resolve broken merge of 2.7.xKelsey Hightower1-0/+11
This patch resolves a merge conflict with 2.7.x, mainly around some changes in the PMT installer face options.
2012-05-14Use absolute_path in module install specPatrick Carlisle1-4/+5
This fixes the module install spec on windows
2012-05-14Revert "Merge branch '2.7.x'"Kelsey Hightower1-11/+0
This reverts commit 34ad902015afbd3f8d7597207a1cb4d5cd4cc011, reversing changes made to 639f995c91289b3be9ca5347865247907c7dcb5c.
2012-05-14Merge branch '2.7.x'Kelsey Hightower1-0/+11
2012-05-14(#14424) Expand path of the target directoryKelsey Hightower1-0/+11
This patch expands the path of the target installation directory and will prevent the following errors: Error: undefined method `each' for nil:NilClass
2012-05-11(#14387) Puppet's Module face should send a User-AgentAndrew Parker2-18/+33
The User-Agent will provide the server with some information about the version of the module tool, the version of puppet, and the version of ruby that is being used. This commit also ensures that Puppet::Forge does not depend on the Puppet::Face code. In order to achieve that the module face now is responsible for creating the correct Puppet::Forge object and handing that to the various components of the face for execution. The Puppet::Face now provides an interface for interacting with the repository in ways that various users were doing by asking for the repository directly.
2012-04-30(#14229) Add a path type to settingsPatrick Carlisle1-4/+5
This path type will expand all paths in a string separated by File::PATH_SEPARATOR, but does not add the paths to the settings catalog. This helps the most on Windows, where it means that paths given to settings will consistently use File::SEPARATOR, no matter how they were entered by the user.
2012-04-24Merge 2.7.x into master.Daniel Pittman3-16/+16
This manually fixes up a pile of Puppet Module Tool conflicts by hand, related to overlapping changes with nothing but textual translation. The rest of the merge was smooth and simple. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-04-23(#13682) Rename Puppet::Module::Tool to Puppet::ModuleToolJeff McCune3-15/+15
Without this patch, Puppet will monkey patch the existing implementation of the puppet-module Gem if it is used. This is bad because the two implementations are all jumbled up inside of one another and behavior may become unpredictable. Warnings are also displayed directly to the end user in the form of redefined constants. This patch fixes the problem by renaming Puppet::Module::Tool inside of Puppet to Puppet::ModuleTool This fixes the problem because Puppet will no longer monkey-patch the Puppet::Module::Tool module inside of the puppet-module Gem. This patch also has the added benefit of making the Module's name match up with the CamelCase filepath (puppet/module_tool/ => Puppet::ModuleTool) As a result, no file moves are necessary.
2012-04-18Merge pull request #679 from ↵Daniel Pittman3-7/+7
jeffweiss/ticket/master/13898_fail_face_on_option_clash (#13898) Fail Face when option collides w/ setting
2012-04-18Use conditional pending to block out "fails_on_windows" tests.Daniel Pittman2-35/+37
A whole bunch of tests scattered through the system fail on Windows, around features that are not supported on that platform. (They are things that only the master does, which an agent-only platform doesn't need to support.) These were tagged `fails_on_windows` to allow filtering them from rspec runs, which is great, but doesn't actually communicate nearly as much useful information as it would if we used the "conditionally pending" facilities that rspec has supported since 2.3. That gives us two key things: one, it works automatically based on our knowledge of the platform, which means you can't forget to turn off failing tests. Two, it means that if the test starts unexpectedly passing we also get a failure, since we should respond to "works when it shouldn't" as seriously as "fails when it shouldn't". Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-04-17(#13898) Fail Face when option collides w/ settingJeff Weiss3-7/+7
Change Puppet::Interface::Option to prohibit options on Faces that have the same name as an existing Puppet setting. Move functionality of Puppet::Util::Setting::StringSetting.setbycli to Puppet::Util::Settings and deprecate usage of StringSetting.setbycli because StringSetting provides metadata for the definition of setting, whereas Setting contains both the value and the origin of the value, whether :cli, :memory, :application_defaults, etc. Change ca application and certificate Face to properly handle all permutations of --dns_alt_names (Puppet setting) and --dns-alt-names (Face option). Remove "documentation only" options of :modulepath and :environment from module Face. Prior to this commit, Faces could declare options that collided with existing Puppet settings, which has caused unexpected behavior for the Face. This commit explicitly prohibits the Face from declaring an option which is already a Puppet setting. This is a potentially breaking change for externally developed Faces.
2012-03-30Add Module ToolMatt Robinson5-0/+606
This rather large commit includes all the work needed to get the `puppet module` face in Puppet with all it's actions. I tried to break this up into smaller commits, but it was difficult to do so and keep the individual commits in a state that had passing specs since many changes in shared module_tool code affected multiple actions. This code was developed in an integration branch over a few montsh and is now being merged back into Puppet core in the same state that shipped with Puppet Enterprise 2.5. The work here was done by Pieter van de Bruggen <pieter@puppetlabs.com>, Kelsey Hightower <kelsey@puppetlabs.com> and myself.
2012-02-15(#12631) Remove puppet module faceMatt Robinson8-408/+0
The current state of the module face was deemed not ready for shipping because there was insufficient testing and formatting. This removes the parts of the code that make the module face accessible as a face application, and the accompanying tests. This change will be reverted after the 2.7.11rc is cut so that work can continue on the module face for the next release.
2012-02-09(#12106) Enhance the uninstall PMT action for UXKelsey Hightower1-4/+30
Before this patch the uninstall action only uninstalled puppet modules by name. The uninstallation of a module consists of removing a directory in the module path that matches the name of the module. This does not take into account the version of the module installed. This patch changes the behaviour of the uninstall action with the following features: * Modules can be uninstalled by specific version * Modules can be uninstalled by enviornment * Output of the unistall command has been enhanced to provide a better UX This patch also includes updated specs for the change in behaviour.
2012-02-08Revert "(#12339) Adding basic search output formatting."Daniel Pittman1-131/+0
This reverts commit a7bd5698ab9bc8c11885737da2e7ec380275f24b. That was part of a series of enhancements to the integrated Puppet Module Tool that broke on Ruby 1.8.5. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-02-01(#12339) Adding basic search output formatting.Pieter van de Bruggen1-0/+131
This aims to ensure that the most relevant data is always available in your search results. The module name and author are always available, the most relevant keywords are presented, and as much of the short description as possible is shown.
2012-01-23Revert "(#11600) Remove module face"Matt Robinson8-0/+382
This reverts commit d6d6e60fc04aa2baa678b5b36c00c5878696018f. Now that 2.7.10rc has been cut, we will continue work on the module face to make it releaseable for the next 2.7.x release. To do that, we need the core face and application for `puppet module` put back into the codebase.
2012-01-18(#11600) Remove module faceMatt Robinson8-382/+0
This commit removes the face related code and tests since it was determined they didn't meet design specifications well enough for the upcoming release. This leaves the module_tool related code in, but it's not accessible through any supported interface. This will make it easy for us to get this removed code back in after the release and continue development for the next release.
2012-01-17Merge branch 'ticket/2.7.x/11802-fix_path_separator_windows_test_failures' ↵Josh Cooper1-3/+3
of https://github.com/mmrobins/puppet into 2.7.x * 'ticket/2.7.x/11802-fix_path_separator_windows_test_failures' of https://github.com/mmrobins/puppet: (#11802) Fix module list specs on Windows
2012-01-17(#11802) Fix module list specs on WindowsMatt Robinson1-3/+3
The module path separator in the specs was hard coded to ':' and caused tests to fail on windows.
2012-01-17(#11803) Fix broken tests for uninstall action on module faceDaniel Pittman1-2/+2
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-01-17Merge pull request #332 from ↵Daniel Pittman1-0/+47
kelseyhightower/ticket/2.7.x/11803_PMT_should_have_an_uninstall_command (#11803) pmt should have an uninstall command
2012-01-17(#11803) Add uninstall action for the module faceKelsey Hightower1-0/+47
Without this patch, the module face does not have an action for uninstalling Puppet modules. This patch adds an uninstall action to the module face, with initial support for uninstalling Puppet modules from the default module paths or specific directories. This patch also includes the related spec tests. Example Usage: Running the following commands will uninstall a module from all module paths or a specific directory $ puppet module uninstall apache Removed /etc/puppet/modules/apache $ puppet module uninstall --target-directory /usr/share/puppet/modules apache Removed /usr/share/puppet/modules/apache Running the Tests: The uninstall spec tests can be run with the following commands: $ rspec spec/unit/face/module/uninstall_spec.rb $ rspec spec/unit/module_tool/uninstaller_spec.rb
2012-01-13(#11802) Add module list actionMatt Robinson1-0/+100
This action will allow users to get more information about their installed modules, making managing them easier. For now this just lists the modules split out by path, with the paths able to be specified with modulepath or environment options and defaulting to Puppet's modulepath.
2011-12-07(#11276) Fix module install specs that fail on windowsMatt Robinson1-1/+2
expand_path is our friend for cross platform testing. Also, need to require module_tool in order to run the install_spec.rb on its own.
2011-12-06(#7656) Rename module_tool face to moduleKelsey Hightower6-0/+234
Before this patch the module face was named module_tool, this is not a very attractive name. Look at it, you have to type an underscore just to use it. This patch fixes this issue by simply renaming the face from module_tool to module. The patch does not change the name of the module tool library files, doing so would cause a conflict on the existing `lib/puppet/module.rb` module.