Skip to content

Commit

Permalink
FAB-5208 create release testsuite
Browse files Browse the repository at this point in the history
Create release test suite in test/regression/release folder
to run release tests after each release is created. We run this
for every job and look for the IS_RELEASE condition. If the
condition satisfies, job executes all release tests otherwise will
skip tests.

Will run this job in silent mode and disable gerrit
voting.

Instructions to run this patch:

clone fabric repo
cd test/regression/release
./runReleaseTestSuite.sh

Change-Id: If45bcdeee4f5ecb28df405815718fe6a8ee2b583
Signed-off-by: rameshthoomu <rameshbabu.thoomu@gmail.com>
  • Loading branch information
rameshthoomu committed Jul 11, 2017
1 parent 4709b33 commit 346c00b
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 0 deletions.
62 changes: 62 additions & 0 deletions test/regression/release/byfn_release_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

import unittest
import subprocess

class byfn_cli_release_tests(unittest.TestCase):

def test_byfn_cli_default_channel(self):
'''
In this cli test, we execute the byfn_cli tests on published release
docker images and pull published fabric binaries and perform tests on
fabric-samples repository.
Passing criteria: byfn_cli test completed successfully with
exit code 0
'''
logfile = open("output_byfn_cli_default_channel.log", "w")
returncode = subprocess.call(
"./run_byfn_cli_release_tests.sh",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="test_byfn_cli_default_channel "
"tests are failed. \nPlease check the logfile "
+logfile.name+" for more details.")

def test_byfn_cli_custom_channel(self):
'''
In this cli test, we execute the byfn_cli tests on published release
docker images and pull published fabric binaries and perform tests on
fabric-samples repository.
Passing criteria: test_byfn_cli_custom_channel test completed successfully with
exit code 0
'''
logfile = open("output_byfn_cli_custom_channel.log", "w")
returncode = subprocess.call(
"././run_byfn_cli_release_tests.sh byfnchannel",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="test_byfn_cli_custom_channel "
"tests are failed. \nPlease check the logfile "
+logfile.name+" for more details.")

def test_node_sdk_byfn(self):
'''
In this node_sdk_byfn test, we pull published docker images from
docker hub account and verify integration tests.
Passing criteria: Underlying node_sdk byfn tests are completed successfully
with exit code 0
'''
logfile = open("output_node_sdk_byfn.log", "w")
returncode = subprocess.call(
"./run_node_sdk_byfn.sh",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="node_sdk_byfn test"
" failed. \nPlease check the logfile "+logfile.name+" for more "
"details.")
44 changes: 44 additions & 0 deletions test/regression/release/e2e_sdk_release_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

import unittest
import subprocess

class sdk_Release_Tests(unittest.TestCase):

def test_e2e_node_sdk_release_tests(self):
'''
In this e2e node sdk release test, we execute all node sdk unit and e2e tests
are working without any issues.
Passing criteria: e2e node sdk release test completed successfully with
exit code 0
'''
logfile = open("output_e2e_node_sdk_release_tests.log", "w")
returncode = subprocess.call(
"./run_e2e_node_sdk.sh",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run e2e_node_sdk_release_tests"
"e2e_node_sdk_release_tests are failed. \nPlease check the logfile "
+logfile.name+" for more details.")


def test_e2e_java_sdk_release_tests(self):
'''
In this e2e java sdk release test, we execute all java sdk unit and e2e tests
are working without any issues.
Passing criteria: e2e java sdk release test completed successfully with
exit code 0
'''
logfile = open("output_e2e_java_sdk_release_tests.log", "w")
returncode = subprocess.call(
"./run_e2e_java_sdk.sh",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run e2e_java_sdk_release_tests"
"e2e_java_sdk_release_tests are failed. \nPlease check the logfile "
+logfile.name+" for more details.")
93 changes: 93 additions & 0 deletions test/regression/release/make_targets_release_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

import unittest
import subprocess

class make_targets(unittest.TestCase):


def test_makeNative(self):
'''
In this make targets test, we execute makeNative target to make sure native target
is working without any issues.
Passing criteria: make native test completed successfully with
exit code 0
'''
logfile = open("output_make_native_release_tests.log", "w")
returncode = subprocess.call(
"./run_make_targets.sh makeNative",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run make native targets "
"make native target tests failed. \nPlease check the logfile ")


def test_makeBinary(self):
'''
In this make targets test, we execute make binary target to make sure binary target
is working without any issues.
Passing criteria: make binary test completed successfully with
exit code 0
'''
logfile = open("output_make_binary_release_tests.log", "w")
returncode = subprocess.call(
"./run_make_targets.sh makeBinary",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run make binary target "
"make binary target tests failed. \nPlease check the logfile ")


def test_makeDistAll(self):
'''
In this make targets test, we execute make dist-all target to make sure dist-all target
is working without any issues.
Passing criteria: make dist-all test completed successfully with
exit code 0
'''
logfile = open("output_make_dist-all_release_tests.log", "w")
returncode = subprocess.call(
"./run_make_targets.sh makeDistAll",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run make dist-all target "
"make dist-all target tests failed. \nPlease check the logfile ")


def test_makeDocker(self):
'''
In this make targets test, we execute make docker target to make sure docker target
is working without any issues.
Passing criteria: make docker test completed successfully with
exit code 0
'''
logfile = open("output_make_docker_release_tests.log", "w")
returncode = subprocess.call(
"./run_make_targets.sh makeDocker",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run make Docker target "
"make Docker target tests failed. \nPlease check the logfile ")

def test_makeVersion(self):
'''
In this make targets test, we execute version check to make sure binaries version
is correct.
Passing criteria: make version test completed successfully with
exit code 0
'''
logfile = open("output_make_version_release_tests.log", "w")
returncode = subprocess.call(
"./run_make_targets.sh makeVersion",
shell=True, stderr=subprocess.STDOUT, stdout=logfile)
logfile.close()
self.assertEqual(returncode, 0, msg="Run make version target "
"make version target tests failed. \nPlease check the logfile ")
54 changes: 54 additions & 0 deletions test/regression/release/runReleaseTestSuite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

DAILYDIR="$GOPATH/src/github.com/hyperledger/fabric/test/regression/daily"
RELEASEDIR="$GOPATH/src/github.com/hyperledger/fabric/test/regression/release"

export FABRIC_ROOT_DIR=$GOPATH/src/github.com/hyperledger/fabric

cd $FABRIC_ROOT_DIR || exit

IS_RELEASE=`cat Makefile | grep IS_RELEASE | awk '{print $3}'`
echo "=======>" $IS_RELEASE

# IS_RELEASE=True specify the Release check. Trigger Release tests only
# if IS_RELEASE=TRUE

if [ $IS_RELEASE != "true" ]; then
echo "=======> TRIGGER ONLY on RELEASE !!!!!"
exit 0
else

cd $RELEASEDIR

docker rm -f $(docker ps -aq) || true
echo "=======> Execute make targets"
chmod +x run_make_targets.sh
py.test -v --junitxml results_make_targets.xml make_targets_release_tests.py

echo "=======> Execute SDK tests..."
chmod +x run_e2e_node_sdk.sh
chmod +x run_e2e_java_sdk.sh
py.test -v --junitxml results_e2e_sdk.xml e2e_sdk_release_tests.py

docker rm -f $(docker ps -aq) || true
echo "=======> Execute byfn tests..."
chmod +x run_byfn_cli_release_tests.sh
chmod +x run_node_sdk_byfn.sh
py.test -v --junitxml results_byfn_cli.xml byfn_release_tests.py

cd $DAILYDIR

docker rm -f $(docker ps -aq) || true
echo "=======> Ledger component performance tests..."
py.test -v --junitxml results_ledger_lte.xml ledger_lte.py

docker rm -f $(docker ps -aq) || true
echo "=======> Test Auction Chaincode ..."
py.test -v --junitxml results_auction_daily.xml testAuctionChaincode.py

fi
41 changes: 41 additions & 0 deletions test/regression/release/run_byfn_cli_release_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

# RUN BYFN Test
#####################

CH_NAME="$1"
rm -rf ${GOPATH}/src/github.com/hyperledger/fabric-samples

WD="${GOPATH}/src/github.com/hyperledger/fabric-samples"
REPO_NAME=fabric-samples

git clone ssh://hyperledger-jobbuilder@gerrit.hyperledger.org:29418/$REPO_NAME $WD
cd $WD

curl -L https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.0-rc1.sh -o bootstrap-1.0.0-rc1.sh
chmod +x bootstrap-1.0.0-rc1.sh
./bootstrap-1.0.0-rc1.sh

cd $WD/first-network
export PATH=$WD/bin:$PATH
echo y | ./byfn.sh -m down

if [ -z "${CH_NAME}" ]; then
echo "Generating artifacts for default channel"
echo y | ./byfn.sh -m generate
echo "setting to default channel 'mychannel'"
echo y | ./byfn.sh -m up -t 10
echo
else
echo "Generate artifacts for custom Channel"
echo y | ./byfn.sh -m generate -c $CH_NAME
echo "Setting to non-default channel $CH_NAME"
echo y | ./byfn.sh -m up -c $CH_NAME -t 10
echo
fi
echo y | ./byfn.sh -m down
21 changes: 21 additions & 0 deletions test/regression/release/run_e2e_java_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Test Java SDK e2e tests
#

WD="${GOPATH}/src/github.com/hyperledger/fabric-sdk-java"
#WD="${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-java"
SDK_REPO_NAME=fabric-sdk-java
git clone https://github.com/hyperledger/fabric-sdk-java $WD
cd $WD
git checkout tags/v1.0.0-rc1
export GOPATH=$WD/src/test/fixture

cd $WD/src/test
chmod +x cirun.sh
source cirun.sh
28 changes: 28 additions & 0 deletions test/regression/release/run_e2e_node_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

rm -rf $GOPATH/src/github.com/hyperledger/fabric-sdk-node

WD="$GOPATH/src/github.com/hyperledger/fabric-sdk-node"
SDK_REPO_NAME=fabric-sdk-node
git clone https://github.com/hyperledger/$SDK_REPO_NAME $WD
cd $WD
git checkout tags/v1.0.0-rc1
cd test/fixtures
docker rm -f "$(docker ps -aq)" || true
docker-compose up >> node_dockerlogfile.log 2>&1 &
sleep 10
docker ps -a
cd ../.. && npm install
npm config set prefix ~/npm && npm install -g gulp && npm install -g istanbul
gulp || true
gulp ca || true
rm -rf node_modules/fabric-ca-client && npm install
gulp test

docker rm -f "$(docker ps -aq)" || true
Loading

0 comments on commit 346c00b

Please sign in to comment.