#2 Add smoke tests
Closed 2 years ago by yselkowitz. Opened 4 years ago by hhorak.
rpms/ hhorak/source-to-image add-smoke-test  into  f30

file added
+1
@@ -0,0 +1,1 @@ 

+ 1

@@ -0,0 +1,1 @@ 

+ 1

file added
+64
@@ -0,0 +1,64 @@ 

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile 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.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ export TEST=/CoreOS/source-to-image/Sanity/smoke

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	test -x runtest.sh || chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Lukas Zachar <lzachar@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Smoke with two example from github" >> $(METADATA)

+ 	@echo "Type:            Sanity" >> $(METADATA)

+ 	@echo "TestTime:        30m" >> $(METADATA)

+ 	@echo "RunFor:          source-to-image" >> $(METADATA)

+ 	@echo "Requires:        source-to-image" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 	@echo "Releases:        -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

file added
+5
@@ -0,0 +1,5 @@ 

+ PURPOSE of /CoreOS/source-to-image/Sanity/smoke

+ Description: Smoke with two example from github

+ Author: Lukas Zachar <lzachar@redhat.com>

+ 

+ Runs 2 examples from openshift

@@ -0,0 +1,5 @@ 

+ component: source-to-image

+ description: |

+     Runs 2 examples from openshift

+ duration: 30m

+ summary: Smoke with two example from github

@@ -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"

Can't something more recent, and multi-arch enabled, be used here?

+         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

file added
+9
@@ -0,0 +1,9 @@ 

+ - hosts: localhost

+   tags:

+   - classic

+   roles:

+   - role: standard-test-beakerlib

+     tests:

+     - smoke

+     required_packages:

+     - docker

no initial comment

Can't something more recent, and multi-arch enabled, be used here?

Can't something more recent, and multi-arch enabled, be used here?

And same for wildfly later on?

Pull-Request has been closed by yselkowitz

2 years ago