Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit e3da5fc

Browse files
committed
Rename timeoutError, try to deflake cmd test
1 parent ce2280c commit e3da5fc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/gps/cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ type monitoredCmd struct {
2626
stderr *activityBuffer
2727
}
2828

29-
// timeoutError indicates that the monitored process was terminated due to
30-
// exceeding activity timeouts.
31-
type timeoutError struct {
29+
// noProgressError indicates that the monitored process was terminated due to
30+
// exceeding exceeding the progress timeout.
31+
type noProgressError struct {
3232
timeout time.Duration
3333
}
3434

@@ -92,7 +92,7 @@ selloop:
9292
if err := killProcess(c.cmd, isDone); err != nil {
9393
killerr = &killCmdError{err}
9494
} else {
95-
killerr = &timeoutError{c.timeout}
95+
killerr = &noProgressError{c.timeout}
9696
}
9797
break selloop
9898
}
@@ -161,7 +161,7 @@ func (b *activityBuffer) lastActivity() time.Time {
161161
return b.lastActivityStamp
162162
}
163163

164-
func (e timeoutError) Error() string {
164+
func (e noProgressError) Error() string {
165165
return fmt.Sprintf("command killed after %s of no activity", e.timeout)
166166
}
167167

internal/gps/cmd_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
func mkTestCmd(iterations int) *monitoredCmd {
1717
return newMonitoredCmd(
1818
exec.Command("./echosleep", "-n", fmt.Sprint(iterations)),
19-
500*time.Millisecond,
19+
490*time.Millisecond,
2020
)
2121
}
2222

@@ -49,7 +49,7 @@ func TestMonitoredCmd(t *testing.T) {
4949
t.Error("Expected command to fail")
5050
}
5151

52-
_, ok := err.(*timeoutError)
52+
_, ok := err.(*noProgressError)
5353
if !ok {
5454
t.Errorf("Expected a timeout error, but got: %s", err)
5555
}

0 commit comments

Comments
 (0)