mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
test: add evidence e2e tests (#5488)
This commit is contained in:
committed by
Erik Grinaker
parent
75879ab1d7
commit
dacbfbe1fe
@@ -12,11 +12,13 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
|
||||
"github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
@@ -118,7 +120,20 @@ func Setup(testnet *e2e.Testnet) error {
|
||||
// MakeDockerCompose generates a Docker Compose config for a testnet.
|
||||
func MakeDockerCompose(testnet *e2e.Testnet) ([]byte, error) {
|
||||
// Must use version 2 Docker Compose format, to support IPv6.
|
||||
tmpl, err := template.New("docker-compose").Parse(`version: '2.4'
|
||||
tmpl, err := template.New("docker-compose").Funcs(template.FuncMap{
|
||||
"misbehaviorsToString": func(misbehaviors map[int64]string) string {
|
||||
str := ""
|
||||
for height, misbehavior := range misbehaviors {
|
||||
// after the first behavior set, a comma must be prepended
|
||||
if str != "" {
|
||||
str += ","
|
||||
}
|
||||
heightString := strconv.Itoa(int(height))
|
||||
str += misbehavior + "," + heightString
|
||||
}
|
||||
return str
|
||||
},
|
||||
}).Parse(`version: '2.4'
|
||||
|
||||
networks:
|
||||
{{ .Name }}:
|
||||
@@ -142,6 +157,9 @@ services:
|
||||
image: tendermint/e2e-node
|
||||
{{- if eq .ABCIProtocol "builtin" }}
|
||||
entrypoint: /usr/bin/entrypoint-builtin
|
||||
{{- else if .Misbehaviors }}
|
||||
entrypoint: /usr/bin/entrypoint-maverick
|
||||
command: ["node", "--misbehaviors", "{{ misbehaviorsToString .Misbehaviors }}"]
|
||||
{{- end }}
|
||||
init: true
|
||||
ports:
|
||||
@@ -330,6 +348,12 @@ func MakeAppConfig(node *e2e.Node) ([]byte, error) {
|
||||
}
|
||||
}
|
||||
|
||||
misbehaviors := make(map[string]string)
|
||||
for height, misbehavior := range node.Misbehaviors {
|
||||
misbehaviors[strconv.Itoa(int(height))] = misbehavior
|
||||
}
|
||||
cfg["misbehaviors"] = misbehaviors
|
||||
|
||||
if len(node.Testnet.ValidatorUpdates) > 0 {
|
||||
validatorUpdates := map[string]map[string]int64{}
|
||||
for height, validators := range node.Testnet.ValidatorUpdates {
|
||||
|
||||
Reference in New Issue
Block a user