mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: Backport RunUtilCompletion
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
@@ -78,6 +78,21 @@ func spawnWithExpectLines(args []string, envVars map[string]string, xs ...string
|
||||
return lines, perr
|
||||
}
|
||||
|
||||
func runUtilCompletion(args []string, envVars map[string]string) ([]string, error) {
|
||||
proc, err := spawnCmd(args, envVars)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to spawn command %v with error: %w", args, err)
|
||||
}
|
||||
|
||||
proc.Wait()
|
||||
err = proc.Close()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to close command %v with error: %w", args, err)
|
||||
}
|
||||
|
||||
return proc.Lines(), nil
|
||||
}
|
||||
|
||||
func randomLeaseID() int64 {
|
||||
return rand.New(rand.NewSource(time.Now().UnixNano())).Int63()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user