mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests/framework: Cleanup alternative binaries in e2e tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
parent
f6bb874298
commit
651873cf7b
@ -23,31 +23,6 @@ import (
|
||||
"go.etcd.io/etcd/pkg/v3/expect"
|
||||
)
|
||||
|
||||
var (
|
||||
initBinPath func(string) binPath
|
||||
additionalArgs func() ([]string, error)
|
||||
)
|
||||
|
||||
const noOutputLineCount = 0 // regular binaries emit no extra lines
|
||||
|
||||
func init() {
|
||||
initBinPath = initBinPathNoCov
|
||||
additionalArgs = additionalArgsNoCov
|
||||
}
|
||||
|
||||
func initBinPathNoCov(binDir string) binPath {
|
||||
return binPath{
|
||||
Etcd: binDir + "/etcd",
|
||||
EtcdLastRelease: binDir + "/etcd-last-release",
|
||||
Etcdctl: binDir + "/etcdctl",
|
||||
Etcdutl: binDir + "/etcdutl",
|
||||
}
|
||||
}
|
||||
|
||||
func additionalArgsNoCov() ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
func SpawnCmd(args []string, envVars map[string]string) (*expect.ExpectProcess, error) {
|
||||
return SpawnNamedCmd(strings.Join(args, "_"), args, envVars)
|
||||
}
|
||||
@ -62,15 +37,11 @@ func SpawnCmdWithLogger(lg *zap.Logger, args []string, envVars map[string]string
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newArgs, err := additionalArgs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
env := mergeEnvVariables(envVars)
|
||||
lg.Info("spawning process",
|
||||
zap.Strings("args", args),
|
||||
zap.String("working-dir", wd),
|
||||
zap.String("name", name),
|
||||
zap.Strings("environment-variables", env))
|
||||
return expect.NewExpectWithEnv(args[0], append(args[1:], newArgs...), env, name)
|
||||
return expect.NewExpectWithEnv(args[0], args[1:], env, name)
|
||||
}
|
||||
|
@ -60,7 +60,12 @@ func InitFlags() {
|
||||
flag.StringVar(&CertDir, "cert-dir", certDirDef, "The directory for store certificate files.")
|
||||
flag.Parse()
|
||||
|
||||
BinPath = initBinPath(*binDir)
|
||||
BinPath = binPath{
|
||||
Etcd: *binDir + "/etcd",
|
||||
EtcdLastRelease: *binDir + "/etcd-last-release",
|
||||
Etcdctl: *binDir + "/etcdctl",
|
||||
Etcdutl: *binDir + "/etcdutl",
|
||||
}
|
||||
CertPath = CertDir + "/server.crt"
|
||||
PrivateKeyPath = CertDir + "/server.key.insecure"
|
||||
CaPath = CertDir + "/ca.crt"
|
||||
|
@ -83,8 +83,8 @@ func SpawnWithExpectLines(ctx context.Context, args []string, envVars map[string
|
||||
}
|
||||
|
||||
l := proc.LineCount()
|
||||
if len(xs) == 0 && l != noOutputLineCount { // expect no output
|
||||
return nil, fmt.Errorf("unexpected output from %v (got lines %q, line count %d) %v. Try EXPECT_DEBUG=TRUE", args, lines, l, l != noOutputLineCount)
|
||||
if len(xs) == 0 && l != 0 { // expect no output
|
||||
return nil, fmt.Errorf("unexpected output from %v (got lines %q, line count %d). Try EXPECT_DEBUG=TRUE", args, lines, l)
|
||||
}
|
||||
return lines, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user