Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable: (28 commits)
  bumping pxp-agent to 20eda46c3f406bc290a2672e1ef6958faadbd2af
  (PA-729) Bump leatherman in LTS-1.7 to 0.10.1
  bumping pxp-agent to 28d491ce92b390e937623dae58bce4f4ddd3bca9
  bumping pxp-agent to 34550c186737e9ea20de87d2fcc29cd4ed33b1f3
  bumping puppet to eaf878b677eb57755b56ff9d9872b0fbfe68595e
  bumping puppet to 50c0d51065126f242f984c8060b126c46e2f3af2
  bumping puppet to ffabfc3d3019b1a4653c3015182a8996c8a86cde
  bumping facter to 6a489284a70a6e14f8cd5ed4f8a5a65a3ba57a05
  bumping pxp-agent to f3c8eb4dc1bc99a4d39285799d78f1e3ef9c1fd0
  bumping puppet to 49cf1fdfc4f9f9128c6bfc48f8286fb66ec1914d
  bumping pxp-agent to fd4698a5267f750caea48030be4cbc6fa95d53c5
  (PA-633) exclude acceptance from rubocop
  (maint) reference MAINTAINERS file in README
  (PA-633) Update .gitignore for acceptance files
  (PA-633) use beaker's utils in acceptance setup step
  (PA-633) Initial rakefile for running PA-acceptance
  (PA-633) Add README for running acceptance
  (PA-633) Copy "ensure_version_file" test from puppet
  (PA-633) Add aio and common acceptance pre-suites
  (PA-633) copy basic acceptance utils from puppet
  ...
  • Loading branch information
Magisus committed Dec 12, 2016
2 parents f6fc60c + 1933492 commit 8a57a30
Show file tree
Hide file tree
Showing 28 changed files with 1,099 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ Gemfile.local
ext/packaging
pkg/*
*.swp
acceptance/junit/*
acceptance/log/*
acceptance/tmp/*
acceptance/merged_options.rb
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ AllCops:
- 'bin/**/*.rb'
- 'configs/**/*.rb'
Exclude:
- 'acceptance/**/*'
- 'resources/**/*.rb'
- 'ext/**/*'
- 'vendor/**/*'
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The Puppet Agent
* Installer plugin for OSX
* License
* Maintainers
* Running Tests

Overview
---
Expand Down Expand Up @@ -119,5 +120,8 @@ Puppet agent is licensed under the [Apache-2.0](LICENSE) license.

Maintainers
---
The Release and Client Engineering teams at Puppet Labs
See [MAINTAINERS](MAINTAINERS)

Running Tests
---
See [Acceptance README](acceptance/README)
22 changes: 22 additions & 0 deletions acceptance/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Specifies a gem mirror; duplicated in acceptance setup
# to ensure a similar environment on acceptance hosts.
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

def location_for(place, fake_version = nil)
if place =~ /^(git:[^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place, { :require => false }]
end
end

gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.1.0')
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 0.3")
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.2")
gem "rake", "~> 10.1"

if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
127 changes: 127 additions & 0 deletions acceptance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Tests

Puppet Agent uses [beaker](github.com/puppetlabs/beaker) for running acceptance tests

## Running Tests

Acceptance tests are triggered using `rake acceptance`

### Usage
```
# cd acceptance
# bundle install --path .bundle
# bundle exec rake <command> ENVIRONMENT_VARIABLE=value
```

#### Example Invocations
* print listing and explanation of useful environment variables
```
bundle exec rake help
```

* print listing of available rake tasks
```
bundle exec rake -T
```

* run tests against puppet agent 1.7.0 on agent platform windows
2016 x64, downloaded from builds.delivery.puppetlabs.net, using the latest nightly
build of puppet server running on centos 7 x64.
```
bundle exec rake acceptance:development SHA='1.7.0' TEST_TARGET=windows2016-64a MASTER_TEST_TARGET=centos7-64ma
```

* run tests against the latest nightly build of puppet agent on the public
nightlies build server, using the default platform for agent and server.
```
bundle exec rake acceptance:development SHA='latest' AGENT_DOWNLOAD_URL='http://nightlies.puppet.com'
```

* run tests against the released 1.8.0 puppet agent packages on our production
repos (ie yum.puppet.com) on the ubuntu 16.04 64-bit platform using the latest
puppet server version also in the production repos on the default puppet server
test target.
```
bundle exec rake acceptance:released SHA='1.8.0' TEST_TARGET=ubuntu1604-64a
```

### Settings and Environment Variables
* SHA=sha (required)
> Supply git ref (sha or tag) of packages of this repository to be put under test.
> Also supports the literal string 'latest' which references the latest
> build on http://nightlies.puppet.com.
> If setting SHA to 'latest', you must also set ENV['AGENT_DOWNLOAD_URL'] to
> http://nightlies.puppet.com.
* BEAKER_HOSTS=config/nodes/foo.yaml
> Supply the path to a yaml file in the format of a beaker hosts file containing
> the test targets, roles, etc., or specify it in a beaker options.rb file.
* TEST_TARGET='beaker-hostgenerator target'
> Supply a test target in the form beaker-hostgenerator accepts, e.g.
> ubuntu1504-64a. Defaults to a constant defined in [Rakefile](Rakefile).
* MASTER_TEST_TARGET='beaker-hostgenerator target'
> Override the default master test target in the form beaker-hostgenerator
> accepts, e.g. ubuntu1504-64a. Defaults to a constant defined in
> [Rakefile](Rakefile). This is the platform that Puppet Server will be
> installed on.
* SERVER_VERSION='SHA'
> Supply git ref (sha or tag) of Puppet Server to use in testing. If no
> SERVER_VERSION is provided, the latest nightly build of Puppet Server will be
> used from http://nightlies.puppet.com. Ignored by `rake acceptance:released`
> which will install the latest/current version of Puppet Server from the Puppet
> production repos (ie yum.puppet.com).
* AGENT_DOWNLOAD_URL='http://example.com'
> Supply the url of the host serving packages of puppet agent to test matching
> `SHA`. Ignored by `rake acceptance:released` which always uses the production
> Puppet repository urls.
>
> Valid values are:
> * http://builds.delivery.puppetlabs.net (Puppet internal builds)
> * http://nightlies.puppet.com (Puppet public nightly builds)
>
> Default: http://builds.delivery.puppetlabs.net.
* SERVER_DOWNLOAD_URL='http://example.com'
> Supply the url of the host serving packages of puppet server to test against
> packages of puppet agent. Ignored by `rake acceptance:released` which always
> uses the production Puppet repository urls.
>
> Valid values are:
> * http://builds.delivery.puppetlabs.net (Puppet internal builds)
> * http://nightlies.puppet.com (Puppet public nightly builds)
>
> Default: http://nightlies.puppet.com
* TESTS='path/to/test,and/more/tests'
> Supply a comma-separated string (no spaces) of specific test(s) to run.
> All pre-suites will be run, unless a specific pre-suite file is supplied as the
> value to this option, in which case test exercise will terminate after the
> supplied pre-suite file. Relative to 'acceptance' directory.
>
> Example: TESTS='tests/ensure_version_file.rb'
* OPTIONS='--more --options'
> Supply additional options to pass to the beaker invocation
>
> Example: OPTIONS='--preserve-hosts=never'
If there is a Beaker options hash in a ./local_options.rb, it will be included.
Commandline options set through the above environment variables will override
settings in this file.

### Caveats
Running acceptance tests requires packages of the test target SHA have already
been built and exist on a download server that beaker can install from. The two
most commonly used download urls are http://nightlies.delivery.puppet.net
(public) and http://builds.delivery.puppetlabs.net.

TODO A future version of acceptance tests will support building packages of a
given SHA locally and then running acceptance tests against those packages.

Spec Tests
---
Puppet Agent does not currently have spec tests
Loading

0 comments on commit 8a57a30

Please sign in to comment.