mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 21:14:53 +00:00
docker.exec takes context
This commit is contained in:
@@ -110,6 +110,6 @@ func ExecComposeVerbose(ctx context.Context, dir string, args ...string) error {
|
||||
}
|
||||
|
||||
// Exec runs a Docker command.
|
||||
func Exec(args ...string) error {
|
||||
return exec.Command(context.Background(), append([]string{"docker"}, args...)...)
|
||||
func Exec(ctx context.Context, args ...string) error {
|
||||
return exec.Command(ctx, append([]string{"docker"}, args...)...)
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ func cleanupDir(dir string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = docker.Exec("run", "--rm", "--entrypoint", "", "-v", fmt.Sprintf("%v:/network", absDir),
|
||||
"tendermint/e2e-node", "sh", "-c", "rm -rf /network/*/")
|
||||
err = docker.Exec(context.Background(), "run", "--rm", "--entrypoint", "", "-v", fmt.Sprintf("%v:/network", absDir),
|
||||
"tendermint/e2e-node", "sh", "-c", "rm -rf /network/*/")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ func PerturbNode(node *e2e.Node, perturbation e2e.Perturbation) (*rpctypes.Resul
|
||||
switch perturbation {
|
||||
case e2e.PerturbationDisconnect:
|
||||
logger.Info("perturb node", "msg", log.NewLazySprintf("Disconnecting node %v...", node.Name))
|
||||
if err := docker.Exec("network", "disconnect", testnet.Name+"_"+testnet.Name, node.Name); err != nil {
|
||||
if err := docker.Exec(context.Background(), "network", "disconnect", testnet.Name+"_"+testnet.Name, node.Name) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
time.Sleep(10 * time.Second)
|
||||
if err := docker.Exec("network", "connect", testnet.Name+"_"+testnet.Name, node.Name); err != nil {
|
||||
if err := docker.Exec(context.Background(), "network", "connect", testnet.Name+"_"+testnet.Name, node.Name) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user