Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ fixtures:
repo: "https://github.com/ehelms/puppet-certs.git"
branch: "advisor-certs"
extlib: 'https://github.com/voxpupuli/puppet-extlib'
foreman: "https://github.com/theforeman/puppet-foreman.git"
redis: "https://github.com/voxpupuli/puppet-redis"
podman: 'https://github.com/southalc/podman'
selinux_core: 'https://github.com/puppetlabs/puppetlabs-selinux_core'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v2
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
rubocop: false
cache-version: '1'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem 'voxpupuli-test', '~> 7.0', {"groups"=>["test"]}
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 4.0'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 3.0', {"groups"=>["system_tests"]}
gem 'voxpupuli-acceptance', '~> 3.0', groups: ["system_tests"], github: 'evgeni/voxpupuli-acceptance', branch: 'curl_command'
gem 'puppetlabs_spec_helper', {"groups"=>["system_tests"]}

# vim:ft=ruby
3 changes: 0 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,18 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "AlmaLinux",
"operatingsystemrelease": [
"8",
"9"
]
}
Expand Down
13 changes: 13 additions & 0 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper_acceptance'

describe 'basic installation' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include iop_advisor_engine
PUPPET
end
end

include_examples 'the default iop-advisor-engine application'
end
54 changes: 54 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class { 'foreman::repo':
repo => 'nightly',
}

stdlib::ensure_packages(['podman'])

$container_file = "[Unit]
Description=Advisor Engine
After=network-online.target
[Container]
Image=registry.access.redhat.com/ubi9/python-312
Exec=python /usr/local/bin/python-https-server
Comment on lines +11 to +12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously still a fake, but a much more elaborate one :D

We should be able to replace this with the "real" deal once a build is available.

Network=host
Volume=/usr/local/bin/python-https-server:/usr/local/bin/python-https-server
[Service]
Restart=always
[Install]
WantedBy=default.target
"

$python_server = "
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
import os
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile='/opt/app-root/src/cert.pem', keyfile='/opt/app-root/src/key.pem')
context.check_hostname = False
port=int(os.environ.get('IOP_ADVISOR_ENGINE_PORT', 8000))
with HTTPServer(('localhost', port), SimpleHTTPRequestHandler) as httpd:
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()
"

file { '/etc/containers/systemd/iop-advisor-engine.container':
ensure => present,
content => $container_file,
require => Package['podman'],
}

file { '/usr/local/bin/python-https-server':
ensure => present,
content => $python_server,
}

file { '/etc/foreman-proxy':
ensure => directory,
}

group { 'foreman-proxy':
ensure => present,
}
1 change: 1 addition & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'voxpupuli/acceptance/spec_helper_acceptance'
require 'voxpupuli/acceptance/serverspec_extensions'

ENV['BEAKER_setfile'] ||= 'centos8-64{hostname=centos8-64.example.com}'

Expand Down
13 changes: 13 additions & 0 deletions spec/support/acceptance/examples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
shared_examples 'the default iop-advisor-engine application' do
engine_port = 8000

describe port(engine_port) do
it { is_expected.to be_listening }
end

# FIXME: this needs to call the right "ping" endpoint once we have one
describe curl_command("https://localhost:#{engine_port}/", cacert: "/etc/pki/katello/certs/katello-default-ca.crt") do
its(:response_code) { is_expected.to eq(200) }
its(:exit_status) { is_expected.to eq 0 }
end
end