gazbert / bxbot

A simple Bitcoin trading bot written in Java.
MIT License
779 stars 275 forks source link

Build error #50

Closed Picard0147 closed 6 years ago

Picard0147 commented 7 years ago

Hi, I'm trying to install bxbot on Ubuntu server 16.04 x64, dependecies are installed (hopefully all) for instalation is used last release zip (v0.5-beta.2). Problem appear while I try to build it and no matter if using gradle or Maven. Here is Maven error output:

Failed tests: 
  TestTradingEngine.testEngineShutsDownWhenEmergencyStopBalanceIfBreached:180 
  Unexpected method call EmailAlerter.sendMessage("CRITICAL Alert message from BX-bot", "A CRITICAL error event has occurred on BX-bot.

--------------------------------------------------
Exchange Adapter:

com.sun.proxy.$Proxy37

--------------------------------------------------
Event Time:

Wed Mar 22 20:13:17 CET 2017

--------------------------------------------------
Event Details:

EMERGENCY STOP triggered! - Current Emergency Stop Currency [BTC] wallet balance [0,49999999] on exchange is lower than configured Emergency Stop balance [0,5] BTC

--------------------------------------------------
Action Taken:

The bot will shutdown NOW! Check the bot logs for more information.

"):
    EmailAlerter.sendMessage("CRITICAL Alert message from BX-bot", contains("EMERGENCY STOP triggered! - Current Emergency Stop Currency [BTC] wallet balance [0.49999999] on exchange is lower than configured Emergency Stop balance [0.5] BTC")): expected: 1, actual: 0

Tests run: 21, Failures: 1, Errors: 0, Skipped: 0

my email-alerts.xml (emails are not wanted so it's just copied sample with disabled sending):

<?xml version="1.0"?>
<!--

Email Alerts config.

All elements are mandatory unless stated otherwise.
Only 1 email-alerts element can be specified.
The email is sent using TLS.

Sample config for using a Gmail account to send the email is shown below.

-->
<email-alerts>

    <!--
    If <enabled> is set to 'true', the bot will load the optional <smtp-config> config.
    If <enabled> is set to 'false', you can omit the <smtp-config> config.
    -->
    <enabled>false</enabled>

    <smtp-config>
        <smtp-host>smtp.gmail.com</smtp-host>
        <smtp-tls-port>587</smtp-tls-port>
        <account-username>your.account.username@gmail.com</account-username>
        <account-password>your.account.password</account-password>
        <from-addr>from.addr@gmail.com</from-addr>

        <!--
        If enabled, the bot will send email alerts to the <to-addr> if it needs to shutdown due to a critical error.
        -->
        <to-addr>to.addr@gmail.com</to-addr>
    </smtp-config>
</email-alerts>

Unfortunately progamming isn't my cup of tea so I'm not sure if there is a bug in code or it's some problem with dependencies.

gazbert commented 7 years ago

Not sure about this one. I've just downloaded that Release and built ok with maven and gradle.

The XML config is not used in the test (the email component is mocked out), so no need to change this to get the build done.

For now, to get you building, if you open in an editor: bxbot/bxbot-core/src/test/java/com/gazbert/bxbot/core/engine/TestTradingEngine.java

Find these 2 lines:

    @Test
    public void testEngineShutsDownWhenEmergencyStopBalanceIfBreached() throws Exception {

and add this line immediately above @Test:

@org.junit.Ignore("tmp ignore of test - gazbert to investigate ...")

so it should then look like:

    @org.junit.Ignore("tmp ignore of test - gazbert to investigate ...")
    @Test
    public void testEngineShutsDownWhenEmergencyStopBalanceIfBreached() throws Exception {

This will ignore the test. Then try rebuilding with maven then: mvn clean install again.

I'll need to investigate - possibly a race condition in the unit test code.

Which version of java are you using? (Type java -version in a terminal).

Picard0147 commented 7 years ago

Thank you very much, bot is built and runing :+1:

And about java, I'm using jdk from ubuntu repo as usually or maybe allways, here is terminal output:

openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

If you need other info to track this problem, just write and I'll answer you as soon as posible.

gazbert commented 7 years ago

You're welcome.

Really strange how it's just that 1 test that fails too. Smells of a buggy unit test/threading issue. Cheers for the offer of help - will keep you posted.

gazbert commented 6 years ago

I'm closing this one - I've still not been able to reproduce it.

If anyone else does reproduce this build issue, please reopen with logs etc and I'll take a look.