Add beaker tests for nodepool

Add tests for the nodepool launcher and builder. Since by default this
uses the nodepool configuration found in openstack-infra/project-config,
fudge the hostnames so that it can find a real config file.

Depends-On: https://review.openstack.org/577519
Change-Id: I036c1afc0414f846c9112ef5bc5f3abd486f3147
This commit is contained in:
Colleen Murphy 2018-06-22 21:28:02 +02:00
parent e385661db3
commit d0ee5c2cf4
8 changed files with 165 additions and 0 deletions

View File

@ -0,0 +1,3 @@
service { 'nodepool-builder':
ensure => running,
}

View File

@ -0,0 +1,16 @@
exec { 'change hostname':
command => '/bin/hostname nb03'
}
host { 'nb01.openstack.org':
host_aliases => 'nb01',
ip => '127.0.1.1',
}
# The cloud-utils package (specifically its euca2ools dependency) on an Ubuntu
# Trusty image created by DIB pulls in python[3]-six, which causes conflicts
# when used with pip 10. We don't need cloud-utils once the image has been
# built, so remove it and allow pip to manage six.
package { ['python-six', 'python3-six']:
ensure => absent,
}

View File

@ -0,0 +1,16 @@
$public_key = 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEGQmNT7NQLsyTyFBJnYe5RR/yrvsE1VYB+hF6LmRjo14oiC7aZsmDhbe9JRRM/2JvDBhlGlM7bNcUmXAVSp0c8='
$clouds_yaml = ''
class { '::openstackci::nodepool_builder':
nodepool_ssh_public_key => $public_key,
vhost_name => $::fqdn,
enable_build_log_via_http => true,
project_config_repo => 'https://git.openstack.org/openstack-infra/project-config',
oscc_file_contents => $clouds_yaml,
statsd_host => 'graphite.openstack.org',
upload_workers => '16',
revision => 'master',
python_version => 3,
zuulv3 => true,
}

View File

@ -0,0 +1,3 @@
service { 'nodepool-launcher':
ensure => running,
}

View File

@ -0,0 +1,8 @@
exec { 'change hostname':
command => '/bin/hostname nl04'
}
host { 'nl04.openstack.org':
host_aliases => 'nl04',
ip => '127.0.1.1',
}

View File

@ -0,0 +1,17 @@
$private_key = '-----BEGIN EC PRIVATE KEY-----
MHcCAQEEILEJO9HQBHkih1m+w+VA9YmoKvuyeHlg8rE1M48swE2roAoGCCqGSM49
AwEHoUQDQgAEQZCY1Ps1AuzJPIUEmdh7lFH/Ku+wTVVgH6EXouZGOjXiiILtpmyY
OFt70lFEz/Ym8MGGUaUzts1xSZcBVKnRzw==
-----END EC PRIVATE KEY-----'
$clouds_yaml = ''
class { '::openstackci::nodepool_launcher':
nodepool_ssh_private_key => $private_key,
project_config_repo => 'https://git.openstack.org/openstack-infra/project-config',
oscc_file_contents => $clouds_yaml,
statsd_host => 'graphite.openstack.org',
revision => 'master',
python_version => 3,
enable_webapp => true,
}

View File

@ -0,0 +1,51 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'nodepool builder', :if => (
['debian', 'ubuntu'].include?(os[:family]) &&
# builder is not expected to work with python < 3.5 since its config
# depends on math.inf
os[:release] >= '16.04'
) do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures', 'nodepool')
end
def preconditions_puppet_manifest
module_path = File.join(pp_path, 'builder-preconditions.pp')
File.read(module_path)
end
def postconditions_puppet_manifest
module_path = File.join(pp_path, 'builder-postconditions.pp')
File.read(module_path)
end
before(:all) do
apply_manifest(preconditions_puppet_manifest, catch_failures: true)
end
def puppet_manifest
module_path = File.join(pp_path, 'builder.pp')
File.read(module_path)
end
it 'should work with no errors' do
apply_manifest(puppet_manifest, catch_failures: true)
end
it 'should be idempotent' do
apply_manifest(puppet_manifest, catch_changes: true)
end
it 'should start' do
apply_manifest(postconditions_puppet_manifest, catch_failures: true)
end
describe command("systemctl status nodepool-builder") do
its(:stdout) { should contain('Active: active') }
its(:stdout) { should_not contain('dead') }
end
end

View File

@ -0,0 +1,51 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'nodepool launcher', :if => (
['debian', 'ubuntu'].include?(os[:family]) &&
# launcher is not expected to work with python < 3.5 since its config
# depends on math.inf
os[:release] >= '16.04'
) do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures', 'nodepool')
end
def preconditions_puppet_manifest
module_path = File.join(pp_path, 'launcher-preconditions.pp')
File.read(module_path)
end
def postconditions_puppet_manifest
module_path = File.join(pp_path, 'launcher-postconditions.pp')
File.read(module_path)
end
before(:all) do
apply_manifest(preconditions_puppet_manifest, catch_failures: true)
end
def puppet_manifest
module_path = File.join(pp_path, 'launcher.pp')
File.read(module_path)
end
it 'should work with no errors' do
apply_manifest(puppet_manifest, catch_failures: true)
end
it 'should be idempotent' do
apply_manifest(puppet_manifest, catch_changes: true)
end
it 'should start' do
apply_manifest(postconditions_puppet_manifest, catch_failures: true)
end
describe command("systemctl status nodepool-launcher") do
its(:stdout) { should contain('Active: active') }
its(:stdout) { should_not contain('dead') }
end
end