update to fix some tests, remove panics, and wrap errors

This commit is contained in:
Tai Groot
2023-06-17 23:18:28 -04:00
parent 5da4924315
commit 0075dc6b4d
7 changed files with 197 additions and 205 deletions

View File

@@ -2,6 +2,7 @@ package systemctl
import (
"context"
"errors"
"fmt"
"reflect"
"runtime"
@@ -63,7 +64,7 @@ func TestErrorFuncs(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
err := f(ctx, tc.unit, tc.opts)
if err != tc.err {
if !errors.Is(err, tc.err) {
t.Errorf("error is %v, but should have been %v", err, tc.err)
}
})