From 797fe0b3b2c86debc46910f72e6aaf6385286120 Mon Sep 17 00:00:00 2001 From: Yury Smolski <140245+ysmolski@users.noreply.github.com> Date: Fri, 22 Aug 2025 18:16:38 +0300 Subject: [PATCH 1/2] chore: fix the BenchmarkExecutionEngine Also fix the corresponding test for static datasource. --- execution/Makefile | 1 + execution/engine/execution_engine_test.go | 7 +++---- .../staticdatasource/static_datasource_test.go | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/execution/Makefile b/execution/Makefile index 9f500dfb7e..bb04d12025 100644 --- a/execution/Makefile +++ b/execution/Makefile @@ -6,6 +6,7 @@ test: .PHONY: test-quick test-quick: go test -count=1 ./... + go test -run=xxxx -bench=. -benchtime=1x ./... # updateTestFixtures will update all! golden fixtures .PHONY: updateTestFixtures diff --git a/execution/engine/execution_engine_test.go b/execution/engine/execution_engine_test.go index 31b67f7b57..a2942a7eab 100644 --- a/execution/engine/execution_engine_test.go +++ b/execution/engine/execution_engine_test.go @@ -4668,7 +4668,7 @@ func BenchmarkExecutionEngine(b *testing.B) { }, }, staticdatasource.Configuration{ - Data: `"world"`, + Data: `{"hello": "world"}`, }, ) require.NoError(b, err) @@ -4679,9 +4679,8 @@ func BenchmarkExecutionEngine(b *testing.B) { }) engineConf.SetFieldConfigurations([]plan.FieldConfiguration{ { - TypeName: "Query", - FieldName: "hello", - DisableDefaultMapping: true, + TypeName: "Query", + FieldName: "hello", }, }) diff --git a/v2/pkg/engine/datasource/staticdatasource/static_datasource_test.go b/v2/pkg/engine/datasource/staticdatasource/static_datasource_test.go index bdd36430f9..c6ea27abcc 100644 --- a/v2/pkg/engine/datasource/staticdatasource/static_datasource_test.go +++ b/v2/pkg/engine/datasource/staticdatasource/static_datasource_test.go @@ -24,7 +24,7 @@ func TestStaticDataSourcePlanning(t *testing.T) { Fetch: &resolve.SingleFetch{ DataSourceIdentifier: []byte("staticdatasource.Source"), FetchConfiguration: resolve.FetchConfiguration{ - Input: "world", + Input: `{"hello": "world"}`, DataSource: Source{}, }, }, @@ -35,6 +35,7 @@ func TestStaticDataSourcePlanning(t *testing.T) { { Name: []byte("hello"), Value: &resolve.String{ + Path: []string{"hello"}, Nullable: true, }, }, @@ -57,7 +58,7 @@ func TestStaticDataSourcePlanning(t *testing.T) { }, }, Configuration{ - Data: "world", + Data: `{"hello": "world"}`, }, ) require.NoError(t, err) @@ -66,9 +67,8 @@ func TestStaticDataSourcePlanning(t *testing.T) { }, Fields: []plan.FieldConfiguration{ { - TypeName: "Query", - FieldName: "hello", - DisableDefaultMapping: true, + TypeName: "Query", + FieldName: "hello", }, }, DisableResolveFieldPositions: true, From a68ff846754326ddb63e0b976d88a7b5f64cf2da Mon Sep 17 00:00:00 2001 From: Yury Smolski <140245+ysmolski@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:13:30 +0300 Subject: [PATCH 2/2] check for errors and use better pattern to skip tests while benchmarking --- execution/Makefile | 2 +- execution/engine/execution_engine_test.go | 4 +++- v2/Makefile | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/execution/Makefile b/execution/Makefile index bb04d12025..5bf801f33e 100644 --- a/execution/Makefile +++ b/execution/Makefile @@ -6,7 +6,7 @@ test: .PHONY: test-quick test-quick: go test -count=1 ./... - go test -run=xxxx -bench=. -benchtime=1x ./... + go test -run=^$$ -bench=. -benchtime=1x ./... # updateTestFixtures will update all! golden fixtures .PHONY: updateTestFixtures diff --git a/execution/engine/execution_engine_test.go b/execution/engine/execution_engine_test.go index a2942a7eab..e57567542c 100644 --- a/execution/engine/execution_engine_test.go +++ b/execution/engine/execution_engine_test.go @@ -4724,7 +4724,9 @@ func BenchmarkExecutionEngine(b *testing.B) { for pb.Next() { bc := pool.Get().(*benchCase) bc.writer.Reset() - _ = bc.engine.Execute(ctx, &req, bc.writer) + if err := bc.engine.Execute(ctx, &req, bc.writer); err != nil { + b.Fatal(err) + } pool.Put(bc) } }) diff --git a/v2/Makefile b/v2/Makefile index 99bba14c1a..bd8413275b 100644 --- a/v2/Makefile +++ b/v2/Makefile @@ -11,7 +11,7 @@ test-stability: .PHONY: test-quick test-quick: go test ./... - go test -run=xxxx -bench=. -benchtime=1x ./... + go test -run=^$$ -bench=. -benchtime=1x ./... clean-testcache: go clean -testcache