sops-pgp-hook: set parallel and helper

This commit is contained in:
Jörg Thalheim 2024-11-17 18:42:20 +01:00
parent 15541d542b
commit 9190dee408

View file

@ -6,7 +6,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path" "path"
"path/filepath"
"runtime" "runtime"
"strings" "strings"
"testing" "testing"
@ -14,14 +13,17 @@ import (
// ok fails the test if an err is not nil. // ok fails the test if an err is not nil.
func ok(tb testing.TB, err error) { func ok(tb testing.TB, err error) {
tb.Helper()
if err != nil { if err != nil {
_, file, line, _ := runtime.Caller(1) fmt.Printf("\033[31munexpected error: %s\033[39m\n\n", err.Error())
fmt.Printf("\033[31m%s:%d: unexpected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error())
tb.FailNow() tb.FailNow()
} }
} }
func TestShellHook(t *testing.T) { func TestShellHook(t *testing.T) {
t.Parallel()
assets := os.Getenv("TEST_ASSETS") assets := os.Getenv("TEST_ASSETS")
if assets == "" { if assets == "" {
_, filename, _, _ := runtime.Caller(0) _, filename, _, _ := runtime.Caller(0)