Integrate verification into e2e tests.

This commit is contained in:
Piotr Tabor
2021-04-28 23:23:45 +02:00
parent 911204cd76
commit 2ad893b110
3 changed files with 21 additions and 6 deletions

View File

@@ -147,6 +147,8 @@ func (ep *ExpectProcess) Signal(sig os.Signal) error {
}
// Close waits for the expect process to exit.
// Close currently does not return error if process exited with !=0 status.
// TODO: Close should expose underlying proces failure by default.
func (ep *ExpectProcess) Close() error { return ep.close(false) }
func (ep *ExpectProcess) close(kill bool) error {
@@ -162,7 +164,6 @@ func (ep *ExpectProcess) close(kill bool) error {
ep.wg.Wait()
if err != nil {
ep.err = err
if !kill && strings.Contains(err.Error(), "exit status") {
// non-zero exit code
err = nil
@@ -170,6 +171,7 @@ func (ep *ExpectProcess) close(kill bool) error {
err = nil
}
}
ep.cmd = nil
return err
}
@@ -178,3 +180,12 @@ func (ep *ExpectProcess) Send(command string) error {
_, err := io.WriteString(ep.fpty, command)
return err
}
func (ep *ExpectProcess) ProcessError() error {
if strings.Contains(ep.err.Error(), "input/output error") {
// TODO: The expect library should not return
// `/dev/ptmx: input/output error` when process just exits.
return nil
}
return ep.err
}