helper: test non-existent helpers

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
2024-10-06 16:00:59 +09:00
parent ba76e2919b
commit 18d9ce733e
3 changed files with 30 additions and 7 deletions

View File

@@ -1,7 +1,9 @@
package helper_test
import (
"errors"
"io"
"os"
"strings"
"sync"
"testing"
@@ -38,6 +40,15 @@ func TestHelper_StartNotify_Close_Wait(t *testing.T) {
helper.InternalReplaceExecCommand(t)
argsOnce.Do(prepareArgs)
t.Run("start non-existent helper path", func(t *testing.T) {
h := helper.New(argsWt, "/nonexistent")
if err := h.Start(); !errors.Is(err, os.ErrNotExist) {
t.Errorf("Start() error = %v, wantErr %v",
err, os.ErrNotExist)
}
})
t.Run("start helper with status channel", func(t *testing.T) {
h := helper.New(argsWt, "crash-test-dummy", "--args=3", "--fd=4")
ready := make(chan error, 1)