From b0be713546ef10ace9ff425dde365348a0e9924b Mon Sep 17 00:00:00 2001 From: William Banfield Date: Wed, 30 Nov 2022 12:41:48 -0500 Subject: [PATCH] add digital ocean package --- .../pkg/infra/digitalocean/digitalocean.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/e2e/pkg/infra/digitalocean/digitalocean.go diff --git a/test/e2e/pkg/infra/digitalocean/digitalocean.go b/test/e2e/pkg/infra/digitalocean/digitalocean.go new file mode 100644 index 000000000..3529a78b8 --- /dev/null +++ b/test/e2e/pkg/infra/digitalocean/digitalocean.go @@ -0,0 +1,44 @@ +package digitalocean + +import ( + "context" + "fmt" + + e2e "github.com/tendermint/tendermint/test/e2e/pkg" + "github.com/tendermint/tendermint/test/e2e/pkg/infra" + e2essh "github.com/tendermint/tendermint/test/e2e/pkg/ssh" + "golang.org/x/crypto/ssh" +) + +const ( + sshPort = 22 + testappName = "testappd" +) + +var _ infra.Provider = &Provider{} + +// Provider implements a docker-compose backed infrastructure provider. +type Provider struct { + Testnet *e2e.Testnet + InfrastructureData e2e.InfrastructureData + SSHConfig *ssh.ClientConfig +} + +// Noop currently. Setup is performed externally to the e2e test tool. +func (p *Provider) Setup() error { + return nil +} + +// Noop currently. Node creation is currently performed externally to the e2e test tool. +func (p Provider) CreateNode(ctx context.Context, n *e2e.Node) error { + return nil +} +func (p Provider) StartTendermint(ctx context.Context, n *e2e.Node) error { + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl start %s", testappName)) +} +func (p Provider) TerminateTendermint(ctx context.Context, n *e2e.Node) error { + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl -s SIGTERM %s", testappName)) +} +func (p Provider) KillTendermint(ctx context.Context, n *e2e.Node) error { + return e2essh.Exec(p.SSHConfig, fmt.Sprintf("%s:%d", n.IP, sshPort), fmt.Sprintf("systemctl -s SIGKILL %s", testappName)) +}