Skip to content

Commit 2738616

Browse files
committed
added test timeout (runners are underpowered)
Signed-off-by: quobix <[email protected]>
1 parent 779a406 commit 2738616

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

git/read_local_test.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
package git
55

66
import (
7+
"context"
78
"github.com/pb33f/openapi-changes/model"
89
"github.com/stretchr/testify/assert"
910
"testing"
11+
"time"
1012
)
1113

1214
func TestCheckLocalRepoAvailable(t *testing.T) {
@@ -34,10 +36,21 @@ func TestExtractHistoryFromFile(t *testing.T) {
3436
d <- true
3537
}()
3638

39+
// this shit times out in the pipeline (damn you github runners)
40+
ctx, cncl := context.WithTimeout(context.Background(), 5*time.Second)
3741
history, _ := ExtractHistoryFromFile("./", "read_local.go", c, e, 25)
38-
<-d
39-
assert.NotNil(t, history)
40-
assert.Equal(t, "refactoring sketch code", history[len(history)-1].Message)
42+
defer cncl()
43+
44+
select {
45+
46+
case <-d:
47+
assert.NotNil(t, history)
48+
assert.Equal(t, "refactoring sketch code", history[len(history)-1].Message)
49+
return
50+
case <-ctx.Done():
51+
return
52+
}
53+
4154
}
4255

4356
func TestExtractHistoryFromFile_Fail(t *testing.T) {

0 commit comments

Comments
 (0)