Commit d34f7157 authored by Jonathan Levi (HACERA)'s avatar Jonathan Levi (HACERA) Committed by Gerrit Code Review
Browse files

Merge "FAB-5208 create release testsuite"

parents 01ae6d17 346c00bf
# 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.")
# 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.")
# 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 ")
#!/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
#!/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
#!/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
#!/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
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
set -o pipefail
CWD=$GOPATH/src/github.com/hyperledger/fabric
cd $CWD
VERSION=`cat Makefile | grep BASE_VERSION | awk '{print $3}' | head -n1`
echo "===>Release_VERSION: $VERSION"
makeCleanAll() {
make clean-all
echo "clean-all from fabric repository"
}
# make native
makeNative() {
make native
for binary in chaintool configtxgen configtxlator cryptogen orderer peer; do
if [ ! -f $CWD/build/bin/$binary ] ; then
echo " ====> ERROR !!! $binary is not available"
echo
exit 1
fi
echo " ====> PASS !!! $binary is available"
done
}
# Build peer, orderer, configtxgen, cryptogen and configtxlator
makeBinary() {
make clean-all
make peer && make orderer && make configtxgen && make cryptogen && make configtxlator
for binary in peer orderer configtxgen cryptogen configtxlator; do
if [ ! -f $CWD/build/bin/$binary ] ; then
echo " ====> ERROR !!! $binary is not available"
echo
exit 1
fi
echo " ====> PASS !!! $binary is available"
done
}
# Create tar files for each platform
makeDistAll() {
make clean-all
make dist-all
for dist in linux-amd64 windows-amd64 darwin-amd64 linux-ppc64le linux-s390x; do
if [ ! -d $CWD/release/$dist ] ; then
echo " ====> ERROR !!! $dist is not available"
echo
exit 1
fi
echo " ====> PASS !!! $dist is available"
done
}
# Create docker images
makeDocker() {
make docker-clean
make docker
if [ $? -ne 0 ] ; then
echo " ===> ERROR !!! Docker Images are not available"
echo
exit 1
fi
echo " ===> PASS !!! Docker Images are available"
}
# Verify the version built in peer and configtxgen binaries
makeVersion() {
make docker-clean
make release
cd release/linux-amd64/bin
./peer --version > peer.txt
Pversion=$(grep -v "2017" peer.txt | grep Version: | awk '{print $2}' | head -n1)
if [ "$Pversion" != "$VERSION" ]; then
echo " ===> ERROR !!! Peer Version check failed"
echo
fi
./configtxgen --version > configtxgen.txt
Configtxgen=$(grep -v "2017" configtxgen.txt | grep Version: | awk '{print $2}' | head -n1)
if [ "$Configtxgen" != "$VERSION" ]; then
echo "====> ERROR !!! configtxgen Version check failed:"
echo
exit 1
fi
echo "====> PASS !!! Configtxgen version verified:"
}
$1
#!/bin/bash -eu
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# RUN END-to-END Test
#####################
rm -rf ${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-node
WD="${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-node"
SDK_REPO_NAME=fabric-sdk-node
git clone ssh://hyperledger-jobbuilder@gerrit.hyperledger.org:29418/$SDK_REPO_NAME $WD
cd $WD
NODE_SDK_COMMIT=$(git log -1 --pretty=format:"%h")
echo "FABRIC NODE SDK COMMIT ========> " $NODE_SDK_COMMIT >> ${WORKSPACE}/gopath/src/github.com/hyperledger/commit_history.log
cd test/fixtures
cat docker-compose.yaml > docker-compose.log
docker-compose up >> 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 && gulp ca
rm -rf node_modules/fabric-ca-client && npm install
node test/integration/e2e.js
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment