SERVER-55460 Fix RPM packaging and package testing for SLES 12

Some versions of SLES apparently don't define the _sharedstatedir RPM
macro properly, leaving it at the old-time UNIX /usr/com default. This
was causing the server to fail to start on such platforms because the
expected data directory at /var/lib/mongodb was missing. The macro is
now statically defined on SLES to /var like it should be on any modern
Linux distribution.

Also fixed were paths to systemd unit files in package testing and the
fact that we weren't installing the tools-extra package, which we should
be doing if only to verify that the script indeed continues to fail
expectedly on the platform.

(cherry picked from commit 649dc04027)
This commit is contained in:
Ryan Egesdahl 2021-04-02 10:58:12 -07:00 committed by Evergreen Agent
parent 3076499da3
commit 31a75fa034
10 changed files with 84 additions and 2 deletions

View File

@ -136,6 +136,12 @@ if platform_family? 'suse'
cwd homedir
end
execute 'install mongo tools' do
command 'zypper --no-gpg-checks -n install `find . -name "*tools-extra*.rpm"`'
live_stream true
cwd homedir
end
execute 'install mongo' do
command 'zypper --no-gpg-checks -n install `find . -name "*shell*.rpm"`'
live_stream true

View File

@ -68,6 +68,11 @@ if os[:arch] == 'x86_64'
its('exit_status') { should eq 0 }
its('stderr') { should eq '' }
end
elsif os[:name] == 'suse'
describe command("install_compass") do
its('exit_status') { should eq 1 }
its('stderr') { should match /You are using an unsupported platform/ }
end
else
describe command("install_compass") do
its('exit_status') { should eq 1 }
@ -77,7 +82,7 @@ if os[:arch] == 'x86_64'
else
describe command("install_compass") do
its('exit_status') { should eq 1 }
its('stderr') { should match /Sorry, MongoDB Compass is only supported on 64-bit Intel platforms./ }
its('stderr') { should match /Sorry, MongoDB Compass is only supported on 64-bit Intel platforms/ }
end
end
@ -130,7 +135,14 @@ if sysvinit
end
if systemd
describe file('/lib/systemd/system/mongod.service') do
unit_file_prefix = ''
if os[:name] == 'suse'
# Putting systemd unit files in /usr, which may be a separate partition
# and therefore not available during isolated startups, is bad practice.
# But it's what SUSE has chosen to do, so we have to deal with it.
unit_file_prefix = '/usr'
end
describe file("#{unit_file_prefix}/lib/systemd/system/mongod.service") do
it { should be_file }
end
end

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

View File

@ -1,3 +1,11 @@
%if 0%{?suse_version}
%define _sharedstatedir %{_localstatedir}/lib
%endif
%if ! %{defined _docdir}
%define _docdir %{_datadir}/doc
%endif
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif