(PUP-3391) Plugin synced for incorrect environment while agent is resolving environment

Before this commit if an agents environment was changed the plugins from
the initial environment were synced instead of the plugins from the
environment where the node would end up. This would cause problems where
a manifest from one environment would be applied with custom types and
providers from a different environment.

This commit changes the behavior to sync plugins after every environment
resolution. We need to sync the plugins after every environment change
because this action needs to be performed before we can retrieve a
manifest for the node in a particular environment.
(PUP-3591) Refactor get_facts to always return a hash

Configurer#get_facts would return either nil, or a Hash, forcing the
main run_internal method to guard its result. I've changed this to
return an empty hash instead of nil for consistency, allowing us to
remove a bit of duplicate code.
Merge branch 'issue/stable/pup-3591-cherry-pick-fix-from-master' into stable

* issue/stable/pup-3591-cherry-pick-fix-from-master:
  (PUP-3591) Refactor get_facts to always return a hash
  (PUP-3391) Plugin synced for incorrect environment while agent is resolving environment
(maint) Pull apart test for reuse

The cache expiration service test had some useful parts in it that will
be useful for another test later. This pulls it apart so that those
pieces are available and also is a little refactoring so that I can
become familiar with how it was working.
(maint) Fix acceptance test using cached catalog

The enc_nonexistent_directory_environment.rb was failing when it
attempted to run but was using a cached catalog instead of failing
without running a catalog like the test had intended.

This commit uses the -t command on the agent run instead of using all of
the flags that were being used.
(maint) fix filename for acceptance sshkey

The boostrap script `acceptance/bin/ci-bootstrap-from-artifacts.sh` uses
an outdated filename/SSH key for our acceptance runs. We've been
(temporarily) hacking around this by sed'ing this file in our Jenkins
jobs. This commit fixes the filename in the script itself.
Merge pull request #3289 from rji/maint/stable/acceptance-sshkey

(maint) fix filename for acceptance sshkey
(maint) Unify many directory structures for test

The previous tests used a lot of different structures and set them up
individually. This was nice in that each test was self contained, but it
also left a lot of noise in some tests that only cared that *any*
environment simply exists, and the exact form of the environments wasn't
important. This unifies all of those cases so that there is a reusable
"basic" environment available.
(PUP-3621) Ensure that get! caches

The introduction of get! caused any users of that method to circumvent
the cache. This happened because, rather than delegating to get() and
raising an error, it implemented similar logic to get(), but only from
the common base class. This caused it to skip all caching checks. This
adds caching back in and adds tests for that behavior.
(maint) Remove inheritance to make mistakes less likely

The previous mistake happened partly because the classes were written
with inheritance rather than delegation. The inheritance caused the
Combined#get! implementation to be used, which was appropriate for it,
but not for the Cached get. The Cached implementation also has no reason
to allow multiple loaders, instead it only needs a single loader and
multiple ones can be put together using the Combined loader. This change
makes that distinction much clearer.
(PUP-2906) Reimplement collection evaluation

Since collection currently relies on the 3x AST, it must be
reimplemented in such a way that it does not rely on the old parser.
That way, we won't break collection with the old parser is removed
for the 4x series.

Take the first steps towards doing this by reimplementing evaluation
for collections so that it no longer relies on
Puppet::Parser::AST::Collection or Puppet::Parser::AST::CollExpr.

Additionally, make a small change to resource/file/content.rb so
that it uses dup instead of clone. This is necessary to prevent
trying to modify a frozen String.
(PUP-2906) Refactor collector into several classes

Prior to this commit, the parser created a Puppet::Parser::Collector
in order to collect resources. However, there were three distinct
code paths that needed to be dealt with: collection of virtual
resources, collection of exported resources, and realization of
a set of resources.

In order to make the code for collection more readable and manageable,
split up the current collector into three different collectors which
reflect the code paths described above.

Additionally, make some changes to the compiler so that it is compatible
with these new collectors while still supporting the old 3x collector.
(PUP-2906) Add benchmark for collection

In order to ensure that we don't make collection any slower, add
a benchmark which tests how long it takes to create 200 resources
and collect them.
(PUP-2906) Optimize and clean up code

Use the benchmark to track down and fix some code that could be
optimized to make collection faster. Additionally clean up the
code for collectors and add some YARD documentation for the API.
(PUP-2906) Add test for nonexistent resources

To ensure that the fail method is called properly in the
CollectorTransformer's evaluate method, add a test with a manifest
containing a resource type that does not exist.

Additionally do a few small code and comment cleanups.
Merge pull request #3290 from hkenney/issue/stable/pup-2906_implement_collection_without_3x_ast

(PUP-2906) Reimplement Collection without 3x AST
Merge pull request #3291 from zaphod42/issue/stable/pup-3621-lost-env-caches

(PUP-3621) Ensure that get! caches
(PUP-3615) Remove string to number auto convert for compare and equals

This removes the problematic auto convert from String to Number for
comparisson operations.