e2e: add control over the log level of nodes (#5958)

This commit is contained in:
Callum Waters
2021-01-25 17:20:39 +01:00
committed by GitHub
parent 680fb18414
commit aecfb0ecf0
5 changed files with 54 additions and 12 deletions
+9
View File
@@ -50,6 +50,10 @@ type Manifest struct {
// KeyType sets the curve that will be used by validators.
// Options are ed25519 & secp256k1
KeyType string `toml:"key_type"`
// LogLevel sets the log level of the entire testnet. This can be overridden
// by individual nodes.
LogLevel string `toml:"log_level"`
}
// ManifestNode represents a node in a testnet manifest.
@@ -130,6 +134,11 @@ type ManifestNode struct {
// For more information, look at the readme in the maverick folder.
// A list of all behaviors can be found in ../maverick/consensus/behavior.go
Misbehaviors map[string]string `toml:"misbehaviors"`
// Log level sets the log level of the specific node i.e. "consensus:info,*:error".
// This is helpful when debugging a specific problem. This overrides the network
// level.
LogLevel string `toml:"log_level"`
}
// Save saves the testnet manifest to a file.
+7
View File
@@ -60,6 +60,7 @@ type Testnet struct {
ValidatorUpdates map[int64]map[*Node]int64
Nodes []*Node
KeyType string
LogLevel string
}
// Node represents a Tendermint node in a testnet.
@@ -84,6 +85,7 @@ type Node struct {
PersistentPeers []*Node
Perturbations []Perturbation
Misbehaviors map[int64]string
LogLevel string
}
// LoadTestnet loads a testnet from a manifest file, using the filename to
@@ -123,6 +125,7 @@ func LoadTestnet(file string) (*Testnet, error) {
ValidatorUpdates: map[int64]map[*Node]int64{},
Nodes: []*Node{},
KeyType: "ed25519",
LogLevel: manifest.LogLevel,
}
if len(manifest.KeyType) != 0 {
testnet.KeyType = manifest.KeyType
@@ -159,6 +162,7 @@ func LoadTestnet(file string) (*Testnet, error) {
RetainBlocks: nodeManifest.RetainBlocks,
Perturbations: []Perturbation{},
Misbehaviors: make(map[int64]string),
LogLevel: manifest.LogLevel,
}
if node.StartAt == testnet.InitialHeight {
node.StartAt = 0 // normalize to 0 for initial nodes, since code expects this
@@ -188,6 +192,9 @@ func LoadTestnet(file string) (*Testnet, error) {
}
node.Misbehaviors[height] = misbehavior
}
if nodeManifest.LogLevel != "" {
node.LogLevel = nodeManifest.LogLevel
}
testnet.Nodes = append(testnet.Nodes, node)
}