Skip to content

Commit

Permalink
ci: Fix flaky tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Jul 24, 2023
1 parent 284c165 commit 32c0235
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions cmd/cayleyexport/cayleyexport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"testing"
"time"

"github.com/cayleygraph/cayley/graph"
"github.com/cayleygraph/cayley/graph/memstore"
chttp "github.com/cayleygraph/cayley/internal/http"
"github.com/cayleygraph/quad"
"github.com/cayleygraph/quad/jsonld"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"

"github.com/cayleygraph/cayley/graph"
"github.com/cayleygraph/cayley/graph/memstore"
chttp "github.com/cayleygraph/cayley/internal/http"
)

var testData = []quad.Quad{
Expand Down Expand Up @@ -53,7 +54,7 @@ func TestCayleyExport(t *testing.T) {
addr := fmt.Sprintf("127.0.0.1:%d", port)
uri := fmt.Sprintf("http://%s", addr)
go serve(addr)
time.Sleep(300 * time.Millisecond)
time.Sleep(time.Second / 2)
cmd := NewCmd()
b := bytes.NewBufferString("")
cmd.SetOut(b)
Expand Down
7 changes: 4 additions & 3 deletions cmd/cayleyimport/cayleyimport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"testing"
"time"

"github.com/phayes/freeport"
"github.com/stretchr/testify/require"

"github.com/cayleygraph/cayley/graph"
"github.com/cayleygraph/cayley/graph/memstore"
chttp "github.com/cayleygraph/cayley/internal/http"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"
)

func serve(addr string) {
Expand All @@ -35,7 +36,7 @@ func TestCayleyImport(t *testing.T) {
addr := fmt.Sprintf("127.0.0.1:%d", port)
uri := fmt.Sprintf("http://%s", addr)
go serve(addr)
time.Sleep(3 * time.Nanosecond)
time.Sleep(time.Second / 2)
cmd := NewCmd()
b := bytes.NewBufferString("")
cmd.SetOut(b)
Expand Down

0 comments on commit 32c0235

Please sign in to comment.