Skip to content

Commit c1e84ca

Browse files
authored
Merge pull request #859 from google/exec-test
test: Add extra debugging to the exec test.
2 parents 47d3a6d + cdc20a9 commit c1e84ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/mtail/exec_integration_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Google Inc. ll Rights Reserved.
1+
// Copyright 2024 Google Inc. All Rights Reserved.
22
// This file is available under the Apache license.
33

44
package mtail_test
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"os/exec"
1111
"path/filepath"
12+
"syscall"
1213
"testing"
1314
"time"
1415

@@ -39,13 +40,19 @@ func TestExecMtail(t *testing.T) {
3940
"-progs",
4041
"../../examples",
4142
"-logs", "testdata/rsyncd.log",
43+
"--logtostderr",
44+
"--v=2",
4245
"-one_shot",
4346
"-one_shot_format=prometheus",
4447
"-port", fmt.Sprintf("%d", testutil.FreePort(t)),
4548
}
4649
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
4750
defer cancel()
4851
cmd := exec.CommandContext(ctx, mtailPath, cs...)
52+
cmd.Cancel = func() error {
53+
// Kill with abort to dump stack
54+
return cmd.Process.Signal(syscall.SIGABRT)
55+
}
4956
if out, err := cmd.CombinedOutput(); err != nil {
5057
t.Logf("%s", out)
5158
t.Error(err)

0 commit comments

Comments
 (0)