add main.go for running the application server

This commit is contained in:
Anton Kaliaev
2020-11-05 17:18:18 +04:00
parent 2028896f6c
commit f57961b0f5
3 changed files with 75 additions and 0 deletions
+23
View File
@@ -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
+2
View File
@@ -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"`
+50
View File
@@ -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 {}
}