From d51d7fc445a5d7f5f1bd795a9c683e900ffbb912 Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: Feb 19 2018 11:16:39 +0000 Subject: bundler-unit-tests: add fixes for Fedora This patch adds various fixes to the test case, so it can be executed on Fedora. Also fixes obvious issues with quoting in if statements. Signed-off-by: Miroslav Vadkerti --- diff --git a/bundler-unit-tests/runtest.sh b/bundler-unit-tests/runtest.sh old mode 100644 new mode 100755 index 2248a5d..2611da0 --- a/bundler-unit-tests/runtest.sh +++ b/bundler-unit-tests/runtest.sh @@ -41,12 +41,12 @@ BUILD_INSTALLED=false rlJournalStart rlPhaseStartSetup rlAssertRpm --all - rlRun "rlImport distribution/sundry" 0 "Importing sundry library" || rlDie rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "cp builders.patch $TmpDir" 0 rlRun "pushd $TmpDir" - if [[ ! -z $COLLECTIONS ]] + if [[ -n "$COLLECTIONS" ]] then + rlRun "rlImport distribution/sundry" 0 "Importing sundry library" || rlDie rlRun "sundryFetchBuildForInstalledPackage $COLL" 0 "Fetching -build sub-package for $COLL" rlRun "sundryFetchBuildForInstalledPackage $COLL" 0 "Fetching -build sub-package for $COLL" rlRun "yum -y localinstall $COLL-build*.rpm && BUILD_INSTALLED=true" 0 "Installing $COLL-build package" @@ -62,13 +62,15 @@ rlJournalStart SRC_PATH="$TmpDir/BUILD/$BUNDLER-$VERSION" # if we are in collections we need to set correct path and prepare for enabling ror - if [[ ! -z $COLLECTIONS ]] + if [[ -n "$COLLECTIONS" ]] then COLL_PATH=$(which bundler | sed 's/\/usr\/bin\/bundler//') RUN_RSPEC="scl enable $(echo $COLLECTIONS | grep -Eo '\b(rh-)?ror[0-9]*\b'|tail -1) 'rspec spec'" fi rlRun "pushd $SRC_PATH$COLL_PATH/usr/share/gems/gems/bundler-$VERSION/" 0 "Go to gem install dir" - if [[ -z $COLLECTIONS ]] + + # on RHEL6/7 without collections we need to fix valid certs + if [ -z "$COLLECTIONS" ] && rlIsRHEL '<=7' then rlRun "su rubyuser -c \"patch spec/support/builders.rb $TmpDir/builders.patch\"" 0 \ "Patching builders.rb with new valid certificates so some set of tests won't fail" @@ -84,7 +86,9 @@ rlJournalStart # https://github.com/carlhuda/bundler/issues/2022 su rubyuser -c "git init" - if [[ -z $COLLECTIONS ]] + # on RHEL6/7 without collections use additional dependencies from the system + set -x + if [ -z "$COLLECTIONS" ] && rlIsRHEL '<=7' then # Test with system net-http-persistent and thor for dependency in net-http-persistent thor @@ -103,6 +107,7 @@ rlJournalStart GEMS="rspec-mocks rspec-support rspec-expectations rspec-core rspec diff-lcs" rlRun "gem install $GEMS" 0 "Installing $GEMS" fi + set +x rlPhaseEnd rlPhaseStartTest @@ -111,7 +116,7 @@ rlJournalStart rlPhaseEnd rlPhaseStartCleanup - if [[ -z $COLLECTIONS ]] + if [ -z "$COLLECTIONS" ] && rlIsRHEL '<=7' then rlRun "gem uninstall $GEMS -a -I -x --force" 0 "Removing installed gems" fi