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"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ import (
|
||||||
var aminoCdc = amino.NewCodec()
|
var aminoCdc = amino.NewCodec()
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
log.SetOutput(os.Stdout)
|
||||||
ctypes.RegisterAmino(aminoCdc)
|
ctypes.RegisterAmino(aminoCdc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +79,7 @@ func (app SantaApp) ListenNewBLock(isTest bool) {
|
||||||
if blockEvent.Block.Height%triggerInterval == 0 {
|
if blockEvent.Block.Height%triggerInterval == 0 {
|
||||||
txHash, err := app.SendTx(blockEvent.Block.ChainID)
|
txHash, err := app.SendTx(blockEvent.Block.ChainID)
|
||||||
if err != nil {
|
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)
|
log.Printf("[Success] Height: %d,\tTxHash: %s\n", blockEvent.Block.Height, txHash)
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWebsocketListen(t *testing.T) {
|
func TestWebsocketListen(t *testing.T) {
|
||||||
app := setupWithPlentyBalanceAccount(t)
|
app := setupWithPlentyBalanceAccount(t)
|
||||||
|
|
||||||
|
@ -18,11 +20,11 @@ func TestWebsocketListen(t *testing.T) {
|
||||||
|
|
||||||
var logBuf bytes.Buffer
|
var logBuf bytes.Buffer
|
||||||
log.SetOutput(&logBuf)
|
log.SetOutput(&logBuf)
|
||||||
defer log.SetOutput(os.Stderr)
|
defer log.SetOutput(os.Stdout)
|
||||||
|
|
||||||
app.TriggerInterval = "1"
|
app.TriggerInterval = "1"
|
||||||
app.ListenNewBLock(true)
|
app.ListenNewBLock(true)
|
||||||
|
|
||||||
result := logBuf.String()
|
result := logBuf.String()
|
||||||
require.True(t, strings.Contains(result, "[Success]"))
|
require.True(t, strings.Contains(result, "[Success]"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue