Skip to content

Commit

Permalink
tests: Add SIGKILL functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
serathius committed Apr 11, 2022
1 parent dd08e15 commit baea226
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 194 deletions.
19 changes: 19 additions & 0 deletions tests/functional/agent/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (srv *Server) handleTesterRequest(req *rpcpb.Request) (resp *rpcpb.Response

case rpcpb.Operation_SIGTERM_ETCD:
return srv.handle_SIGTERM_ETCD()
case rpcpb.Operation_SIGKILL_ETCD:
return srv.handle_SIGKILL_ETCD()
case rpcpb.Operation_SIGQUIT_ETCD_AND_REMOVE_DATA:
return srv.handle_SIGQUIT_ETCD_AND_REMOVE_DATA()

Expand Down Expand Up @@ -551,6 +553,23 @@ func (srv *Server) handle_SIGTERM_ETCD() (*rpcpb.Response, error) {
}, nil
}

func (srv *Server) handle_SIGKILL_ETCD() (*rpcpb.Response, error) {
if err := srv.stopEtcd(syscall.SIGKILL); err != nil {
return nil, err
}

if srv.etcdServer != nil {
srv.etcdServer.GetLogger().Sync()
} else {
srv.etcdLogFile.Sync()
}

return &rpcpb.Response{
Success: true,
Status: "killed etcd",
}, nil
}

func (srv *Server) handle_SIGQUIT_ETCD_AND_REMOVE_DATA() (*rpcpb.Response, error) {
err := srv.stopEtcd(syscall.SIGQUIT)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/functional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ tester-config:
- SIGTERM_ALL
- SIGQUIT_AND_REMOVE_ONE_FOLLOWER
- SIGQUIT_AND_REMOVE_ONE_FOLLOWER_UNTIL_TRIGGER_SNAPSHOT
- SIGKILL_FOLLOWER
- SIGKILL_LEADER
- BLACKHOLE_PEER_PORT_TX_RX_LEADER
- BLACKHOLE_PEER_PORT_TX_RX_LEADER_UNTIL_TRIGGER_SNAPSHOT
- BLACKHOLE_PEER_PORT_TX_RX_QUORUM
Expand Down
Loading

0 comments on commit baea226

Please sign in to comment.