Skip to content

Commit

Permalink
testing docker memory reduction and non-parallel jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Jan 29, 2024
1 parent 279caea commit 466c7f4
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 26 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ on:
- 'AUTHORS'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Spec:
uses: "./.github/workflows/module_ci.yml"
secrets: "inherit"

Acceptance:
needs: Spec
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
uses: "./.github/workflows/module_acceptance.yml"
secrets: "inherit"
with:
runs_on: "ubuntu-20.04"
runs_on: "ubuntu-latest"
flags: "--exclude-platforms '[\"ubuntu-18.04\",\"scientific-7\"]'" # TODO: remove when module dependencies are sorted
15 changes: 0 additions & 15 deletions .github/workflows/mend.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/module_acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# This is a generic workflow for Puppet module acceptance operations.
name: "Module Acceptance"

on:
workflow_call:
inputs:
runs_on:
description: "The operating system used for the runner."
required: false
default: "ubuntu-latest"
type: "string"
flags:
description: "Additional flags to pass to matrix_from_metadata_v2."
required: false
default: ''
type: "string"

jobs:

setup_matrix:
name: "Setup Test Matrix"
runs-on: ${{ inputs.runs_on }}
outputs:
acceptance_matrix: ${{ steps.get-matrix.outputs.matrix }}

steps:

- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: Setup Test Matrix
id: get-matrix
run: |
bundle exec matrix_from_metadata_v2 ${{ inputs.flags }}
acceptance:
name: "Acceptance tests (${{matrix.platforms.label}}, ${{matrix.collection}})"
needs: "setup_matrix"
runs-on: ${{ inputs.runs_on }}
timeout-minutes: 30
strategy:
max-parallel: 6
fail-fast: false
matrix: ${{ fromJson( needs.setup_matrix.outputs.acceptance_matrix ) }}

env:
PUPPET_GEM_VERSION: '~> 7.24'
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set?

steps:

- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Provision environment"
run: |
if [[ "${{matrix.platforms.provider}}" == "docker" ]]; then
DOCKER_RUN_OPTS="docker_run_opts: {'--volume': '/lib/modules/$(uname -r):/lib/modules/$(uname -r)'}"
else
DOCKER_RUN_OPTS=''
fi
bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }},$DOCKER_RUN_OPTS]"
# Redact password
FILE='spec/fixtures/litmus_inventory.yaml'
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
- name: "Install Puppet agent"
run: |
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
- name: "Install module"
run: |
bundle exec rake 'litmus:install_module'
- name: "Run acceptance tests"
run: |
bundle exec rake 'litmus:acceptance'
- name: "Remove test environment"
if: ${{ always() }}
continue-on-error: true
run: |
if [[ -f spec/fixtures/litmus_inventory.yaml ]]; then
bundle exec rake 'litmus:tear_down'
fi
2 changes: 0 additions & 2 deletions .rspec_parallel

This file was deleted.

38 changes: 31 additions & 7 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
<<~PP
# FIXME: temporary work-around for EL installs
if $facts['os']['family'] == 'RedHat' {
file { '/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-RHEL-new':
source => "https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL${facts['os']['release']['major']}",
$gpg_key_file = $facts['os']['release']['major'] ? {
'7' => 'PGDG-RPM-GPG-KEY-RHEL7',
default => 'PGDG-RPM-GPG-KEY-RHEL',
}
file { "/etc/pki/rpm-gpg/${gpg_key_file}":
source => "https://download.postgresql.org/pub/repos/yum/keys/${gpg_key_file}",
}
-> Yumrepo <| tag == 'postgresql::repo' |> {
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-RHEL-new',
gpgkey => "file:///etc/pki/rpm-gpg/${gpg_key_file}",
}
}
Expand All @@ -25,8 +29,11 @@
ensure => installed,
}
# savagely disable dropsonde
-> file { '/opt/puppetlabs/server/apps/puppetserver/cli/apps/dropsonde':
ensure => absent,
-> file { '/opt/puppetlabs/server/data/puppetserver/dropsonde':
ensure => absent,
recurse => true,
force => true,
max_files => 6000,
}
-> exec { '/opt/puppetlabs/bin/puppetserver ca setup':
creates => '/etc/puppetlabs/puppetserver/ca/ca_crt.pem',
Expand All @@ -43,8 +50,25 @@
enable => true,
}
# reduce pgs memory
postgresql::server::config_entry { 'max_connections': value => '20' }
postgresql::server::config_entry { 'shared_buffers': value => '128kB' }
postgresql::server::config_entry { 'effective_cache_size': value => '24MB' }
postgresql::server::config_entry { 'maintenance_work_mem': value => '1MB' }
postgresql::server::config_entry { 'checkpoint_completion_target': value => '0.9' }
postgresql::server::config_entry { 'wal_buffers': value => '32kB' }
postgresql::server::config_entry { 'random_page_cost': value => '4' }
postgresql::server::config_entry { 'effective_io_concurrency': value => '2' }
postgresql::server::config_entry { 'work_mem': value => '204kB' }
postgresql::server::config_entry { 'huge_pages': value => 'off' }
postgresql::server::config_entry { 'min_wal_size': value => '80MB' }
postgresql::server::config_entry { 'max_wal_size': value => '1GB' }
class { 'puppetdb':
postgres_version => #{postgres_version},
postgres_version => #{postgres_version},
java_args => { '-Xmx' => '128m' },
database_max_pool_size => '2',
read_database_max_pool_size => '2',
#{puppetdb_params}
}
-> class { 'puppetdb::master::config':
Expand Down Expand Up @@ -93,7 +117,7 @@ class { 'puppetdb':
end

context 'manage report processor', :change do
['add', 'remove'].each do |outcome|
['remove', 'add'].each do |outcome|
context "#{outcome}s puppet config puppetdb report processor" do
let(:enable_reports) { (outcome == 'add') ? true : false }

Expand Down
10 changes: 10 additions & 0 deletions spec/fixtures/before_suite.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# some provision environments (docker) may not setup or isolate domains
# this ensures the instance FQDN is always resolved locally
host { 'primary':
name => $facts['networking']['fqdn'],
ip => $facts['networking']['ip'],
host_aliases => [
$facts['networking']['hostname'],
],
}

# TODO: backport to litmusimage, required for serverspec tests
package { 'iproute': ensure => installed }

Expand Down

0 comments on commit 466c7f4

Please sign in to comment.