forked from puppetlabs/ace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds back the acceptance directory removed in puppetlabs#70 as our CI expects there to be such directory.
- Loading branch information
Showing
13 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.vagrant | ||
.bundle | ||
Gemfile.lock | ||
local_options.rb | ||
log | ||
junit | ||
id_rsa-acceptance | ||
id_rsa-acceptance.pub | ||
merged_options.rb | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
source ENV['GEM_SOURCE'] || "https://rubygems.org" | ||
|
||
def location_for(place, fake_version = nil) | ||
git_match = place.match(/^(git:[^#]*)#(.*)/) | ||
file_match = place.match(%r{^file://(.*)}) | ||
if git_match | ||
git, branch = git_match.captures | ||
[fake_version, { git: git, branch: branch, require: false }].compact | ||
elsif file_match | ||
file_path = file_match[1] | ||
['>= 0', { path: File.expand_path(file_path), require: false }] | ||
else | ||
[place, { require: false }] | ||
end | ||
end | ||
|
||
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || "~> 3.10") | ||
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.2") | ||
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 1.0") | ||
gem 'beaker-puppet', *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 0.15') | ||
gem 'rake', "~> 12.1" | ||
gem 'rototiller' | ||
|
||
if File.exist? "Gemfile.local" | ||
eval_gemfile "Gemfile.local" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rototiller' | ||
require_relative 'lib/acceptance/ace_setup_helper' | ||
|
||
# rubocop:disable Style/MixinUsage | ||
extend Acceptance::AceSetupHelper | ||
# rubocop:enable Style/MixinUsage | ||
|
||
namespace :test do | ||
desc "Run ace acceptance tests against a published gem" | ||
|
||
desc "Run ace acceptance tests against a git repo" | ||
|
||
desc "Run ace acceptance tests against a package" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
{ | ||
pre_suite: [], | ||
load_path: './lib/acceptance' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
{ | ||
pre_suite: [], | ||
load_path: './lib/acceptance', | ||
ssh: { forward_agent: false } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
{ | ||
pre_suite: [], | ||
load_path: './lib/acceptance' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
module Acceptance | ||
module AceCommandHelper | ||
# A helper to build a bolt command used in acceptance testing | ||
# @param [Beaker::Host] host the host to execute the command on | ||
# @param [String] command the command to execute on the bolt SUT | ||
# @param [Hash] flags the command flags to append to the command | ||
# @option flags [String] '--nodes' the nodes to run on | ||
# @option flags [String] '--user' the user to run the command as | ||
# @option flags [String] '--password' the password for the user | ||
# @option flags [nil] '--no-host-key-check' specify nil to use | ||
# @option flags [nil] '--no-ssl' specify nil to use | ||
# @param [Hash] opts the options hash for this method | ||
def bolt_command_on(host, command, flags = {}, opts = {}) | ||
bolt_command = command.dup | ||
flags.each { |k, v| bolt_command << " #{k} #{v}" } | ||
|
||
case host['platform'] | ||
when /windows/ | ||
execute_powershell_script_on(host, bolt_command, opts) | ||
when /osx/ | ||
# Ensure Bolt runs with UTF-8 under macOS. Otherwise we get issues with | ||
# UTF-8 content in task results. | ||
env = 'source /etc/profile ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8' | ||
on(host, env + ' ' + bolt_command) | ||
else | ||
on(host, bolt_command, opts) | ||
end | ||
end | ||
|
||
def default_boltdir | ||
@default_boltdir ||= begin | ||
query = bolt['platform'] =~ /windows/ ? 'cygpath -m $(printenv HOME)' : 'printenv HOME' | ||
home = on(bolt, query).stdout.chomp | ||
File.join(home, '.puppetlabs/bolt') | ||
end | ||
end | ||
|
||
def modulepath(extra) | ||
case bolt['platform'] | ||
when /windows/ | ||
"\"#{default_boltdir}/modules;#{extra}\"" | ||
else | ||
"#{default_boltdir}/modules:#{extra}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
module Acceptance | ||
module AceSetupHelper | ||
def ssh_user | ||
ENV['SSH_USER'] || 'root' | ||
end | ||
|
||
def ssh_password | ||
ENV['SSH_PASSWORD'] || 'bolt_secret_password' | ||
end | ||
|
||
def winrm_user | ||
ENV['WINRM_USER'] || 'Administrator' | ||
end | ||
|
||
def winrm_password | ||
ENV['WINRM_PASSWORD'] || 'bolt_secret_password' | ||
end | ||
|
||
def gem_version | ||
ENV['GEM_VERSION'] || '> 0.1.0' | ||
end | ||
|
||
def gem_source | ||
ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
end | ||
|
||
def git_server | ||
ENV['GIT_SERVER'] || 'https://github.com' | ||
end | ||
|
||
def git_fork | ||
ENV['GIT_FORK'] || 'puppetlabs/bolt' | ||
end | ||
|
||
def git_branch | ||
ENV['GIT_BRANCH'] || 'master' | ||
end | ||
|
||
def git_sha | ||
ENV['GIT_SHA'] || '' | ||
end | ||
end | ||
end |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.