test: Clean incorrectly used StopSignal field from expect
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>dependabot/go_modules/go.uber.org/atomic-1.10.0
parent
1038c2f45c
commit
157ee32da4
|
@ -45,9 +45,6 @@ type ExpectProcess struct {
|
|||
count int // increment whenever new line gets added
|
||||
cur int // current read position
|
||||
err error
|
||||
|
||||
// StopSignal is the signal Stop sends to the process; defaults to SIGTERM.
|
||||
StopSignal os.Signal
|
||||
}
|
||||
|
||||
// NewExpect creates a new process for expect testing.
|
||||
|
@ -59,7 +56,6 @@ func NewExpect(name string, arg ...string) (ep *ExpectProcess, err error) {
|
|||
// NewExpectWithEnv creates a new process with user defined env variables for expect testing.
|
||||
func NewExpectWithEnv(name string, args []string, env []string, serverProcessConfigName string) (ep *ExpectProcess, err error) {
|
||||
ep = &ExpectProcess{
|
||||
StopSignal: syscall.SIGTERM,
|
||||
cfg: expectConfig{
|
||||
name: serverProcessConfigName,
|
||||
cmd: name,
|
||||
|
@ -196,7 +192,7 @@ func (ep *ExpectProcess) close(kill bool) error {
|
|||
return ep.err
|
||||
}
|
||||
if kill {
|
||||
ep.Signal(ep.StopSignal)
|
||||
ep.Signal(syscall.SIGTERM)
|
||||
}
|
||||
|
||||
err := ep.cmd.Wait()
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -167,7 +166,6 @@ func authGracefulDisableTest(cx ctlCtx) {
|
|||
|
||||
// ...and restart the node
|
||||
node0 := cx.epc.Procs[0]
|
||||
node0.WithStopSignal(syscall.SIGINT)
|
||||
if rerr := node0.Restart(context.TODO()); rerr != nil {
|
||||
cx.t.Fatal(rerr)
|
||||
}
|
||||
|
@ -1281,7 +1279,6 @@ func authTestRevisionConsistency(cx ctlCtx) {
|
|||
oldAuthRevision := sresp.AuthRevision
|
||||
|
||||
// restart the node
|
||||
node0.WithStopSignal(syscall.SIGINT)
|
||||
if err := node0.Restart(context.TODO()); err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
|
@ -1400,7 +1397,6 @@ func authTestCacheReload(cx ctlCtx) {
|
|||
}
|
||||
|
||||
// restart the node
|
||||
node0.WithStopSignal(syscall.SIGINT)
|
||||
if err := node0.Restart(context.TODO()); err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -524,10 +523,3 @@ func (epc *EtcdProcessCluster) Close() error {
|
|||
epc.lg.Info("closed test cluster.")
|
||||
return err
|
||||
}
|
||||
|
||||
func (epc *EtcdProcessCluster) WithStopSignal(sig os.Signal) (ret os.Signal) {
|
||||
for _, p := range epc.Procs {
|
||||
ret = p.WithStopSignal(sig)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -100,11 +99,6 @@ func (p *proxyEtcdProcess) Close() error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (p *proxyEtcdProcess) WithStopSignal(sig os.Signal) os.Signal {
|
||||
p.proxyV3.WithStopSignal(sig)
|
||||
return p.etcdProc.WithStopSignal(sig)
|
||||
}
|
||||
|
||||
func (p *proxyEtcdProcess) Logs() LogsExpect {
|
||||
return p.etcdProc.Logs()
|
||||
}
|
||||
|
@ -154,12 +148,6 @@ func (pp *proxyProc) Stop() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (pp *proxyProc) WithStopSignal(sig os.Signal) os.Signal {
|
||||
ret := pp.proc.StopSignal
|
||||
pp.proc.StopSignal = sig
|
||||
return ret
|
||||
}
|
||||
|
||||
func (pp *proxyProc) Close() error { return pp.Stop() }
|
||||
|
||||
type proxyV2Proc struct {
|
||||
|
|
|
@ -45,7 +45,6 @@ type EtcdProcess interface {
|
|||
Restart(ctx context.Context) error
|
||||
Stop() error
|
||||
Close() error
|
||||
WithStopSignal(sig os.Signal) os.Signal
|
||||
Config() *EtcdServerProcessConfig
|
||||
Logs() LogsExpect
|
||||
}
|
||||
|
@ -163,12 +162,6 @@ func (ep *EtcdServerProcess) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (ep *EtcdServerProcess) WithStopSignal(sig os.Signal) os.Signal {
|
||||
ret := ep.proc.StopSignal
|
||||
ep.proc.StopSignal = sig
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ep *EtcdServerProcess) waitReady(ctx context.Context) error {
|
||||
defer close(ep.donec)
|
||||
return WaitReadyExpectProc(ctx, ep.proc, EtcdServerReadyLines)
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go.etcd.io/etcd/client/pkg/v3/fileutil"
|
||||
|
@ -69,12 +68,7 @@ func SpawnCmdWithLogger(lg *zap.Logger, args []string, envVars map[string]string
|
|||
zap.String("working-dir", wd),
|
||||
zap.String("name", name),
|
||||
zap.Strings("environment-variables", env))
|
||||
ep, err := expect.NewExpectWithEnv(cmd, allArgs, env, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ep.StopSignal = syscall.SIGTERM
|
||||
return ep, nil
|
||||
return expect.NewExpectWithEnv(cmd, allArgs, env, name)
|
||||
}
|
||||
|
||||
func getCovArgs() ([]string, error) {
|
||||
|
|
Loading…
Reference in New Issue