Skip to content

Commit

Permalink
Merge pull request #400 from 99designs/fix-ci
Browse files Browse the repository at this point in the history
fix Circle CI test
  • Loading branch information
vvakame authored Oct 28, 2018
2 parents 1b17b5a + 00d1179 commit 0d5c65b
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 4 deletions.
16 changes: 12 additions & 4 deletions codegen/testserver/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import (
"reflect"
"runtime"
"sort"
"sync"
"testing"
"time"

"github.com/stretchr/testify/assert"

"github.com/99designs/gqlgen/graphql"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/handler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -88,6 +87,7 @@ func TestGeneratedServer(t *testing.T) {
resolvers := &testResolver{tick: make(chan string, 1)}

var tracerLog []string
var mu sync.Mutex

srv := httptest.NewServer(
handler.GraphQL(
Expand All @@ -103,12 +103,16 @@ func TestGeneratedServer(t *testing.T) {
handler.Tracer(&testTracer{
id: 1,
append: func(s string) {
mu.Lock()
defer mu.Unlock()
tracerLog = append(tracerLog, s)
},
}),
handler.Tracer(&testTracer{
id: 2,
append: func(s string) {
mu.Lock()
defer mu.Unlock()
tracerLog = append(tracerLog, s)
},
}),
Expand Down Expand Up @@ -195,7 +199,9 @@ func TestGeneratedServer(t *testing.T) {
}
}

mu.Lock()
tracerLog = nil
mu.Unlock()
called := false
resolvers.userFriends = func(ctx context.Context, obj *User) ([]User, error) {
assert.Equal(t, []string{
Expand All @@ -214,6 +220,8 @@ func TestGeneratedServer(t *testing.T) {

require.NoError(t, err)
require.True(t, called)
mu.Lock()
defer mu.Unlock()
assert.Equal(t, []string{
"op:start:1", "op:start:2",

Expand Down
Loading

0 comments on commit 0d5c65b

Please sign in to comment.