X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Fsync_test.go;h=17ba044b2e5e75d44530809d055ab9a600054d4c;hb=b2d5dd94dfb0cf2154f7c2da4b2e0bd292fed77e;hp=6f8025a2c7cb8d106be7efe23c4efb1b1644e321;hpb=5d6cc7f14a4bacc36bf3a23cd735a75ad4a90f1d;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/sync/sync_test.go b/cmd/safcm-remote/sync/sync_test.go index 6f8025a..17ba044 100644 --- a/cmd/safcm-remote/sync/sync_test.go +++ b/cmd/safcm-remote/sync/sync_test.go @@ -54,6 +54,8 @@ func (r *testRunner) Run(cmd *exec.Cmd) error { return resErr } func (r *testRunner) CombinedOutput(cmd *exec.Cmd) ([]byte, error) { + r.t.Helper() + stdout, stderr, err := r.check("combinedOutput", cmd) if stderr != nil { // stdout also contains stderr @@ -63,6 +65,7 @@ func (r *testRunner) CombinedOutput(cmd *exec.Cmd) ([]byte, error) { } func (r *testRunner) check(method string, cmd *exec.Cmd) ( []byte, []byte, error) { + r.t.Helper() if len(r.expCmds) == 0 { r.t.Fatalf("%s: empty expCmds", method) @@ -80,10 +83,8 @@ func (r *testRunner) check(method string, cmd *exec.Cmd) ( exp := r.expCmds[0] r.expCmds = r.expCmds[1:] if !reflect.DeepEqual(exp, cmd) { - r.t.Errorf("%s: %s", method, - cmp.Diff(exp, cmd, cmpopts.IgnoreUnexported( - exec.Cmd{}, - bytes.Buffer{}))) + opts := cmpopts.IgnoreUnexported(exec.Cmd{}, bytes.Buffer{}) + r.t.Errorf("%s: %s", method, cmp.Diff(exp, cmd, opts)) } var stdout, stderr []byte @@ -123,9 +124,8 @@ func prepareSync(req safcm.MsgSyncReq, runner *testRunner) ( }() logger := log.NewLogger(logPrefix, - func(level safcm.LogLevel, format string, a ...interface{}) { - res.ch <- fmt.Sprintf("%d: %s", level, - fmt.Sprintf(format, a...)) + func(level safcm.LogLevel, msg string) { + res.ch <- fmt.Sprintf("%d: %s", level, msg) }) return &Sync{ req: req, @@ -135,6 +135,8 @@ func prepareSync(req safcm.MsgSyncReq, runner *testRunner) ( } func (s *syncTestResult) Wait() []string { + s.runner.t.Helper() + close(s.ch) s.wg.Wait()