summaryrefslogtreecommitdiff
path: root/spec
AgeCommit message (Collapse)AuthorFilesLines
2014-08-01(PUP-501) Check virtual and exported resourcesAndrew Parker3-11/+31
This adds checks for the specification's assertions that virutal and exported resources are not in the produced catalog, but are available for later operations (realization) and reference (reading a parameter value). This cannot check that the exported resources are made available to catalog processors, since that is implementation dependent. In order to check this the compile_to_catalog method needed to be changed to filter out expoerted resources, just like the catalog indirection does. This required a change to the create_resources test.
2014-08-01(PUP-501) Check that empty titles creates no resourcesAndrew Parker1-0/+3
When a title array is empty, there are no resources created.
2014-08-01(PUP-2898) Don't allow empty string titlesHailee Kenney1-3/+2
Prior to this commit, empty string titles did not cause an error. However according to the specifications, a string should have a minimum length of one. With this commit, the parser will now raise an issue when an empty string title is given.
2014-08-01(PUP-2898) Fix error in *=> implementationAndrew Parker1-6/+4
The implementation for *=> looks to have been a copy-paste from the => implementation, however the expression attribute on AttributesOperation is just `expr` and not `value_expr`.
2014-08-01(PUP-501) Test resource expression evaluationJosh Partlow1-0/+262
This adds tests around the behavior of the current and the future evaluator's resource instantiation expressions. There are many cases in the current system where the tests are commented out because there isn't any consistent behavior.
2014-08-01(maint) Add tests and fix up dump actionAndrew Parker1-32/+70
There were a few formatting problems with the dump action. This fixes those up and adds tests around the dump functionality.
2014-08-01(PUP-2898) Add 4x style resource expressionsHenrik Lindberg7-87/+233
This changes the following: * Assignment has lower precedence than resource expressions * Local defaults are supported in resource instantiation expressions * A Resource body may have a new expression AttributesOperation that must evaluate to a hash. * Stricter validation of resource titles * Changes to TreeModelDumper wrt how BlockExpression is rendered (to improve debugging output). As a consequence many tests needed adjustments. * Tests that previously passed have been modified because of stricter validation. This also includes maintenance. Removing dead code/fixing stale comments and documentation.
2014-08-01(PUP-2898) Drop support for AST Transform of ResourcesHenrik Lindberg1-185/+0
The implementation no longer needs to transform resource expressions to 3x AST. This changes the transformer to raise an error if attempted. The spec test for resource transformation is also dropped. No new test added that transformer raises exceptions for resource transformation since all transformation eventually will be dropped.
2014-07-31Merge pull request #2930 from highb/fix/master/pup-2912-windows-spec-testsAnderson Mills2-4/+6
(PUP-2912) Puppet FS symlinks in build/unpack
2014-07-31(PUP-2912) Puppet FS symlinks in build/unpackBrandon High2-4/+6
Prior to this commit build/unpack were trying to use the Ruby stdlib symlink to deal with symlinks. This fails on platforms (Windows) that Puppet says supports symlinks because it does not duck punch Ruby stdlib. This commit switches the specs and code for build/unpack to use Puppet FS lib's symlink functions. This should allow it to function correctly on Windows hosts that Puppet supports symlinks.
2014-07-31Merge pull request #2927 from highb/fix/master/pup-2912-windows-spec-testsAnderson Mills2-4/+4
(PUP-2912) Build/unpack spec tests w/o symlinks
2014-07-31(PUP-2912) Build/unpack spec tests w/o symlinksBrandon High2-4/+4
Prior to this commit we would try to use symlinks in the tests on platforms that do not support symlinking. This commit uses the Puppet feature checker to conditionally try the tests if Puppet thinks the platform supports symlinks (Unixes, Linuxes, Win 2k8+).
2014-07-31Merge pull request #2867 from hlindberg/PUP-2860_optimizations-and-maintenanceAndrew Parker2-841/+1
(PUP-2860) optimizations and maintenance
2014-07-30Merge pull request #2854 from highb/fix/master/pup-2912_build_no_symlinksAnderson Mills2-1/+61
(PUP-2912) PMT Build symlink exception
2014-07-30(PUP-2745) Ignore malformed forge dependenciesBrandon High1-89/+173
Prior to this commit a malformed name in the dependencies for a downloaded forge module dependency would cause the PMT to fail unexpectedly. This commit causes the PMT to ignore malformed dependencies.
2014-07-29(maint) make lmhosts disabled spec msg friendlierEthan J. Brown1-1/+1
2014-07-29Merge pull request #2880 from ↵Adrien Thebo1-0/+15
fiddyspence/feature/2945/warning_on_windows_package_source (PUP-398) Windows package provider source munging and test
2014-07-29(PUP-2912) Builder/unpacker spec testsBrandon High2-1/+61
Adding spec tests to check for symlinks in build/install.
2014-07-29(PUP-398) Munge package source on Windowsfiddyspence1-0/+15
Adding munge and slashreplace method to windows package provider to ensure successful installation of packages. Validation in the type validate() not possible because we haven't chosen a provider at that point. Outputs debug as a means of notifying the user that the source has been changed.
2014-07-28Merge pull request #2918 from ↵Peter Huene1-71/+90
adrienthebo/fixup/master/pup-2871-install-uninstall-options-pacman Fixup/master/pup 2871 install uninstall options pacman
2014-07-28(PUP-2901) Add module dependency validationBrandon High1-2/+57
Prior to this commit there wasn't much verification for module dependencies. This commit adds verification the module dependencies have sane names and version ranges. If verification fails, it will raise an argument exception.
2014-07-28(maint) Make pacman (un)install_options privateAdrien Thebo1-43/+0
These methods should not be called by any outside class; this commit makes them private and removes the tests that invoke them directly.
2014-07-28(PUP-2871) Concatenate uninstall_options to argvAdrien Thebo1-4/+8
In the same manner as 9137faf uninstall_options were being appended as a nested array value; this commit changes the uninstall method to concatentate options to the array.
2014-07-28(PUP-2871) Concatenate install install_options to argvAdrien Thebo1-0/+20
Before this commit, install_options were passed as a nested array to pacman/yaourt. This commit changes that to concatentate the values with the argument vector.
2014-07-28(maint) Isolate specs from whether yaourt is installedAdrien Thebo1-13/+10
2014-07-28(maint) use RSpec helpers over instance and local variablesAdrien Thebo1-72/+70
2014-07-27(maint) Remove extra abstraction PAbstractType - change to PAnyTypeHenrik Lindberg1-1/+1
Since all types now are PAnyType, there is no need to have an extra abstratin called PAbstractType, it just adds level in the ancestor hierarchy that needs to be consulted for methods, one extra step to go when checking is_a? against PAbstractType instead of PAnyType, etc.
2014-07-27(PUP-2860) Remove future parser's old lexerHenrik Lindberg1-840/+0
The old (intermediate) lexer was still hanging around even if it was not being used. Cycles were also wasted on unit testing it. The new lexer "Lexer2" has been in use for quite some time and the old lexer is not useful even as a reference at this point. This speeds up both loading and unit testing.
2014-07-25Merge pull request #2893 from whopper/upstart-ubuntu-testAdrien Thebo1-0/+5
(maint) Add test to ensure upstart is default init daemon in Ubuntu
2014-07-25(maint) Fix description of masterlog testCharlie Sharpsteen1-1/+1
Re-word the description of a test in `webrick_spec.rb` as it is testing the behavior of `masterhttplog` and not `masterlog`.
2014-07-25Merge pull request #2907 from adrienthebo/maint/master/remove-pending-face-testsJosh Partlow6-42/+0
(maint) Remove pending face specs
2014-07-25(PUP-744) Only cache HTTP and verified HTTPS connectionsJosh Cooper1-1/+37
Previously, it was possible for puppet to create an HTTPS connection with VERIFY_NONE, and cache the connection. As a result, the pool code could hand out an insecure connection, when the caller expected a secure one (VERIFY_PEER). In practice this isn't an issue, because puppet only uses insecure HTTPS connections when bootstrapping its SSL key and certs, and that happens before `Configurer#run` overrides the default non-caching pool implementation. However, it could be an issue if a provider were to request a insecure connection *during* catalog application, as that connection would be cached, and possibly reused by puppet, e.g. when sending the report. This commit modifies the connection pool to only cache HTTP or secure HTTPS connections. All other connections are closed after one HTTP request/response.
2014-07-25(PUP-744) Document http pooling classes and methodsJosh Cooper1-0/+14
Add yard doc for http pooling. Also adds a test to verify multiple persistent connections can be borrowed from the pool.
2014-07-25(maint) Remove unnecessary expectationsJosh Cooper1-6/+2
Remove expectations that were secondary to the actual test, also clarify behavior that was being tested.
2014-07-25(maint) Remove pending test for releasing expired connectionsJosh Cooper1-4/+0
Previously, I was concerned that a caller could borrow a connection from the pool, and perform a long operation before returning it to the pool. That could make it trivial for the caller to add expired connections back to the pool, and cause issues for the next HTTP request. However, that is not likely, because connections are only borrowed for the duration of the `Connection#get`, `#post`, etc calls, and those methods don't take a block. The connection methods that do take a block, e.g. `#request_get` are deprecated, and are not used within puppet.
2014-07-25(PUP-744) Fix off-by-one redirect limit errorJosh Cooper1-1/+19
Previously, the `redirect_limit` specified the maximum number of HTTP requests that the connection would make, not the maximum number of redirects that it would follow. As a result, a limit of 0 would prevent any HTTP requests from being made. This was introduced in 60f22eb1 when the redirect logic was added. This commit changes the limit so that 0 means don't follow redirects, 1 means follow one redirect, etc.
2014-07-25(PUP-744) Don't modify site information when following redirectsJosh Cooper3-50/+81
Previously, the connection would mutate its host, port, etc when following redirects. This wasn't really an issue, because connections were always single use. Now that connections can be cached, we do not want to mutate the original site information even when following permanent redirects.
2014-07-25(PUP-744) Remove private Connection#connection methodJosh Cooper2-29/+58
Previously, the `Connection#connection` method was used in `connection_spec.rb` to validate the state of the Net::HTTP object created by the puppet connection. Since the puppet connection no longer owns an Net::HTTP object (it may use newly created or cached instances), the `#connection` method doesn't make sense, and since it was private, can be removed. The tests that relied on the private method have been updated, and in some cases moved to the factory_spec, e.g. verifying proxy settings.
2014-07-25(PUP-744) Ensure connections we create support at least HTTP 1.1Josh Cooper1-0/+6
When starting a persistent HTTP connection, we do not expliclty specify `Connection: Keep-Alive`, because that is the default in HTTP/1.1[1]. This commit adds a test to ensure we are using HTTP 1.1 or later. Amazingly ruby has defaulted to 1.1 as far back as ruby 1.8.7[2]. [1] http://tools.ietf.org/html/rfc7230#appendix-A.1.2 [2] https://github.com/ruby/ruby/blob/v1_8_7/lib/net/http.rb#L282
2014-07-25(PUP-744) Remove unnecessary after each routineJosh Cooper1-4/+0
The puppet connection class doesn't have an ssl_host instance variable.
2014-07-25(PUP-744) Move connection factory into the poolsJosh Cooper5-57/+53
Previously, the puppet connection class owned the Net::HTTP factory and passed it to the pool when requesting a connection. However, the caching pool only needs the factory when creating a new connection. This commit makes the factory stateless and pushes it into the respective pools. The SSL verifier is stateful (contains peer certs) and remains in puppet's connection class. When a pool needs to create a connection, it calls back into the puppet connection object to initialize SSL on the Net::HTTP object. In the case of the caching poool, it needs to do this before starting the connection, which will perform the TCP connect and SSL handshake operations.
2014-07-25(PUP-744) Rename DummyPool to NoCachePoolJosh Cooper2-4/+4
DummyPool was a bad name, renaming to what it actually does.
2014-07-25(PUP-744) Ensure connections do not leakJosh Cooper2-70/+149
Previously, the dummy and caching pools allowed the caller to take a connection from the pool and retain ownership of the connection. This is undesirable because if the caller encounters an exception while using the connection, then they have to remember to close it, otherwise the underlying socket will leak. There is also the issue that a caller may forget to add it back to the pool before the pool is closed, in which case the socket will again leak. This commit changes the api to a block form to ensure connections are always returned to the pool or closed. Note the `reuse` flag is used to ensure the connection is returned to the pool even if the caller does a non-local return: with_connection(..) { |conn| return }
2014-07-25(PUP-744) Create a pool of puppet HTTP connectionsJosh Cooper1-0/+156
This commit adds a pool for caching puppet network connections. The pool maintains a hash indexed by site. Each site refers to an array of sessions, where each session refers to a puppet HTTP connection and its timeout. It is expected the consumers of the pool will follow the pattern: conn = pool.take_connection(site) # do something with conn pool.add_connection(site, conn) Whenever a connection is (re-)added to the pool, the pool will assign a expiration timeout. When a caller next requests a connection, the pool will lazily close any expired connection(s) for that site. The timeout exists, because if there is a long delay between the time that an open connection is added to the pool and when it is taken, the remote peer may close the connection, e.g. apache. As a result, we only want to cache connections for a short time. Currently the timeout defaults to 15 seconds.
2014-07-25(PUP-744) Add dummy http poolJosh Cooper2-0/+38
This commit adds a DummyPool that doesn't perform any caching of network connections. It also adds the pool to the context system, but does so using a Proc to defer evaluation of the pool. This way we are not loading networking code while bootstrapping puppet.
2014-07-25(PUP-744) Refactor to use Net::HTTP factoryJosh Cooper1-0/+34
Previously, puppet connections were directly responsible for creating Net::HTTP objects. This was okay because there was only one code path where new Net::HTTP objects needed to be created. However, in order to support different connection pool behaviors, caching and non-caching of Net::HTTP objects, we want to have two pool implementations, and each of them will need the ability to create Net::HTTP objects. This commit creates a factory object for creating Net::HTTP objects, and has the puppet connection delegate to it.
2014-07-25(PUP-744) Create an HTTP sessionJosh Cooper1-0/+43
An HTTP session binds a puppet HTTP connection and an expiration time.
2014-07-25(PUP-744) Add helper method for use_ssl?Josh Cooper1-0/+12
This commit adds a site helper method for use_ssl?
2014-07-25(PUP-744) Add method for moving a site to a new locationJosh Cooper1-0/+11
This commit adds a Site#move_to method that creates a new site pointing to a new location. Note that we don't preserve the path from the new site, as sites are only concerned with the HTTP connection layer, not the HTTP request path and query parameters.
2014-07-25(PUP-744) Create an HTTP site value objectJosh Cooper1-0/+67
This commit creates a site value object containing a scheme, host, and port. A site identifies an HTTP(S) connection. It does not currently take into account proxy host, port, user, password, as these are global puppet settings. The Site class defines the `eql?` and `hash` methods making it suitable for use as the key in a hash table.