Skip to content

Commit 3e30b7e

Browse files
authored
Merge pull request #1488 from puppetlabs/maint-acceptance_tests
(MAINT) Fix acceptance tests
2 parents 18813a1 + 352f6fc commit 3e30b7e

File tree

6 files changed

+246
-239
lines changed

6 files changed

+246
-239
lines changed

.github/workflows/nightly.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix: ${{ steps.get-matrix.outputs.matrix }}
1919

2020
steps:
21-
21+
2222
- name: "Honeycomb: Start recording"
2323
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
2424
with:
@@ -47,23 +47,23 @@ jobs:
4747
echo ::group::bundler environment
4848
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
4949
echo ::endgroup::
50-
50+
5151
- name: "Honeycomb: Record Setup Environment time"
5252
if: ${{ github.repository_owner == 'puppetlabs' }}
5353
run: |
5454
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
5555
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
5656
echo STEP_START=$(date +%s) >> $GITHUB_ENV
57+
5758
- name: Setup Acceptance Test Matrix
5859
id: get-matrix
59-
if: ${{ github.repository_owner == 'puppetlabs' }}
6060
run: |
6161
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
62-
echo "::set-output name=matrix::{'platforms':[{'label':'AlmaLinux-8','provider':'provision::docker','image':'litmusimage/almalinux:8'},{'label':'CentOS-7','provider':'provision::docker','image':'litmusimage/centos:7'},{'label':'CentOS-8','provider':'provision::docker','image':'litmusimage/centos:stream8'},{'label':'Debian-10','provider':'provision::provision_service','image':'debian-10'},{'label':'Debian-11','provider':'provision::provision_service','image':'debian-11'},{'label':'Debian-9','provider':'provision::provision_service','image':'debian-9'},{'label':'OracleLinux-6','provider':'provision::docker','image':'litmusimage/oraclelinux:6'},{'label':'OracleLinux-7','provider':'provision::docker','image':'litmusimage/oraclelinux:7'},{'label':'RedHat-7','provider':'provision::provision_service','image':'rhel-7'},{'label':'RedHat-8','provider':'provision::provision_service','image':'rhel-8'},{'label':'Rocky-8','provider':'provision::docker','image':'litmusimage/rockylinux:8'},{'label':'SLES-12','provider':'provision::provision_service','image':'sles-12'},{'label':'SLES-15','provider':'provision::provision_service','image':'sles-15'},{'label':'Scientific-6','provider':'provision::docker','image':'litmusimage/scientificlinux:6'},{'label':'Scientific-7','provider':'provision::docker','image':'litmusimage/scientificlinux:7'},{'label':'Ubuntu-18.04','provider':'provision::docker','image':'litmusimage/ubuntu:18.04'},{'label':'Ubuntu-20.04','provider':'provision::provision_service','image':'ubuntu-2004-lts'},{'label':'Ubuntu-22.04','provider':'provision::provision_service','image':'ubuntu-2204-lts'}],'collection':['puppet6-nightly','puppet7-nightly']}"
62+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
6363
else
6464
echo "::set-output name=matrix::{}"
6565
fi
66-
66+
6767
- name: "Honeycomb: Record Setup Test Matrix time"
6868
if: ${{ always() }}
6969
run: |
@@ -123,6 +123,12 @@ jobs:
123123
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
124124
echo STEP_START=$(date +%s) >> $GITHUB_ENV
125125
126+
- name: "Disable mysqld apparmor profile"
127+
if: matrix.platforms.provider == 'provision::docker'
128+
run: |
129+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
130+
sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld
131+
126132
- name: Provision test environment
127133
run: |
128134
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'

.github/workflows/pr_test.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ jobs:
6161
id: get-matrix
6262
run: |
6363
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
64-
echo "::set-output name=matrix::{'platforms':[{'label':'AlmaLinux-8','provider':'provision::docker','image':'litmusimage/almalinux:8'},{'label':'CentOS-7','provider':'provision::docker','image':'litmusimage/centos:7'},{'label':'CentOS-8','provider':'provision::docker','image':'litmusimage/centos:stream8'},{'label':'Debian-10','provider':'provision::provision_service','image':'debian-10'},{'label':'Debian-11','provider':'provision::provision_service','image':'debian-11'},{'label':'Debian-9','provider':'provision::provision_service','image':'debian-9'},{'label':'OracleLinux-6','provider':'provision::docker','image':'litmusimage/oraclelinux:6'},{'label':'OracleLinux-7','provider':'provision::docker','image':'litmusimage/oraclelinux:7'},{'label':'RedHat-7','provider':'provision::provision_service','image':'rhel-7'},{'label':'RedHat-8','provider':'provision::provision_service','image':'rhel-8'},{'label':'Rocky-8','provider':'provision::docker','image':'litmusimage/rockylinux:8'},{'label':'SLES-12','provider':'provision::provision_service','image':'sles-12'},{'label':'SLES-15','provider':'provision::provision_service','image':'sles-15'},{'label':'Scientific-6','provider':'provision::docker','image':'litmusimage/scientificlinux:6'},{'label':'Scientific-7','provider':'provision::docker','image':'litmusimage/scientificlinux:7'},{'label':'Ubuntu-18.04','provider':'provision::docker','image':'litmusimage/ubuntu:18.04'},{'label':'Ubuntu-20.04','provider':'provision::provision_service','image':'ubuntu-2004-lts'},{'label':'Ubuntu-22.04','provider':'provision::provision_service','image':'ubuntu-2204-lts'}],'collection':['puppet6','puppet7']}"
64+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
6565
else
6666
echo "::set-output name=matrix::{}"
6767
fi
68-
68+
6969
- name: "Honeycomb: Record Setup Test Matrix time"
7070
if: ${{ always() }}
7171
run: |
7272
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
73+
7374
Acceptance:
7475
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
7576
needs:
@@ -123,6 +124,13 @@ jobs:
123124
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
124125
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
125126
echo STEP_START=$(date +%s) >> $GITHUB_ENV
127+
128+
- name: "Disable mysqld apparmor profile"
129+
if: matrix.platforms.provider == 'provision::docker'
130+
run: |
131+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
132+
sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld
133+
126134
- name: Provision test environment
127135
run: |
128136
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
@@ -148,7 +156,7 @@ jobs:
148156
- name: Install module
149157
run: |
150158
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
151-
159+
152160
- name: "Honeycomb: Record deployment times"
153161
if: ${{ always() }}
154162
run: |

spec/acceptance/00_mysql_server_spec.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require 'spec_helper_acceptance'
4-
export_locales
54

65
describe 'mysql class' do
76
describe 'advanced config' do
@@ -65,11 +64,7 @@ class { '::mysql::server':
6564

6665
it 'can be set' do
6766
apply_manifest(pp, catch_failures: true) do |r|
68-
if (os[:family] == 'debian' && os[:release].to_i > 9) && Gem::Version.new(run_shell('puppet --version').stdout) < Gem::Version.new('7.0.0')
69-
expect(r.stderr).to match(%r{locale environment variables were bad; continuing with LANG=C LC_ALL=C})
70-
else
71-
expect(r.stderr).to be_empty
72-
end
67+
expect(r.stderr).to be_empty
7368
end
7469
end
7570
end

spec/acceptance/04_mysql_backup_spec.rb

Lines changed: 0 additions & 209 deletions
Original file line numberDiff line numberDiff line change
@@ -129,213 +129,4 @@ class { 'mysql::server::backup':
129129
end
130130
end
131131
end
132-
133-
context 'with xtrabackup enabled' do
134-
context 'should work with no errors', if: ((os[:family] == 'debian') || (os[:family] == 'ubuntu') || (os[:family] == 'redhat' && os[:release].to_i > 7)) do
135-
pp = <<-MANIFEST
136-
class { 'mysql::server': root_password => 'password' }
137-
mysql::db { [
138-
'backup1',
139-
'backup2'
140-
]:
141-
user => 'backup',
142-
password => 'secret',
143-
charset => '#{fetch_charset}',
144-
collate => '#{fetch_charset}_general_ci',
145-
}
146-
case $facts['os']['family'] {
147-
/Debian/: {
148-
$source_url = "http://repo.percona.com/apt/percona-release_latest.${facts['os']['distro']['codename']}_all.deb"
149-
150-
file { '/tmp/percona-release_latest.deb':
151-
ensure => present,
152-
source => $source_url,
153-
}
154-
ensure_packages('gnupg')
155-
ensure_packages('gnupg2')
156-
ensure_packages('curl')
157-
ensure_packages('percona-release',{
158-
ensure => present,
159-
provider => 'dpkg',
160-
source => '/tmp/percona-release_latest.deb',
161-
notify => Exec['apt-get update'],
162-
})
163-
exec { 'apt-get update':
164-
path => '/usr/bin:/usr/sbin:/bin:/sbin',
165-
refreshonly => true,
166-
}
167-
}
168-
/RedHat/: {
169-
# RHEL/CentOS 5 is no longer supported by Percona, but older versions
170-
# of the repository are still available.
171-
if versioncmp($::operatingsystemmajrelease, '6') >= 0 {
172-
$percona_url = 'http://repo.percona.com/yum/percona-release-latest.noarch.rpm'
173-
$epel_url = "https://download.fedoraproject.org/pub/epel/epel-release-latest-${facts['os']['release']['major']}.noarch.rpm"
174-
} else {
175-
$percona_url = 'http://repo.percona.com/yum/release/5/os/noarch/percona-release-0.1-3.noarch.rpm'
176-
$epel_url = 'https://archives.fedoraproject.org/pub/archive/epel/epel-release-latest-5.noarch.rpm'
177-
}
178-
ensure_packages('percona-release',{
179-
ensure => present,
180-
provider => 'rpm',
181-
source => $percona_url,
182-
})
183-
ensure_packages('epel-release',{
184-
ensure => present,
185-
provider => 'rpm',
186-
source => $epel_url,
187-
})
188-
if ($facts['os']['name'] == 'Scientific') {
189-
# $releasever resolves to '6.10' instead of '6' which breaks Percona repos
190-
file { '/etc/yum/vars/releasever':
191-
ensure => present,
192-
content => '6',
193-
}
194-
}
195-
}
196-
default: { }
197-
}
198-
class { 'mysql::server::backup':
199-
backupuser => 'myuser',
200-
backuppassword => 'mypassword',
201-
backupdir => '/tmp/xtrabackups',
202-
provider => 'xtrabackup',
203-
execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
204-
}
205-
MANIFEST
206-
it 'when configuring mysql backup' do
207-
idempotent_apply(pp)
208-
end
209-
end
210-
211-
describe 'xtrabackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') && ((os[:family] == 'debian' && os[:release].to_i >= 9) || (os[:family] == 'ubuntu') || (os[:family] == 'redhat' && os[:release].to_i > 7)) do # rubocop:disable Layout/LineLength
212-
it 'runs xtrabackup.sh full backup with no errors' do
213-
run_shell('/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/xtrabackups/$(date +%F)_full --backup 2>&1 | tee /tmp/xtrabackup_full.log') do |r|
214-
expect(r.exit_code).to be_zero
215-
end
216-
end
217-
218-
it 'xtrabackup reports success for the full backup' do
219-
# NOTE: Once support for CentOS 6 is dropped, we should check for "completed OK" instead.
220-
run_shell('grep "xtrabackup: Transaction log of lsn" /tmp/xtrabackup_full.log') do |r|
221-
expect(r.exit_code).to be_zero
222-
end
223-
end
224-
225-
it 'creates a subdirectory for the full backup' do
226-
run_shell('find /tmp/xtrabackups -mindepth 1 -maxdepth 1 -type d -name $(date +%Y)\*full | wc -l') do |r|
227-
expect(r.stdout).to match(%r{1})
228-
expect(r.exit_code).to be_zero
229-
end
230-
end
231-
232-
it 'runs xtrabackup.sh incremental backup with no errors' do
233-
run_shell('sleep 1')
234-
run_shell('/usr/local/sbin/xtrabackup.sh --incremental-basedir=/tmp/xtrabackups/$(date +%F)_full --target-dir=/tmp/xtrabackups/$(date +%F_%H-%M-%S) --backup 2>&1 | tee /tmp/xtrabackup_inc.log') do |r| # rubocop:disable Layout/LineLength
235-
expect(r.exit_code).to be_zero
236-
end
237-
end
238-
239-
it 'xtrabackup reports success for the incremental backup' do
240-
# NOTE: Once support for CentOS 6 is dropped, we should check for "completed OK" instead.
241-
run_shell('grep "xtrabackup: Transaction log of lsn" /tmp/xtrabackup_inc.log') do |r|
242-
expect(r.exit_code).to be_zero
243-
end
244-
end
245-
246-
it 'creates a new subdirectory for each backup' do
247-
run_shell('find /tmp/xtrabackups -mindepth 1 -maxdepth 1 -type d -name $(date +%Y)\* | wc -l') do |r|
248-
expect(r.stdout).to match(%r{2})
249-
expect(r.exit_code).to be_zero
250-
end
251-
end
252-
end
253-
end
254-
255-
context 'with xtrabackup enabled and incremental backups disabled' do
256-
context 'should work with no errors', if: ((os[:family] == 'debian') || (os[:family] == 'ubuntu') || (os[:family] == 'redhat' && os[:release].to_i > 7)) do
257-
pp = <<-MANIFEST
258-
class { 'mysql::server': root_password => 'password' }
259-
mysql::db { [
260-
'backup1',
261-
'backup2'
262-
]:
263-
user => 'backup',
264-
password => 'secret',
265-
charset => '#{fetch_charset}',
266-
collate => '#{fetch_charset}_general_ci',
267-
}
268-
case $facts['os']['family'] {
269-
/Debian/: {
270-
$source_url = "http://repo.percona.com/apt/percona-release_1.0-22.generic_all.deb"
271-
272-
file { '/tmp/percona-release_latest.deb':
273-
ensure => present,
274-
source => $source_url,
275-
}
276-
ensure_packages('gnupg')
277-
ensure_packages('gnupg2')
278-
ensure_packages('percona-release',{
279-
ensure => present,
280-
provider => 'dpkg',
281-
source => '/tmp/percona-release_latest.deb',
282-
notify => Exec['apt-get update'],
283-
})
284-
exec { 'apt-get update':
285-
path => '/usr/bin:/usr/sbin:/bin:/sbin',
286-
refreshonly => true,
287-
}
288-
}
289-
/RedHat/: {
290-
$percona_url = 'http://repo.percona.com/yum/percona-release-latest.noarch.rpm'
291-
$epel_url = "https://download.fedoraproject.org/pub/epel/epel-release-latest-${facts['os']['release']['major']}.noarch.rpm"
292-
ensure_packages('percona-release',{
293-
ensure => present,
294-
provider => 'rpm',
295-
source => $percona_url,
296-
})
297-
ensure_packages('epel-release',{
298-
ensure => present,
299-
provider => 'rpm',
300-
source => $epel_url,
301-
})
302-
if ($facts['os']['name'] == 'Scientific') {
303-
# $releasever resolves to '6.10' instead of '6' which breaks Percona repos
304-
file { '/etc/yum/vars/releasever':
305-
ensure => present,
306-
content => '6',
307-
}
308-
}
309-
}
310-
default: { }
311-
}
312-
class { 'mysql::server::backup':
313-
backupuser => 'myuser',
314-
backuppassword => 'mypassword',
315-
backupdir => '/tmp/xtrabackups',
316-
provider => 'xtrabackup',
317-
incremental_backups => false,
318-
execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
319-
}
320-
MANIFEST
321-
it 'when configuring mysql backup' do
322-
idempotent_apply(pp)
323-
end
324-
end
325-
326-
describe 'xtrabackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') && ((os[:family] == 'debian' && os[:release].to_i >= 9) || (os[:family] == 'ubuntu') || (os[:family] == 'redhat' && os[:release].to_i > 7)) do # rubocop:disable Layout/LineLength
327-
it 'runs xtrabackup.sh with no errors' do
328-
run_shell('/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/xtrabackups/$(date +%F_%H-%M-%S) --backup 2>&1 | tee /tmp/xtrabackup.log') do |r|
329-
expect(r.exit_code).to be_zero
330-
end
331-
end
332-
333-
it 'xtrabackup reports success for the backup' do
334-
# NOTE: Once support for CentOS 6 is dropped, we should check for "completed OK" instead.
335-
run_shell('grep "xtrabackup: Transaction log of lsn" /tmp/xtrabackup.log') do |r|
336-
expect(r.exit_code).to be_zero
337-
end
338-
end
339-
end
340-
end
341132
end

0 commit comments

Comments
 (0)