mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-21 22:56:22 +00:00
add main.go for running the application server
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Jepsen Tests
|
||||
|
||||
[Jepsen](https://github.com/jepsen-io/jepsen) is a framework for distributed
|
||||
systems verification, with fault injection, written in Clojure.
|
||||
|
||||
For more information, visit their [website](https://jepsen.io/).
|
||||
|
||||
## Test scenarios
|
||||
|
||||
Jepsen tests should give us some assurance that Tendermint produces
|
||||
linearizable history in the presence of:
|
||||
|
||||
* Network partitions
|
||||
* Clock skews
|
||||
* Crashes
|
||||
* Changing validators
|
||||
* Truncating logs
|
||||
|
||||
NOTE: e2e tests check Tendermint recovers after crashes, but they do not check
|
||||
the transaction history. Jepsen test suite can be viewed as an extension in
|
||||
this way.
|
||||
|
||||
## Running
|
||||
|
||||
@@ -68,6 +68,8 @@ type MerkleEyesState struct {
|
||||
Validators *ValidatorSetState `json:"validators"`
|
||||
}
|
||||
|
||||
// ValidatorSetState contains the validator set and its version (~ the number
|
||||
// of times it was changed).
|
||||
type ValidatorSetState struct {
|
||||
Version uint64 `json:"version"`
|
||||
Validators []*Validator `json:"validators"`
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/tendermint/tendermint/abci/server"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmos "github.com/tendermint/tendermint/libs/os"
|
||||
)
|
||||
|
||||
var (
|
||||
logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
|
||||
dbName string
|
||||
laddr string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&dbName, "dbname", "", "database name")
|
||||
flag.StringVar(&laddr, "laddr", "unix://data.sock", "listen address")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
app := NewMerkleEyesApp(dbName, 0)
|
||||
srv, err := server.NewServer(laddr, "socket", app)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "can't create server: %v", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
srv.SetLogger(logger.With("module", "abci-server"))
|
||||
|
||||
if err := srv.Start(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "can't start server: %v", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
// Stop upon receiving SIGTERM or CTRL-C.
|
||||
tmos.TrapSignal(logger, func() {
|
||||
// Cleanup
|
||||
srv.Stop()
|
||||
app.CloseDB()
|
||||
})
|
||||
|
||||
// Run forever.
|
||||
select {}
|
||||
}
|
||||
Reference in New Issue
Block a user