mirror of https://github.com/certusone/santa.git
Merge branch 'master' of https://github.com/terra-project/santa
This commit is contained in:
commit
4aaa2a8cef
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -17,6 +18,7 @@ import (
|
|||
var aminoCdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
log.SetOutput(os.Stdout)
|
||||
ctypes.RegisterAmino(aminoCdc)
|
||||
}
|
||||
|
||||
|
@ -77,7 +79,7 @@ func (app SantaApp) ListenNewBLock(isTest bool) {
|
|||
if blockEvent.Block.Height%triggerInterval == 0 {
|
||||
txHash, err := app.SendTx(blockEvent.Block.ChainID)
|
||||
if err != nil {
|
||||
log.Fatal("[Fail] to send tx", err)
|
||||
log.Printf("[Fail] to send tx: %s", err.Error())
|
||||
}
|
||||
|
||||
log.Printf("[Success] Height: %d,\tTxHash: %s\n", blockEvent.Block.Height, txHash)
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"bytes"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestWebsocketListen(t *testing.T) {
|
||||
app := setupWithPlentyBalanceAccount(t)
|
||||
|
||||
|
@ -18,11 +20,11 @@ func TestWebsocketListen(t *testing.T) {
|
|||
|
||||
var logBuf bytes.Buffer
|
||||
log.SetOutput(&logBuf)
|
||||
defer log.SetOutput(os.Stderr)
|
||||
defer log.SetOutput(os.Stdout)
|
||||
|
||||
app.TriggerInterval = "1"
|
||||
app.ListenNewBLock(true)
|
||||
|
||||
|
||||
result := logBuf.String()
|
||||
require.True(t, strings.Contains(result, "[Success]"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue