ci: Fix tests.

This commit is contained in:
tecnovert 2019-10-04 20:23:33 +02:00
parent 6341b5537e
commit 07429e6582
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 29 additions and 18 deletions

View file

@ -4,27 +4,36 @@ language: python
python: '3.7'
stages:
- lint
- test
env:
global:
- TEST_DIR=~/test_basicswap2/
- PARTICL_BINDIR=/opt/binaries/particl-0.18.1.5/bin/
- BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.1/bin/
- LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
global:
- PART_VERSION=0.18.1.5
- BTC_VERSION=0.18.1
- LTC_VERSION=0.17.1
- TEST_DIR=~/test_basicswap2/
- TEST_RELOAD_PATH=~/test_basicswap1/
- BIN_DIRS=~/binaries
- PARTICL_BINDIR=${BIN_DIRS}/particl-${PART_VERSION}/bin/
- BITCOIN_BINDIR=${BIN_DIRS}/bitcoin-${BTC_VERSION}/bin/
- LITECOIN_BINDIR=${BIN_DIRS}/litecoin-${LTC_VERSION}/bin/
cache:
directories:
- "$BIN_DIRS"
before_install:
- sudo apt-get install -y wget gnupg2
before_script:
- if [ ! -d "/opt/binaries" ]; then mkdir -p "/opt/binaries" ; fi
- if [ ! -d "$BITCOIN_BINDIR" ]; then cd "/opt/binaries" && wget https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz && tar xvf bitcoin-0.18.1-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$LITECOIN_BINDIR" ]; then cd "/opt/binaries" && wget https://download.litecoin.org/litecoin-0.17.1/linux/litecoin-0.17.1-x86_64-linux-gnu.tar.gz && tar xvf litecoin-0.17.1-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$PARTICL_BINDIR" ]; then cd "/opt/binaries" && wget https://github.com/particl/particl-core/releases/download/v0.18.1.5/particl-0.18.1.5-x86_64-linux-gnu_nousb.tar.gz && tar xvf particl-0.18.1.5-x86_64-linux-gnu_nousb.tar.gz ; fi
- if [ ! -d "$BIN_DIRS" ]; then mkdir -p "$BIN_DIRS" ; fi
- if [ ! -d "$PARTICL_BINDIR" ]; then cd "$BIN_DIRS" && wget https://github.com/particl/particl-core/releases/download/v${PART_VERSION}/particl-${PART_VERSION}-x86_64-linux-gnu.tar.gz && tar xvf particl-${PART_VERSION}-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$BITCOIN_BINDIR" ]; then cd "$BIN_DIRS" && wget https://bitcoincore.org/bin/bitcoin-core-${BTC_VERSION}/bitcoin-${BTC_VERSION}-x86_64-linux-gnu.tar.gz && tar xvf bitcoin-${BTC_VERSION}-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$LITECOIN_BINDIR" ]; then cd "$BIN_DIRS" && wget https://download.litecoin.org/litecoin-${LTC_VERSION}/linux/litecoin-${LTC_VERSION}-x86_64-linux-gnu.tar.gz && tar xvf litecoin-${LTC_VERSION}-x86_64-linux-gnu.tar.gz ; fi
script:
- cd $TRAVIS_BUILD_DIR
- export PARTICL_BINDIR=/opt/binaries/particl-0.18.1.5/bin/
- export BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.1/bin/
- export LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
- export DATADIRS=~/test_basicswap2/
- export DATADIRS="${TEST_DIR}"
- mkdir -p ${DATADIRS}/bin/{particl,bitcoin}
- cp /opt/binaries/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz ${DATADIRS}/bin/bitcoin
- cp "${BIN_DIRS}/bitcoin-${BTC_VERSION}-x86_64-linux-gnu.tar.gz" "${DATADIRS}/bin/bitcoin"
- mkdir -p ${TEST_RELOAD_PATH}/bin/{particl,bitcoin}
- cp "${BIN_DIRS}/particl-${PART_VERSION}-x86_64-linux-gnu.tar.gz" "${TEST_RELOAD_PATH}/bin/particl"
- cp "${BIN_DIRS}/bitcoin-${BTC_VERSION}-x86_64-linux-gnu.tar.gz" "${TEST_RELOAD_PATH}/bin/bitcoin"
- python setup.py test
after_success:
- echo "End test"
@ -33,8 +42,6 @@ jobs:
- stage: lint
env:
cache: false
language: python
python: '3.7'
install:
- travis_retry pip install flake8==3.5.0
- travis_retry pip install codespell==1.15.0
@ -44,3 +51,5 @@ jobs:
- codespell --check-filenames --disable-colors --quiet-level=7 -S .git,.eggs,gitianpubkeys
after_success:
- echo "End lint"
- stage: test
env:

View file

@ -1563,7 +1563,8 @@ class BasicSwap():
self.log.debug('Refund tx fee %s, rate %s', format8(tx_fee * COIN), str(fee_rate))
amount_out = prev_amount * COIN - tx_fee * COIN
assert(amount_out > 0), 'Amount out <= 0'
if amount_out <= 0:
raise ValueError('Refund amount out <= 0')
if addr_refund_out is None:
addr_refund_out = self.getReceiveAddressFromPool(coin_type, bid.bid_id, tx_type)

View file

@ -15,7 +15,7 @@ import shutil
import json
import bin.basicswap_prepare as prepareSystem
test_path = os.path.expanduser('~/test_basicswap')
test_path = os.path.expanduser(os.getenv('TEST_PREPARE_PATH', '~/test_basicswap'))
logger = logging.getLogger()
logger.level = logging.DEBUG

View file

@ -168,6 +168,7 @@ class Test(unittest.TestCase):
runSystem.main()
def test_reload(self):
global stop_test
processes = []
for i in range(3):