| |
@@ -0,0 +1,83 @@
|
| |
+ #!/bin/bash
|
| |
+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
| |
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| |
+ #
|
| |
+ # runtest.sh of /CoreOS/source-to-image/Sanity/smoke
|
| |
+ # Description: Smoke with two example from github
|
| |
+ # Author: Lukas Zachar <lzachar@redhat.com>
|
| |
+ #
|
| |
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| |
+ #
|
| |
+ # Copyright (c) 2015 Red Hat, Inc.
|
| |
+ #
|
| |
+ # 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
|
| |
+ . /usr/bin/rhts-environment.sh || exit 1
|
| |
+ . /usr/share/beakerlib/beakerlib.sh || exit 1
|
| |
+
|
| |
+ PACKAGE="source-to-image"
|
| |
+
|
| |
+ clean_container(){
|
| |
+ local c_hash=$1
|
| |
+ docker kill $c_hash
|
| |
+ local c_image=$(docker inspect --format '{{.Config.Image}}' $c_hash)
|
| |
+ docker rm $c_hash
|
| |
+ docker rmi $c_image
|
| |
+ }
|
| |
+
|
| |
+ rlJournalStart
|
| |
+ rlPhaseStartSetup
|
| |
+ rlAssertRpm $PACKAGE
|
| |
+ if ! yum install -y docker; then
|
| |
+ rlDie "docker package not available"
|
| |
+ fi
|
| |
+ rlServiceStart docker
|
| |
+ rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
| |
+ rlRun "pushd $TmpDir"
|
| |
+
|
| |
+ rlPhaseEnd
|
| |
+
|
| |
+ rlPhaseStartTest "ruby"
|
| |
+ rlRun "s2i build git://github.com/pmorie/simple-ruby openshift/ruby-20-centos7 test-ruby-app"
|
| |
+ rlRun "docker run -d -p :9292 test-ruby-app &> docker_id"
|
| |
+ DOCKER_HASH=$(cat docker_id)
|
| |
+ DOCKER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $DOCKER_HASH)
|
| |
+ sleep 2
|
| |
+ rlRun "curl -s http://$DOCKER_IP:8080 | grep -i 'Test STI'"
|
| |
+ clean_container $DOCKER_HASH
|
| |
+ rlPhaseEnd
|
| |
+
|
| |
+
|
| |
+ rlPhaseStartTest "java"
|
| |
+ rlRun "s2i build git://github.com/bparees/openshift-jee-sample openshift/wildfly-8-centos test-jee-app"
|
| |
+ rlRun "docker run -d -p :8080 -t test-jee-app &> docker_id"
|
| |
+ DOCKER_HASH=$(cat docker_id)
|
| |
+ docker inspect --format '{{ .NetworkSettings.IPAddress }}' $DOCKER_HASH
|
| |
+ DOCKER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $DOCKER_HASH)
|
| |
+ sleep 10
|
| |
+ rlRun "curl -s http://$DOCKER_IP:8080 | grep -i welcome"
|
| |
+ clean_container $DOCKER_HASH
|
| |
+ rlPhaseEnd
|
| |
+
|
| |
+ rlPhaseStartCleanup
|
| |
+ rlServiceRestore docker
|
| |
+ rlRun "popd"
|
| |
+ rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
| |
+ rlPhaseEnd
|
| |
+ rlJournalPrintText
|
| |
+ rlJournalEnd
|
| |
Can't something more recent, and multi-arch enabled, be used here?