mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-05 11:31:16 +00:00
* e2e: Extract Docker-specific functionality Extract Docker-specific functionality and put it behind an interface that should hopefully, without too much modification, allow us to implement a Digital Ocean-based infrastructure provider. Signed-off-by: Thane Thomson <connect@thanethomson.com> * Thread contexts through all potentially long-running functions Signed-off-by: Thane Thomson <connect@thanethomson.com> * Drop the "API" from interface/struct/var naming Signed-off-by: Thane Thomson <connect@thanethomson.com> * Simplify function returns Signed-off-by: Thane Thomson <connect@thanethomson.com> * Rename GenerateConfig to Setup to make it more generic Signed-off-by: Thane Thomson <connect@thanethomson.com> * Consolidate all infra functions into a single interface Signed-off-by: Thane Thomson <connect@thanethomson.com> * Localize linter directives Signed-off-by: Thane Thomson <connect@thanethomson.com> * Look up and use complete node in ShowNodeLogs and TailNodeLogs calls Signed-off-by: Thane Thomson <connect@thanethomson.com> * Restructure infra provider API into a separate package Signed-off-by: Thane Thomson <connect@thanethomson.com> * Rename interface again Signed-off-by: Thane Thomson <connect@thanethomson.com> * Rename exec functions for readability Signed-off-by: Thane Thomson <connect@thanethomson.com> * Relocate staticcheck lint directive Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove staticcheck lint directive Signed-off-by: Thane Thomson <connect@thanethomson.com> * Make testnet infra struct private Signed-off-by: Thane Thomson <connect@thanethomson.com> * Only pass testnetDir to Cleanup function Signed-off-by: Thane Thomson <connect@thanethomson.com>
85 lines
2.7 KiB
Go
85 lines
2.7 KiB
Go
package infra
|
|
|
|
import (
|
|
"context"
|
|
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
|
)
|
|
|
|
// TestnetInfra provides an API for manipulating the infrastructure of a
|
|
// specific testnet.
|
|
type TestnetInfra interface {
|
|
//
|
|
// Overarching testnet infrastructure management.
|
|
//
|
|
|
|
// Setup generates any necessary configuration for the infrastructure
|
|
// provider during testnet setup.
|
|
Setup(ctx context.Context) error
|
|
|
|
// Stop will stop all running processes throughout the testnet without
|
|
// destroying any infrastructure.
|
|
Stop(ctx context.Context) error
|
|
|
|
// Pause will pause all processes in the testnet.
|
|
Pause(ctx context.Context) error
|
|
|
|
// Unpause will resume a paused testnet.
|
|
Unpause(ctx context.Context) error
|
|
|
|
// ShowLogs prints all logs for the whole testnet to stdout.
|
|
ShowLogs(ctx context.Context) error
|
|
|
|
// TailLogs tails the logs for all nodes in the testnet, if this is
|
|
// supported by the infrastructure provider.
|
|
TailLogs(ctx context.Context) error
|
|
|
|
// Cleanup stops and destroys all running testnet infrastructure and
|
|
// deletes any generated files.
|
|
Cleanup(ctx context.Context) error
|
|
|
|
//
|
|
// Node management, including node infrastructure.
|
|
//
|
|
|
|
// StartNode provisions infrastructure for the given node and starts it.
|
|
StartNode(ctx context.Context, node *e2e.Node) error
|
|
|
|
// DisconnectNode modifies the specified node's network configuration such
|
|
// that it becomes bidirectionally disconnected from the network (it cannot
|
|
// see other nodes, and other nodes cannot see it).
|
|
DisconnectNode(ctx context.Context, node *e2e.Node) error
|
|
|
|
// ConnectNode modifies the specified node's network configuration such
|
|
// that it can become bidirectionally connected.
|
|
ConnectNode(ctx context.Context, node *e2e.Node) error
|
|
|
|
// ShowNodeLogs prints all logs for the node with the give ID to stdout.
|
|
ShowNodeLogs(ctx context.Context, node *e2e.Node) error
|
|
|
|
// TailNodeLogs tails the logs for a single node, if this is supported by
|
|
// the infrastructure provider.
|
|
TailNodeLogs(ctx context.Context, node *e2e.Node) error
|
|
|
|
//
|
|
// Node process management.
|
|
//
|
|
|
|
// KillNodeProcess sends SIGKILL to a node's process.
|
|
KillNodeProcess(ctx context.Context, node *e2e.Node) error
|
|
|
|
// StartNodeProcess will start a stopped node's process. Assumes that the
|
|
// node's infrastructure has previously been provisioned using
|
|
// ProvisionNode.
|
|
StartNodeProcess(ctx context.Context, node *e2e.Node) error
|
|
|
|
// PauseNodeProcess sends a signal to the node's process to pause it.
|
|
PauseNodeProcess(ctx context.Context, node *e2e.Node) error
|
|
|
|
// UnpauseNodeProcess resumes a paused node's process.
|
|
UnpauseNodeProcess(ctx context.Context, node *e2e.Node) error
|
|
|
|
// TerminateNodeProcess sends SIGTERM to a node's process.
|
|
TerminateNodeProcess(ctx context.Context, node *e2e.Node) error
|
|
}
|