From 72678c2848dfedbe70a9e6ed320da8b1b0706fd5 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 13 Jan 2021 09:59:58 +0100 Subject: [PATCH] graphql: fix spurious error in test --- graphql/graphql_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go index fc62da1813a2..4a1644a61bca 100644 --- a/graphql/graphql_test.go +++ b/graphql/graphql_test.go @@ -33,7 +33,14 @@ import ( ) func TestBuildSchema(t *testing.T) { - stack, err := node.New(&node.DefaultConfig) + ddir, err := ioutil.TempDir("", "graphql-buildschema") + if err != nil { + t.Fatalf("failed to create temporary datadir: %v", err) + } + // Copy config + conf := node.DefaultConfig + conf.DataDir = ddir + stack, err := node.New(&conf) if err != nil { t.Fatalf("could not create new node: %v", err) } @@ -157,6 +164,7 @@ func TestGraphQLHTTPOnSamePort_GQLRequest_Unsuccessful(t *testing.T) { if err != nil { t.Fatalf("could not read from response body: %v", err) } + resp.Body.Close() // make sure the request is not handled successfully if want, have := "404 page not found\n", string(bodyBytes); have != want { t.Errorf("have:\n%v\nwant:\n%v", have, want)