mirror of
https://github.com/basicswap/basicswap.git
synced 2025-03-25 00:28:53 +00:00
ci: Fix tests.
This commit is contained in:
parent
6341b5537e
commit
07429e6582
4 changed files with 29 additions and 18 deletions
41
.travis.yml
41
.travis.yml
|
@ -4,27 +4,36 @@ language: python
|
||||||
python: '3.7'
|
python: '3.7'
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
|
- test
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- TEST_DIR=~/test_basicswap2/
|
- PART_VERSION=0.18.1.5
|
||||||
- PARTICL_BINDIR=/opt/binaries/particl-0.18.1.5/bin/
|
- BTC_VERSION=0.18.1
|
||||||
- BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.1/bin/
|
- LTC_VERSION=0.17.1
|
||||||
- LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
|
- 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:
|
before_install:
|
||||||
- sudo apt-get install -y wget gnupg2
|
- sudo apt-get install -y wget gnupg2
|
||||||
before_script:
|
before_script:
|
||||||
- if [ ! -d "/opt/binaries" ]; then mkdir -p "/opt/binaries" ; fi
|
- if [ ! -d "$BIN_DIRS" ]; then mkdir -p "$BIN_DIRS" ; 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 "$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 "$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 "$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 "$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 "$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:
|
script:
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- export PARTICL_BINDIR=/opt/binaries/particl-0.18.1.5/bin/
|
- export DATADIRS="${TEST_DIR}"
|
||||||
- export BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.1/bin/
|
|
||||||
- export LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
|
|
||||||
- export DATADIRS=~/test_basicswap2/
|
|
||||||
- mkdir -p ${DATADIRS}/bin/{particl,bitcoin}
|
- 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
|
- python setup.py test
|
||||||
after_success:
|
after_success:
|
||||||
- echo "End test"
|
- echo "End test"
|
||||||
|
@ -33,8 +42,6 @@ jobs:
|
||||||
- stage: lint
|
- stage: lint
|
||||||
env:
|
env:
|
||||||
cache: false
|
cache: false
|
||||||
language: python
|
|
||||||
python: '3.7'
|
|
||||||
install:
|
install:
|
||||||
- travis_retry pip install flake8==3.5.0
|
- travis_retry pip install flake8==3.5.0
|
||||||
- travis_retry pip install codespell==1.15.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
|
- codespell --check-filenames --disable-colors --quiet-level=7 -S .git,.eggs,gitianpubkeys
|
||||||
after_success:
|
after_success:
|
||||||
- echo "End lint"
|
- echo "End lint"
|
||||||
|
- stage: test
|
||||||
|
env:
|
||||||
|
|
|
@ -1563,7 +1563,8 @@ class BasicSwap():
|
||||||
self.log.debug('Refund tx fee %s, rate %s', format8(tx_fee * COIN), str(fee_rate))
|
self.log.debug('Refund tx fee %s, rate %s', format8(tx_fee * COIN), str(fee_rate))
|
||||||
|
|
||||||
amount_out = prev_amount * COIN - tx_fee * COIN
|
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:
|
if addr_refund_out is None:
|
||||||
addr_refund_out = self.getReceiveAddressFromPool(coin_type, bid.bid_id, tx_type)
|
addr_refund_out = self.getReceiveAddressFromPool(coin_type, bid.bid_id, tx_type)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import shutil
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import bin.basicswap_prepare as prepareSystem
|
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 = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
|
|
|
@ -168,6 +168,7 @@ class Test(unittest.TestCase):
|
||||||
runSystem.main()
|
runSystem.main()
|
||||||
|
|
||||||
def test_reload(self):
|
def test_reload(self):
|
||||||
|
global stop_test
|
||||||
processes = []
|
processes = []
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
|
Loading…
Reference in a new issue