mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-05 09:31:20 +00:00
test_app: unexport internal function.
This reverts commit 24c9b2761d7da5ab5084310f0cb3e51c7fc9738d.
This commit is contained in:
parent
9134905f42
commit
af2a66b226
@ -2,18 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tendermint/abci/client"
|
"github.com/tendermint/abci/client"
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
common "github.com/tendermint/go-common"
|
|
||||||
"github.com/tendermint/go-process"
|
"github.com/tendermint/go-process"
|
||||||
)
|
)
|
||||||
|
|
||||||
//----------------------------------------
|
func startApp(abciApp string) *process.Process {
|
||||||
|
|
||||||
func StartApp(abciApp string) *process.Process {
|
|
||||||
// Start the app
|
// Start the app
|
||||||
//outBuf := NewBufferCloser(nil)
|
//outBuf := NewBufferCloser(nil)
|
||||||
proc, err := process.StartProcess("abci_app",
|
proc, err := process.StartProcess("abci_app",
|
||||||
@ -33,7 +31,7 @@ func StartApp(abciApp string) *process.Process {
|
|||||||
return proc
|
return proc
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartClient(abciType string) abcicli.Client {
|
func startClient(abciType string) abcicli.Client {
|
||||||
// Start client
|
// Start client
|
||||||
client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true)
|
client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -42,7 +40,7 @@ func StartClient(abciType string) abcicli.Client {
|
|||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetOption(client abcicli.Client, key, value string) {
|
func setOption(client abcicli.Client, key, value string) {
|
||||||
res := client.SetOptionSync(key, value)
|
res := client.SetOptionSync(key, value)
|
||||||
_, _, log := res.Code, res.Data, res.Log
|
_, _, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
@ -50,7 +48,7 @@ func SetOption(client abcicli.Client, key, value string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Commit(client abcicli.Client, hashExp []byte) {
|
func commit(client abcicli.Client, hashExp []byte) {
|
||||||
res := client.CommitSync()
|
res := client.CommitSync()
|
||||||
_, data, log := res.Code, res.Data, res.Log
|
_, data, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
@ -62,7 +60,7 @@ func Commit(client abcicli.Client, hashExp []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
|
func deliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
|
||||||
res := client.DeliverTxSync(txBytes)
|
res := client.DeliverTxSync(txBytes)
|
||||||
code, data, log := res.Code, res.Data, res.Log
|
code, data, log := res.Code, res.Data, res.Log
|
||||||
if code != codeExp {
|
if code != codeExp {
|
||||||
@ -75,7 +73,7 @@ func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, da
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
|
func checkTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
|
||||||
res := client.CheckTxSync(txBytes)
|
res := client.CheckTxSync(txBytes)
|
||||||
code, data, log := res.Code, res.Data, res.Log
|
code, data, log := res.Code, res.Data, res.Log
|
||||||
if res.IsErr() {
|
if res.IsErr() {
|
||||||
|
@ -27,22 +27,22 @@ func testCounter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
|
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
|
||||||
appProc := StartApp(abciApp)
|
appProc := startApp(abciApp)
|
||||||
defer appProc.StopProcess(true)
|
defer appProc.StopProcess(true)
|
||||||
client := StartClient(abciType)
|
client := startClient(abciType)
|
||||||
defer client.Stop()
|
defer client.Stop()
|
||||||
|
|
||||||
SetOption(client, "serial", "on")
|
setOption(client, "serial", "on")
|
||||||
Commit(client, nil)
|
commit(client, nil)
|
||||||
DeliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
|
deliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
|
||||||
Commit(client, nil)
|
commit(client, nil)
|
||||||
DeliverTx(client, []byte{0x00}, types.CodeType_OK, nil)
|
deliverTx(client, []byte{0x00}, types.CodeType_OK, nil)
|
||||||
Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
|
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
|
||||||
DeliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
|
deliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
|
||||||
DeliverTx(client, []byte{0x01}, types.CodeType_OK, nil)
|
deliverTx(client, []byte{0x01}, types.CodeType_OK, nil)
|
||||||
DeliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
|
deliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
|
||||||
DeliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
|
deliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
|
||||||
DeliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
|
deliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
|
||||||
DeliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
|
deliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
|
||||||
Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
|
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user