fix misleading errors on vault shutdown

This commit is contained in:
Daniel Nephin 2021-12-08 13:12:07 -05:00
parent 968aeff1bb
commit 4116a143e0
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package ca
import (
"errors"
"fmt"
"io/ioutil"
"os"
@ -160,7 +161,7 @@ func runTestVault(t testing.T) (*TestVaultServer, error) {
}
t.Cleanup(func() {
if err := testVault.Stop(); err != nil {
t.Log("failed to stop vault server: %w", err)
t.Logf("failed to stop vault server: %v", err)
}
})
@ -207,7 +208,7 @@ func (v *TestVaultServer) Stop() error {
}
if v.cmd.Process != nil {
if err := v.cmd.Process.Signal(os.Interrupt); err != nil {
if err := v.cmd.Process.Signal(os.Interrupt); err != nil && !errors.Is(err, os.ErrProcessDone) {
return fmt.Errorf("failed to kill vault server: %v", err)
}
}