Steem Load Balancer: Adding Negative Tests

in Witness Activities12 days ago

I've pushed a commit to add some negative tests:

## This tests the load balancer by sending a GET request with header to the server and checking the response
## which should be a 500 error because all requests should be failed: No valid node found
## curl -s -H "Content-type:application/json" https://api.steemyy.com | jq
send_a_get_request_header_when_all_nodes_are_down() {
    ## send a GET request
    ## curl -s https://api.steemyy.com | jq 
    resp_status_code=$(curl -m 5 -o /dev/null -s -w "%{http_code}\n" http://127.0.0.1:443/)

    if [ "$resp_status_code" != "500" ]; then
        echo "send_a_get_request_header failed with http response code: $resp_status_code"
        return 1
    fi
    echo "send_a_get_request_header_when_all_nodes_are_down passed! (response code: $resp_status_code)"
    return 0
}

You can now supply a config in ./run.sh for example:

image.png

I've also pushed a latest image to justyy/steem-load-balancer:latest so you can do:

docker pull justyy/steem-load-balancer:latest

HOST_PORT=443
RETRY_COUNT=3

docker run \
    -e NODE_ENV=production \
    -e SSL_CERT_PATH=$SSL_CERT_PATH \
    -e SSL_KEY_PATH=$SSL_KEY_PATH \
    --name steem-load-balancer \
    --restart on-failure:$RETRY_COUNT \
    -p $HOST_PORT:8080 \
    -v /root/.acme.sh/:/root/.acme.sh/ \
    justyy/steem-load-balancer:latest

The two load balancers are now updated with the latest software:

Steem to the Moon🚀!

Coin Marketplace

STEEM 0.15
TRX 0.25
JST 0.037
BTC 94614.55
ETH 1777.74
USDT 1.00
SBD 0.87