Skip to content

Commit 72bd085

Browse files
authored
Merge pull request puppetlabs#148 from puppetlabs/pdksync_abs
pdksync - Use abs instead of vmpooler to provision test resources
2 parents 9882ba2 + a1d908c commit 72bd085

File tree

2 files changed

+2
-78
lines changed

2 files changed

+2
-78
lines changed

provision.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ travis_el7:
1818
provisioner: docker
1919
images: ['litmusimage/centos:7', 'litmusimage/oraclelinux:7', 'litmusimage/scientificlinux:7']
2020
release_checks:
21-
provisioner: vmpooler
21+
provisioner: abs
2222
images: ['redhat-5-x86_64', 'redhat-6-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'centos-5-x86_64', 'centos-6-x86_64', 'centos-7-x86_64', 'centos-8-x86_64', 'oracle-5-x86_64', 'oracle-6-x86_64', 'oracle-7-x86_64', 'scientific-6-x86_64', 'scientific-7-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64', 'win-2008r2-x86_64', 'win-2012r2-x86_64', 'win-2016-x86_64', 'win-10-pro-x86_64']

spec/spec_helper_acceptance.rb

+1-77
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'serverspec'
43
require 'puppet_litmus'
54
require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))
6-
include PuppetLitmus
75

8-
if ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost'
9-
puts 'Running tests against this machine !'
10-
if Gem.win_platform?
11-
set :backend, :cmd
12-
else
13-
set :backend, :exec
14-
end
15-
else
16-
# load inventory
17-
inventory_hash = inventory_hash_from_inventory_file
18-
node_config = config_from_node(inventory_hash, ENV['TARGET_HOST'])
19-
20-
if target_in_group(inventory_hash, ENV['TARGET_HOST'], 'docker_nodes')
21-
host = ENV['TARGET_HOST']
22-
set :backend, :docker
23-
set :docker_container, host
24-
elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'ssh_nodes')
25-
set :backend, :ssh
26-
options = Net::SSH::Config.for(host)
27-
options[:user] = node_config.dig('ssh', 'user') unless node_config.dig('ssh', 'user').nil?
28-
options[:port] = node_config.dig('ssh', 'port') unless node_config.dig('ssh', 'port').nil?
29-
options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil?
30-
options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil?
31-
# Support both net-ssh 4 and 5.
32-
# rubocop:disable Metrics/BlockNesting
33-
options[:verify_host_key] = if node_config.dig('ssh', 'host-key-check').nil?
34-
# Fall back to SSH behavior. This variable will only be set in net-ssh 5.3+.
35-
if @strict_host_key_checking.nil? || @strict_host_key_checking
36-
Net::SSH::Verifiers::Always.new
37-
else
38-
# SSH's behavior with StrictHostKeyChecking=no: adds new keys to known_hosts.
39-
# If known_hosts points to /dev/null, then equivalent to :never where it
40-
# accepts any key beacuse they're all new.
41-
Net::SSH::Verifiers::AcceptNewOrLocalTunnel.new
42-
end
43-
elsif node_config.dig('ssh', 'host-key-check')
44-
if defined?(Net::SSH::Verifiers::Always)
45-
Net::SSH::Verifiers::Always.new
46-
else
47-
Net::SSH::Verifiers::Secure.new
48-
end
49-
elsif defined?(Net::SSH::Verifiers::Never)
50-
Net::SSH::Verifiers::Never.new
51-
else
52-
Net::SSH::Verifiers::Null.new
53-
end
54-
# rubocop:enable Metrics/BlockNesting
55-
host = if ENV['TARGET_HOST'].include?(':')
56-
ENV['TARGET_HOST'].split(':').first
57-
else
58-
ENV['TARGET_HOST']
59-
end
60-
set :host, options[:host_name] || host
61-
set :ssh_options, options
62-
set :request_pty, true
63-
elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'winrm_nodes')
64-
require 'winrm'
65-
66-
set :backend, :winrm
67-
set :os, family: 'windows'
68-
user = node_config.dig('winrm', 'user') unless node_config.dig('winrm', 'user').nil?
69-
pass = node_config.dig('winrm', 'password') unless node_config.dig('winrm', 'password').nil?
70-
endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
71-
72-
opts = {
73-
user: user,
74-
password: pass,
75-
endpoint: endpoint,
76-
operation_timeout: 300,
77-
}
78-
79-
winrm = WinRM::Connection.new opts
80-
Specinfra.configuration.winrm = winrm
81-
end
82-
end
6+
PuppetLitmus.configure!

0 commit comments

Comments
 (0)