Skip to content

Commit

Permalink
tests/framework/e2e: kill etcd cluster processes after test finished
Browse files Browse the repository at this point in the history
Signed-off-by: Chao Chen <[email protected]>
  • Loading branch information
chaochn47 committed Apr 4, 2023
1 parent 6f4e5f3 commit 1898654
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/framework/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,13 @@ func (epc *EtcdProcessCluster) Stop() (err error) {
return err
}

func (epc *EtcdProcessCluster) ForceStop() (err error) {
for _, member := range epc.Procs {
member.Kill()
}
return epc.Stop()
}

func (epc *EtcdProcessCluster) Client(opts ...config.ClientOption) *EtcdctlV3 {
etcdctl, err := NewEtcdctl(epc.Cfg.Client, epc.EndpointsGRPC(), opts...)
if err != nil {
Expand All @@ -888,7 +895,7 @@ func (epc *EtcdProcessCluster) Client(opts ...config.ClientOption) *EtcdctlV3 {

func (epc *EtcdProcessCluster) Close() error {
epc.lg.Info("closing test cluster...")
err := epc.Stop()
err := epc.ForceStop()
for _, p := range epc.Procs {
// p is nil when NewEtcdProcess fails in the middle
// Close still gets called to clean up test data
Expand Down

0 comments on commit 1898654

Please sign in to comment.