diff --git a/router-tests/go.mod b/router-tests/go.mod index 418a321fa8..b7b400397f 100644 --- a/router-tests/go.mod +++ b/router-tests/go.mod @@ -23,11 +23,11 @@ require ( github.com/twmb/franz-go v1.16.1 github.com/twmb/franz-go/pkg/kadm v1.11.0 github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 - github.com/wundergraph/cosmo/demo v0.0.0-20251029114720-2b84bc4e4e77 + github.com/wundergraph/cosmo/demo v0.0.0-20251030234733-8ed574a0296f github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects v0.0.0-20250715110703-10f2e5f9c79e - github.com/wundergraph/cosmo/router v0.0.0-20251029114720-2b84bc4e4e77 + github.com/wundergraph/cosmo/router v0.0.0-20251030234733-8ed574a0296f github.com/wundergraph/cosmo/router-plugin v0.0.0-20250808194725-de123ba1c65e - github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235 + github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236 go.opentelemetry.io/otel v1.36.0 go.opentelemetry.io/otel/sdk v1.36.0 go.opentelemetry.io/otel/sdk/metric v1.36.0 diff --git a/router-tests/go.sum b/router-tests/go.sum index ee029ab67c..ec1da961cc 100644 --- a/router-tests/go.sum +++ b/router-tests/go.sum @@ -354,8 +354,8 @@ github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTB github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083/go.mod h1:eOTL6acwctsN4F3b7YE+eE2t8zcJ/doLm9sZzsxxxrE= github.com/wundergraph/consul/sdk v0.0.0-20250204115147-ed842a8fd301 h1:EzfKHQoTjFDDcgaECCCR2aTePqMu9QBmPbyhqIYOhV0= github.com/wundergraph/consul/sdk v0.0.0-20250204115147-ed842a8fd301/go.mod h1:wxI0Nak5dI5RvJuzGyiEK4nZj0O9X+Aw6U0tC1wPKq0= -github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235 h1:GiqY9zm5OR6SElIohw/rzfqejm3R1HjlSbMhbtZ4zWM= -github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235/go.mod h1:ErOQH1ki2+SZB8JjpTyGVnoBpg5picIyjvuWQJP4abg= +github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236 h1:LpAdwVd8aU1Qy+xFOlj0jB7GMDqM9Ctl/SmgKTqmOH8= +github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236/go.mod h1:ErOQH1ki2+SZB8JjpTyGVnoBpg5picIyjvuWQJP4abg= github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg= github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= diff --git a/router-tests/integration_test.go b/router-tests/integration_test.go index f64a586508..2a6091d3c5 100644 --- a/router-tests/integration_test.go +++ b/router-tests/integration_test.go @@ -665,7 +665,7 @@ func TestPropagateOperationName(t *testing.T) { var req core.GraphQLRequest require.NoError(t, json.Unmarshal(body, &req)) - require.Contains(t, req.Query, "query Requires__mood__1") + require.Contains(t, req.Query, "query Requires__mood__2") r.Body = io.NopCloser(bytes.NewReader(body)) handler.ServeHTTP(w, r) @@ -680,7 +680,7 @@ func TestPropagateOperationName(t *testing.T) { var req core.GraphQLRequest require.NoError(t, json.Unmarshal(body, &req)) - require.Contains(t, req.Query, "query Requires__availability__2") + require.Contains(t, req.Query, "query Requires__availability__1") r.Body = io.NopCloser(bytes.NewReader(body)) handler.ServeHTTP(w, r) diff --git a/router-tests/testdata/fixtures/query_plans/only_query_plan.json b/router-tests/testdata/fixtures/query_plans/only_query_plan.json index aad00a7dc6..7adfa96583 100644 --- a/router-tests/testdata/fixtures/query_plans/only_query_plan.json +++ b/router-tests/testdata/fixtures/query_plans/only_query_plan.json @@ -23,8 +23,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "mood", - "subgraphId": "6", + "subgraphName": "availability", + "subgraphId": "5", "fetchId": 1, "dependsOnFetchIds": [ 0 @@ -36,12 +36,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "currentMood" + "fieldName": "isAvailable" }, "isUserRequested": false, "dependsOn": [ @@ -65,8 +65,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "availability", - "subgraphId": "5", + "subgraphName": "mood", + "subgraphId": "6", "fetchId": 2, "dependsOnFetchIds": [ 0 @@ -78,12 +78,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "isAvailable" + "fieldName": "currentMood" }, "isUserRequested": false, "dependsOn": [ @@ -117,7 +117,7 @@ "fetchId": 3, "dependsOnFetchIds": [ 0, - 1 + 2 ], "representations": [ { @@ -142,7 +142,7 @@ "isUserRequested": true, "dependsOn": [ { - "fetchId": 1, + "fetchId": 2, "subgraph": "mood", "coordinate": { "typeName": "Employee", @@ -176,7 +176,7 @@ "fetchId": 4, "dependsOnFetchIds": [ 0, - 2 + 1 ], "representations": [ { @@ -212,7 +212,7 @@ }, { "fetchId": 2, - "subgraph": "availability", + "subgraph": "mood", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -222,7 +222,7 @@ }, { "fetchId": 1, - "subgraph": "mood", + "subgraph": "availability", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -241,7 +241,7 @@ "isRequires": true }, { - "fetchId": 2, + "fetchId": 1, "subgraph": "availability", "coordinate": { "typeName": "Employee", diff --git a/router-tests/testdata/fixtures/query_plans/query_plan_with_trace_no_data.json b/router-tests/testdata/fixtures/query_plans/query_plan_with_trace_no_data.json index 75eb5c87fc..b438fd183d 100644 --- a/router-tests/testdata/fixtures/query_plans/query_plan_with_trace_no_data.json +++ b/router-tests/testdata/fixtures/query_plans/query_plan_with_trace_no_data.json @@ -23,8 +23,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "mood", - "subgraphId": "6", + "subgraphName": "availability", + "subgraphId": "5", "fetchId": 1, "dependsOnFetchIds": [ 0 @@ -36,12 +36,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "currentMood" + "fieldName": "isAvailable" }, "isUserRequested": false, "dependsOn": [ @@ -65,8 +65,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "availability", - "subgraphId": "5", + "subgraphName": "mood", + "subgraphId": "6", "fetchId": 2, "dependsOnFetchIds": [ 0 @@ -78,12 +78,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "isAvailable" + "fieldName": "currentMood" }, "isUserRequested": false, "dependsOn": [ @@ -117,7 +117,7 @@ "fetchId": 3, "dependsOnFetchIds": [ 0, - 1 + 2 ], "representations": [ { @@ -142,7 +142,7 @@ "isUserRequested": true, "dependsOn": [ { - "fetchId": 1, + "fetchId": 2, "subgraph": "mood", "coordinate": { "typeName": "Employee", @@ -176,7 +176,7 @@ "fetchId": 4, "dependsOnFetchIds": [ 0, - 2 + 1 ], "representations": [ { @@ -212,7 +212,7 @@ }, { "fetchId": 2, - "subgraph": "availability", + "subgraph": "mood", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -222,7 +222,7 @@ }, { "fetchId": 1, - "subgraph": "mood", + "subgraph": "availability", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -241,7 +241,7 @@ "isRequires": true }, { - "fetchId": 2, + "fetchId": 1, "subgraph": "availability", "coordinate": { "typeName": "Employee", @@ -320,8 +320,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "source_id": "6", - "source_name": "mood" + "source_id": "5", + "source_name": "availability" } }, { @@ -329,8 +329,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "source_id": "5", - "source_name": "availability" + "source_id": "6", + "source_name": "mood" } } ] diff --git a/router-tests/testdata/fixtures/query_plans/response_with_query_plan.json b/router-tests/testdata/fixtures/query_plans/response_with_query_plan.json index b380ebb458..65d638a291 100644 --- a/router-tests/testdata/fixtures/query_plans/response_with_query_plan.json +++ b/router-tests/testdata/fixtures/query_plans/response_with_query_plan.json @@ -41,8 +41,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "mood", - "subgraphId": "6", + "subgraphName": "availability", + "subgraphId": "5", "fetchId": 1, "dependsOnFetchIds": [ 0 @@ -54,12 +54,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "currentMood" + "fieldName": "isAvailable" }, "isUserRequested": false, "dependsOn": [ @@ -83,8 +83,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "availability", - "subgraphId": "5", + "subgraphName": "mood", + "subgraphId": "6", "fetchId": 2, "dependsOnFetchIds": [ 0 @@ -96,12 +96,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", + "query": "query($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "isAvailable" + "fieldName": "currentMood" }, "isUserRequested": false, "dependsOn": [ @@ -135,7 +135,7 @@ "fetchId": 3, "dependsOnFetchIds": [ 0, - 1 + 2 ], "representations": [ { @@ -160,7 +160,7 @@ "isUserRequested": true, "dependsOn": [ { - "fetchId": 1, + "fetchId": 2, "subgraph": "mood", "coordinate": { "typeName": "Employee", @@ -194,7 +194,7 @@ "fetchId": 4, "dependsOnFetchIds": [ 0, - 2 + 1 ], "representations": [ { @@ -230,7 +230,7 @@ }, { "fetchId": 2, - "subgraph": "availability", + "subgraph": "mood", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -240,7 +240,7 @@ }, { "fetchId": 1, - "subgraph": "mood", + "subgraph": "availability", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -259,7 +259,7 @@ "isRequires": true }, { - "fetchId": 2, + "fetchId": 1, "subgraph": "availability", "coordinate": { "typeName": "Employee", diff --git a/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name.json b/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name.json index 4f3aa3637f..87f03620b5 100644 --- a/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name.json +++ b/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name.json @@ -41,8 +41,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "mood", - "subgraphId": "6", + "subgraphName": "availability", + "subgraphId": "5", "fetchId": 1, "dependsOnFetchIds": [ 0 @@ -54,12 +54,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query Requires__mood__1($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", + "query": "query Requires__availability__1($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "currentMood" + "fieldName": "isAvailable" }, "isUserRequested": false, "dependsOn": [ @@ -83,8 +83,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "availability", - "subgraphId": "5", + "subgraphName": "mood", + "subgraphId": "6", "fetchId": 2, "dependsOnFetchIds": [ 0 @@ -96,12 +96,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query Requires__availability__2($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", + "query": "query Requires__mood__2($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "isAvailable" + "fieldName": "currentMood" }, "isUserRequested": false, "dependsOn": [ @@ -135,7 +135,7 @@ "fetchId": 3, "dependsOnFetchIds": [ 0, - 1 + 2 ], "representations": [ { @@ -160,7 +160,7 @@ "isUserRequested": true, "dependsOn": [ { - "fetchId": 1, + "fetchId": 2, "subgraph": "mood", "coordinate": { "typeName": "Employee", @@ -194,7 +194,7 @@ "fetchId": 4, "dependsOnFetchIds": [ 0, - 2 + 1 ], "representations": [ { @@ -230,7 +230,7 @@ }, { "fetchId": 2, - "subgraph": "availability", + "subgraph": "mood", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -240,7 +240,7 @@ }, { "fetchId": 1, - "subgraph": "mood", + "subgraph": "availability", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -259,7 +259,7 @@ "isRequires": true }, { - "fetchId": 2, + "fetchId": 1, "subgraph": "availability", "coordinate": { "typeName": "Employee", diff --git a/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name_sanitized_no_data.json b/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name_sanitized_no_data.json index 3a3df54648..fd84f0fc15 100644 --- a/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name_sanitized_no_data.json +++ b/router-tests/testdata/fixtures/query_plans/response_with_query_plan_operation_name_sanitized_no_data.json @@ -23,8 +23,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "--_$mo\u0026o-d_-$-_-", - "subgraphId": "6", + "subgraphName": "--_$av_ai-la%bi$lit-y_-$-_-", + "subgraphId": "5", "fetchId": 1, "dependsOnFetchIds": [ 0 @@ -36,12 +36,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query Requires__mo_o_d__1($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", + "query": "query Requires__av_ai_la_bi_lit_y__1($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "currentMood" + "fieldName": "isAvailable" }, "isUserRequested": false, "dependsOn": [ @@ -65,8 +65,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "subgraphName": "--_$av_ai-la%bi$lit-y_-$-_-", - "subgraphId": "5", + "subgraphName": "--_$mo\u0026o-d_-$-_-", + "subgraphId": "6", "fetchId": 2, "dependsOnFetchIds": [ 0 @@ -78,12 +78,12 @@ "fragment": "fragment Key on Employee {\n __typename\n id\n}" } ], - "query": "query Requires__av_ai_la_bi_lit_y__2($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n isAvailable\n }\n }\n}", + "query": "query Requires__mo_o_d__2($representations: [_Any!]!){\n _entities(representations: $representations){\n ... on Employee {\n __typename\n currentMood\n }\n }\n}", "dependencies": [ { "coordinate": { "typeName": "Employee", - "fieldName": "isAvailable" + "fieldName": "currentMood" }, "isUserRequested": false, "dependsOn": [ @@ -117,7 +117,7 @@ "fetchId": 3, "dependsOnFetchIds": [ 0, - 1 + 2 ], "representations": [ { @@ -142,7 +142,7 @@ "isUserRequested": true, "dependsOn": [ { - "fetchId": 1, + "fetchId": 2, "subgraph": "--_$mo\u0026o-d_-$-_-", "coordinate": { "typeName": "Employee", @@ -176,7 +176,7 @@ "fetchId": 4, "dependsOnFetchIds": [ 0, - 2 + 1 ], "representations": [ { @@ -212,7 +212,7 @@ }, { "fetchId": 2, - "subgraph": "--_$av_ai-la%bi$lit-y_-$-_-", + "subgraph": "--_$mo\u0026o-d_-$-_-", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -222,7 +222,7 @@ }, { "fetchId": 1, - "subgraph": "--_$mo\u0026o-d_-$-_-", + "subgraph": "--_$av_ai-la%bi$lit-y_-$-_-", "coordinate": { "typeName": "Consultancy", "fieldName": "lead" @@ -241,7 +241,7 @@ "isRequires": true }, { - "fetchId": 2, + "fetchId": 1, "subgraph": "--_$av_ai-la%bi$lit-y_-$-_-", "coordinate": { "typeName": "Employee", @@ -320,8 +320,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "source_id": "6", - "source_name": "--_$mo\u0026o-d_-$-_-" + "source_id": "5", + "source_name": "--_$av_ai-la%bi$lit-y_-$-_-" } }, { @@ -329,8 +329,8 @@ "fetch": { "kind": "BatchEntity", "path": "products.@.lead", - "source_id": "5", - "source_name": "--_$av_ai-la%bi$lit-y_-$-_-" + "source_id": "6", + "source_name": "--_$mo\u0026o-d_-$-_-" } } ] diff --git a/router/go.mod b/router/go.mod index b0337fdf7f..fc86ebeea9 100644 --- a/router/go.mod +++ b/router/go.mod @@ -31,7 +31,7 @@ require ( github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.5 github.com/twmb/franz-go v1.16.1 - github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235 + github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236 // Do not upgrade, it renames attributes we rely on go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 go.opentelemetry.io/contrib/propagators/b3 v1.23.0 diff --git a/router/go.sum b/router/go.sum index 06324c9c54..6ab59cd0f5 100644 --- a/router/go.sum +++ b/router/go.sum @@ -322,8 +322,8 @@ github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/ github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTBjW+SZK4mhxTTBVpxcqeBgWF1Rfmltbfk= github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083/go.mod h1:eOTL6acwctsN4F3b7YE+eE2t8zcJ/doLm9sZzsxxxrE= -github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235 h1:GiqY9zm5OR6SElIohw/rzfqejm3R1HjlSbMhbtZ4zWM= -github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.235/go.mod h1:ErOQH1ki2+SZB8JjpTyGVnoBpg5picIyjvuWQJP4abg= +github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236 h1:LpAdwVd8aU1Qy+xFOlj0jB7GMDqM9Ctl/SmgKTqmOH8= +github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.236/go.mod h1:ErOQH1ki2+SZB8JjpTyGVnoBpg5picIyjvuWQJP4abg= github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= diff --git a/router/internal/planningbenchmark/benchmark_test.go b/router/internal/planningbenchmark/benchmark_test.go index 45dcf70117..9b7c07ed6c 100644 --- a/router/internal/planningbenchmark/benchmark_test.go +++ b/router/internal/planningbenchmark/benchmark_test.go @@ -17,10 +17,12 @@ type BenchmarkConfig struct { OperationPath string `json:"operationPath"` } +const configFileName = "benchmark_config.json" + func TestPlanning(t *testing.T) { - cfgContent, err := os.ReadFile("benchmark_config.json") + cfgContent, err := os.ReadFile(configFileName) if err != nil { - t.Skipf("unable to read benchmark_config.json: %v", err) + t.Skipf("unable to read %s: %v", configFileName, err) } var cfg BenchmarkConfig @@ -38,15 +40,17 @@ func TestPlanning(t *testing.T) { require.NoError(t, err) start := time.Now() - _, err = pl.PlanPreparedOperation(opDoc) + p, err := pl.PlanPreparedOperation(opDoc) require.NoError(t, err) t.Logf("Planning completed in %v", time.Since(start)) + + t.Log(p.PrettyPrint()) } func BenchmarkPlanning(b *testing.B) { - cfgContent, err := os.ReadFile("benchmark_config.json") + cfgContent, err := os.ReadFile(configFileName) if err != nil { - b.Skipf("unable to read benchmark_config.json: %v", err) + b.Skipf("unable to read %s: %v", configFileName, err) } var cfg BenchmarkConfig