Import 3 integration tests
systemtap-static-probes-in-ruby: for testing ruby's systemtap api bundler-unit-tests: to run bundler's unit tests run-basic-rails-application: a simple rails application test Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
This commit is contained in:
commit
a4cdc02f01
11 changed files with 642 additions and 0 deletions
101
run-basic-rails-application/runtest.sh
Executable file
101
run-basic-rails-application/runtest.sh
Executable file
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/rubygem-rails/run-basic-rails-application
|
||||
# Description: Test creates new rails application and runs it
|
||||
# Author: Iveta Senfeldova <isenfeld@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh
|
||||
. /usr/lib/beakerlib/beakerlib.sh
|
||||
|
||||
PACKAGES=${PACKAGES:-ruby rubygems}
|
||||
REQUIRES=${REQUIRES:-}
|
||||
RUBY=${RUBY:-ruby}
|
||||
RAILS=0
|
||||
bundle=""
|
||||
ARCH=$(uname -m)
|
||||
RAILSVER=""
|
||||
|
||||
# if in collection get gem dependencies locally not from rubygems.org
|
||||
[ ! -z "$COLLECTIONS" ] && bundle="--local"
|
||||
|
||||
# version of Ruby on RHEL7 needs older version of rails
|
||||
if rlIsRHEL 7; then RAILSVER="-v 4.2.7"; NOKOVER="-v 1.6.8"; fi
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlAssertBinaryOrigin $RUBY
|
||||
rlAssertBinaryOrigin "gem"
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
if ! gem list "^rails \(*\)$" -i
|
||||
then
|
||||
# nokogiri gem installed with rails needs to use system libraries
|
||||
# on arm and ppcle otherwise it fails with bundled libraries
|
||||
if [ "x$ARCH" = "xaarch64" ] || [ "x$ARCH" = "xppc64le" ]
|
||||
then
|
||||
export NOKOGIRI_USE_SYSTEM_LIBRARIES=yes
|
||||
fi
|
||||
rlRun "gem install nokogiri $NOKOVER --no-document" 0 "Installing nokogiri $NOKOVER without documentation"
|
||||
rlRun "gem install rails $RAILSVER --no-document" 0 "Installing rails $RAILSVER without documentation"
|
||||
RAILS=1
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "rails new app | tee bundle.log" 0 "Creating new rails application"
|
||||
[ ! -z "$COLLECTIONS" ] && rlAssertGrep "bundle install --local" bundle.log || rlAssertNotGrep "bundle install --local" bundle.log
|
||||
rlRun "pushd app/"
|
||||
rlAssertExists "app"
|
||||
|
||||
if [[ ! "$COLLECTIONS" =~ "rh-ror50" ]]
|
||||
then
|
||||
rlRun "echo \"gem 'therubyracer'\" >> Gemfile" 0 "Adding therubyracer gem into Gemfile"
|
||||
fi
|
||||
|
||||
if [ -z "$COLLECTIONS" ]
|
||||
then
|
||||
rlRun "echo \"gem 'nokogiri', '1.6.8'\" >> Gemfile" 0 "Adding nokogiri gem into Gemfile"
|
||||
sed -i "s/gem 'spring'/#gem 'spring'/" Gemfile
|
||||
rlRun "gem pristine nokogiri" 0 "Restore installed nokogiri to pristine condition"
|
||||
rlRun "bundle config build.nokogiri --use-system-libraries" 0 "Build nokogiri with system libraries"
|
||||
fi
|
||||
rlRun "bundle install $bundle"
|
||||
rlRun "netstat -tulpn | grep 3000" 1 "Check if port 3000 isn't engaged"
|
||||
rlRun "rails server &" 0 "Running rails server"
|
||||
sleep 10
|
||||
rlRun "wget http://0.0.0.0:3000" 0 "Wgetting running rails application"
|
||||
PID=`pidof ruby`
|
||||
rlRun "kill -9 $PID" 0 "Killing rails server"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd; popd"
|
||||
[ $RAILS == 1 ] && rlRun "gem uninstall rails nokogiri minitest -a -I -x" 0 "Removing rails and nokogiri gem"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue