lang: Add a test timeout to catch blocked cases

This should catch any blocked tests and report an error. The timeout is
arbitrary.
This commit is contained in:
James Shubin
2021-05-04 11:26:17 -04:00
parent 48da23226c
commit 8a428c6936

View File

@@ -27,6 +27,7 @@ import (
"sort" "sort"
"strings" "strings"
"testing" "testing"
"time"
"github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine"
"github.com/purpleidea/mgmt/engine/graph/autoedge" "github.com/purpleidea/mgmt/engine/graph/autoedge"
@@ -1504,6 +1505,11 @@ func TestAstFunc2(t *testing.T) {
t.Errorf("test #%d: stream errored: %+v", index, err) t.Errorf("test #%d: stream errored: %+v", index, err)
return return
} }
case <-time.After(60 * time.Second): // blocked functions
t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: stream timeout", index)
return
} }
// run interpret! // run interpret!