From 849cae8cadd7f222ecafdc2982be9c88290f0fab Mon Sep 17 00:00:00 2001 From: Andreas Marek Date: Wed, 4 Nov 2026 07:55:31 +1000 Subject: [PATCH] Default to exhausted DataLoader dispatching for v27 --- .../graphql/GraphQLUnusualConfiguration.java | 19 ++- .../java/graphql/execution/Execution.java | 6 +- .../DataLoaderDispatchingContextKeys.java | 25 ++-- .../schema/DataFetchingEnvironment.java | 5 + .../schema/DataFetchingEnvironmentImpl.java | 2 +- .../graphql/ChainedDataLoaderTest.groovy | 12 +- .../GraphQLUnusualConfigurationTest.groovy | 27 ++++ ...LoaderDispatchStrategySelectionTest.groovy | 116 ++++++++++++++++++ .../dataloader/DataLoaderHangingTest.groovy | 14 +-- .../dataloader/DeferWithDataLoaderTest.groovy | 2 +- .../DataFetchingEnvironmentImplTest.groovy | 36 ++++++ 11 files changed, 236 insertions(+), 28 deletions(-) create mode 100644 src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatchStrategySelectionTest.groovy diff --git a/src/main/java/graphql/GraphQLUnusualConfiguration.java b/src/main/java/graphql/GraphQLUnusualConfiguration.java index 852d8b4bb1..e05fb3c350 100644 --- a/src/main/java/graphql/GraphQLUnusualConfiguration.java +++ b/src/main/java/graphql/GraphQLUnusualConfiguration.java @@ -363,18 +363,26 @@ private DataloaderConfig(GraphQLContextConfiguration contextConfig) { } /** - * returns true if chained data loader dispatching is enabled + * Returns true if the per-level strategy's chained DataLoader dispatching is enabled. + * Exhausted dispatching supports chaining independently of this setting. */ public boolean isDataLoaderChainingEnabled() { return contextConfig.getBoolean(ENABLE_DATA_LOADER_CHAINING); } + /** + * Returns true if exhausted dispatching is enabled. Since version 27, this defaults to true + * unless per-level chained dispatching is explicitly enabled. + */ public boolean isDataLoaderExhaustedDispatchingEnabled() { - return contextConfig.get(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING); + Boolean enabled = contextConfig.get(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING); + return enabled != null ? enabled : !isDataLoaderChainingEnabled(); } /** - * Enables the ability that chained DataLoaders are dispatched automatically. + * Enables automatic dispatching of chained DataLoaders using the per-level strategy. + * This selects per-level dispatching when exhausted dispatching is not explicitly configured. + * Explicitly enabling both strategies is invalid. */ @ExperimentalApi public DataloaderConfig enableDataLoaderChaining(boolean enable) { @@ -385,6 +393,11 @@ public DataloaderConfig enableDataLoaderChaining(boolean enable) { /** * Enables a dispatching strategy that will dispatch as long as there is no * other data fetcher or batch loader running. + * Since version 27, this is the default unless per-level chained dispatching is explicitly enabled. + * DataLoaders must be obtained through {@link graphql.schema.DataFetchingEnvironment#getDataLoader(String)} + * so that their load calls can be tracked, including chained loads. + * Set this to false to use per-level dispatching. Explicitly enabling both exhausted dispatching + * and per-level chained dispatching is invalid. */ @ExperimentalApi public DataloaderConfig enableDataLoaderExhaustedDispatching(boolean enable) { diff --git a/src/main/java/graphql/execution/Execution.java b/src/main/java/graphql/execution/Execution.java index df7a0f6aeb..4797d7a333 100644 --- a/src/main/java/graphql/execution/Execution.java +++ b/src/main/java/graphql/execution/Execution.java @@ -295,8 +295,10 @@ private DataLoaderDispatchStrategy createDataLoaderDispatchStrategy(ExecutionCon if (executionContext.getDataLoaderRegistry() == EMPTY_DATALOADER_REGISTRY || doNotAutomaticallyDispatchDataLoader) { return DataLoaderDispatchStrategy.NO_OP; } - if (executionContext.getGraphQLContext().getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, false)) { - if (executionContext.getGraphQLContext().getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING, false)) { + GraphQLContext graphQLContext = executionContext.getGraphQLContext(); + boolean chainingEnabled = graphQLContext.getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING, false); + if (graphQLContext.getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, !chainingEnabled)) { + if (chainingEnabled) { throw new GraphQLException("enabling data loader chaining and exhausted dispatching at the same time ambiguous"); } return new ExhaustedDataLoaderDispatchStrategy(executionContext); diff --git a/src/main/java/graphql/execution/instrumentation/dataloader/DataLoaderDispatchingContextKeys.java b/src/main/java/graphql/execution/instrumentation/dataloader/DataLoaderDispatchingContextKeys.java index c41196e050..f23a79c63c 100644 --- a/src/main/java/graphql/execution/instrumentation/dataloader/DataLoaderDispatchingContextKeys.java +++ b/src/main/java/graphql/execution/instrumentation/dataloader/DataLoaderDispatchingContextKeys.java @@ -15,10 +15,12 @@ private DataLoaderDispatchingContextKeys() { } /** - * Enables the ability to chain DataLoader dispatching. + * Enables chained DataLoader dispatching using the per-level strategy. *

- * Because this requires that all DataLoaders are accessed via DataFetchingEnvironment.getLoader() - * this is not completely backwards compatible and therefore disabled by default. + * This is disabled by default. Enabling it selects per-level dispatching unless exhausted dispatching + * is explicitly configured. Explicitly enabling both strategies is invalid. + * DataLoaders must be accessed via {@link graphql.schema.DataFetchingEnvironment#getDataLoader(String)}. + * The default exhausted strategy supports chaining independently of this setting. *

* Expects a boolean value. */ @@ -26,25 +28,30 @@ private DataLoaderDispatchingContextKeys() { /** - * Enabled a different dispatching strategy that mimics the JS event loop based one: + * Enables a dispatching strategy that mimics the JS event loop based one: * DataLoader will be dispatched as soon as there is no data fetcher or batch loader currently running. - * + * Since version 27, this defaults to true unless {@link #ENABLE_DATA_LOADER_CHAINING} is true. + * Set this to false to use per-level dispatching. DataLoaders must be accessed via + * {@link graphql.schema.DataFetchingEnvironment#getDataLoader(String)} so their load calls can be tracked. */ public static final String ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING = "__GJ_enable_data_loader_exhausted_dispatching"; /** - * Enables the ability that chained DataLoaders are dispatched automatically. + * Enables automatic dispatching of chained DataLoaders using the per-level strategy. * - * @param graphQLContext + * @param graphQLContext the execution context + * @param enabled whether to enable per-level chained dispatching */ public static void setEnableDataLoaderChaining(GraphQLContext graphQLContext, boolean enabled) { graphQLContext.put(ENABLE_DATA_LOADER_CHAINING, enabled); } /** - * Enables the ability that chained DataLoaders are dispatched automatically. + * Configures exhausted dispatching, which is the default since version 27 unless per-level chained + * dispatching is explicitly enabled. Set this to false to use per-level dispatching. * - * @param graphQLContext + * @param graphQLContext the execution context + * @param enabled whether to use exhausted dispatching */ public static void setEnableDataLoaderExhaustedDispatching(GraphQLContext graphQLContext, boolean enabled) { graphQLContext.put(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, enabled); diff --git a/src/main/java/graphql/schema/DataFetchingEnvironment.java b/src/main/java/graphql/schema/DataFetchingEnvironment.java index b08356f3e4..c93f0256e9 100644 --- a/src/main/java/graphql/schema/DataFetchingEnvironment.java +++ b/src/main/java/graphql/schema/DataFetchingEnvironment.java @@ -228,6 +228,11 @@ public interface DataFetchingEnvironment extends IntrospectionDataFetchingEnviro /** * This allows you to retrieve a named dataloader from the underlying {@link org.dataloader.DataLoaderRegistry} + *

+ * Since version 27, the default exhausted dispatching strategy requires loaders to be obtained through + * this method so that load calls, including chained loads, can be tracked for automatic dispatching. + * Loading directly through the registry or a separately held loader bypasses this tracking and can + * leave the execution waiting for loads that are never dispatched. * * @param dataLoaderName the name of the data loader to fetch * @param the key type diff --git a/src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java b/src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java index 8ee29d1632..36644c9bed 100644 --- a/src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java +++ b/src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java @@ -236,7 +236,7 @@ public ExecutionStepInfo getExecutionStepInfo() { return null; } if (!graphQLContext.getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING, false) - && !graphQLContext.getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, false)) { + && !graphQLContext.getBoolean(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, true)) { return dataLoader; } return new DataLoaderWithContext<>(this, dataLoaderName, dataLoader); diff --git a/src/test/groovy/graphql/ChainedDataLoaderTest.groovy b/src/test/groovy/graphql/ChainedDataLoaderTest.groovy index 98986b32c2..0a33c14585 100644 --- a/src/test/groovy/graphql/ChainedDataLoaderTest.groovy +++ b/src/test/groovy/graphql/ChainedDataLoaderTest.groovy @@ -14,6 +14,8 @@ import java.util.concurrent.ExecutionException import java.util.concurrent.atomic.AtomicInteger import static graphql.ExecutionInput.newExecutionInput +import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING +import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.setEnableDataLoaderChaining import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.setEnableDataLoaderExhaustedDispatching import static java.util.concurrent.CompletableFuture.supplyAsync @@ -71,19 +73,19 @@ class ChainedDataLoaderTest extends Specification { def graphQL = GraphQL.newGraphQL(schema).build() def query = "{ dogName catName } " - def ei = newExecutionInput(query).dataLoaderRegistry(dataLoaderRegistry).build() - chainedDataLoaderOrExhaustedDispatcher ? setEnableDataLoaderChaining(ei.graphQLContext, true) : setEnableDataLoaderExhaustedDispatching(ei.graphQLContext, true) + def ei = newExecutionInput(query).dataLoaderRegistry(dataLoaderRegistry).graphQLContext(dispatchConfiguration).build() when: def efCF = graphQL.executeAsync(ei) Awaitility.await().until { efCF.isDone() } def er = efCF.get() then: + er.errors.empty er.data == [dogName: "Luna", catName: "Tiger"] batchLoadCalls == 2 where: - chainedDataLoaderOrExhaustedDispatcher << [true, false] + dispatchConfiguration << [[:], [(ENABLE_DATA_LOADER_CHAINING): true], [(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING): true]] } @Unroll @@ -418,7 +420,7 @@ class ChainedDataLoaderTest extends Specification { } - def "handling of chained DataLoaders is disabled by default"() { + def "handling of chained DataLoaders can be disabled with per-level dispatching"() { given: def sdl = ''' @@ -467,7 +469,7 @@ class ChainedDataLoaderTest extends Specification { def query = "{ dogName catName } " def ei = newExecutionInput(query).dataLoaderRegistry(dataLoaderRegistry).build() - + setEnableDataLoaderExhaustedDispatching(ei.graphQLContext, false) when: def er = graphQL.executeAsync(ei) diff --git a/src/test/groovy/graphql/config/GraphQLUnusualConfigurationTest.groovy b/src/test/groovy/graphql/config/GraphQLUnusualConfigurationTest.groovy index 6149e9bb75..c68ad11b43 100644 --- a/src/test/groovy/graphql/config/GraphQLUnusualConfigurationTest.groovy +++ b/src/test/groovy/graphql/config/GraphQLUnusualConfigurationTest.groovy @@ -143,6 +143,33 @@ class GraphQLUnusualConfigurationTest extends Specification { GraphQL.unusualConfiguration(graphqlContext).dataloaderConfig().isDataLoaderChainingEnabled() } + def "exhausted dispatch configuration reports the effective default for contexts and builders"() { + given: + def builder = GraphQLContext.newContext() + def config = GraphQL.unusualConfiguration(builder).dataloaderConfig() + if (chaining != null) { + config.enableDataLoaderChaining(chaining) + } + if (exhausted != null) { + config.enableDataLoaderExhaustedDispatching(exhausted) + } + + expect: + config.isDataLoaderExhaustedDispatchingEnabled() == expected + GraphQL.unusualConfiguration(builder.build()).dataloaderConfig().isDataLoaderExhaustedDispatchingEnabled() == expected + + where: + exhausted | chaining | expected + null | null | true + null | false | true + null | true | false + false | null | false + false | false | false + false | true | false + true | null | true + true | false | true + } + def "we can access via the ExecutionInput"() { when: def eiBuilder = ExecutionInput.newExecutionInput("query q {f}") diff --git a/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatchStrategySelectionTest.groovy b/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatchStrategySelectionTest.groovy new file mode 100644 index 0000000000..44519cb715 --- /dev/null +++ b/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatchStrategySelectionTest.groovy @@ -0,0 +1,116 @@ +package graphql.execution.instrumentation.dataloader + +import graphql.EngineRunningState +import graphql.ExecutionInput +import graphql.ExecutionResultImpl +import graphql.GraphQL +import graphql.MutationSchema +import graphql.Profiler +import graphql.TestUtil +import graphql.execution.DataLoaderDispatchStrategy +import graphql.execution.Execution +import graphql.execution.ExecutionContext +import graphql.execution.ExecutionId +import graphql.execution.ExecutionStrategy +import graphql.execution.ExecutionStrategyParameters +import graphql.execution.ValueUnboxer +import graphql.execution.instrumentation.SimplePerformantInstrumentation +import graphql.parser.Parser +import graphql.schema.DataFetcher +import org.dataloader.BatchLoader +import org.dataloader.DataLoaderFactory +import org.dataloader.DataLoaderRegistry +import spock.lang.Specification + +import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING +import static graphql.execution.instrumentation.dataloader.DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING +import static java.util.concurrent.CompletableFuture.completedFuture +import static java.util.concurrent.TimeUnit.SECONDS + +class DataLoaderDispatchStrategySelectionTest extends Specification { + + def "per-level opt-out preserves automatic dispatch of directly accessed loaders"() { + given: + def loader = DataLoaderFactory.newDataLoader({ keys -> completedFuture(keys) } as BatchLoader) + def registry = new DataLoaderRegistry().register("names", loader) + DataFetcher fetcher = { environment -> registry.getDataLoader("names").load("Luna") } + def graphQL = GraphQL.newGraphQL(TestUtil.schema("type Query { name: String }", [Query: [name: fetcher]])).build() + def input = ExecutionInput.newExecutionInput("{ name }").dataLoaderRegistry(registry).build() + GraphQL.unusualConfiguration(input).dataloaderConfig().enableDataLoaderExhaustedDispatching(false) + + when: + def result = graphQL.executeAsync(input).get(5, SECONDS) + + then: + result.errors.empty + result.data == [name: "Luna"] + } + + def "selects the configured dispatch strategy for #operation with exhausted=#exhausted and chaining=#chaining"() { + given: + def input = ExecutionInput.newExecutionInput("$operation { __typename }") + .dataLoaderRegistry(new DataLoaderRegistry()) + .build() + if (exhausted != null) { + input.graphQLContext.put(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, exhausted) + } + if (chaining != null) { + input.graphQLContext.put(ENABLE_DATA_LOADER_CHAINING, chaining) + } + def strategy = Mock(ExecutionStrategy) + def execution = new Execution(strategy, strategy, strategy, SimplePerformantInstrumentation.INSTANCE, ValueUnboxer.DEFAULT, false) + + when: + execution.execute(Parser.parse(input.query), MutationSchema.schema, ExecutionId.generate(), input, null, + new EngineRunningState(input, Profiler.NO_OP), Profiler.NO_OP).join() + + then: + 1 * strategy.execute(_, _) >> { ExecutionContext context, ExecutionStrategyParameters parameters -> + assert context.dataLoaderDispatcherStrategy.class == expected + completedFuture(new ExecutionResultImpl([__typename: "Root"], [])) + } + + where: + [operation, exhausted, chaining, expected] << [ + ["query", "mutation", "subscription"], + [ + [null, null, ExhaustedDataLoaderDispatchStrategy], + [null, false, ExhaustedDataLoaderDispatchStrategy], + [null, true, PerLevelDataLoaderDispatchStrategy], + [false, null, PerLevelDataLoaderDispatchStrategy], + [false, false, PerLevelDataLoaderDispatchStrategy], + [false, true, PerLevelDataLoaderDispatchStrategy], + [true, null, ExhaustedDataLoaderDispatchStrategy], + [true, false, ExhaustedDataLoaderDispatchStrategy], + ] + ].combinations().collect { [it[0]] + it[1] } + } + + def "automatic dispatch stays disabled without a registry or when explicitly disabled"() { + given: + def inputBuilder = ExecutionInput.newExecutionInput("{ __typename }") + .graphQLContext([(ENABLE_DATA_LOADER_CHAINING): true, (ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING): true]) + if (withRegistry) { + inputBuilder.dataLoaderRegistry(new DataLoaderRegistry()) + } + def input = inputBuilder.build() + def strategy = Mock(ExecutionStrategy) + def execution = new Execution(strategy, strategy, strategy, SimplePerformantInstrumentation.INSTANCE, ValueUnboxer.DEFAULT, disableAutomaticDispatch) + + when: + execution.execute(Parser.parse(input.query), MutationSchema.schema, ExecutionId.generate(), input, null, + new EngineRunningState(input, Profiler.NO_OP), Profiler.NO_OP).join() + + then: + 1 * strategy.execute(_, _) >> { ExecutionContext context, ExecutionStrategyParameters parameters -> + assert context.dataLoaderDispatcherStrategy.is(DataLoaderDispatchStrategy.NO_OP) + completedFuture(new ExecutionResultImpl([__typename: "Root"], [])) + } + + where: + withRegistry | disableAutomaticDispatch + false | false + false | true + true | true + } +} diff --git a/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderHangingTest.groovy b/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderHangingTest.groovy index f3b9087073..50b7acb1de 100644 --- a/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderHangingTest.groovy +++ b/src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderHangingTest.groovy @@ -307,8 +307,7 @@ class DataLoaderHangingTest extends Specification { @Override Object get(DataFetchingEnvironment environment) { Product source = environment.getSource() - DataLoaderRegistry dlRegistry = environment.getGraphQlContext().get("registry") - DataLoader personDL = dlRegistry.getDataLoader("person") + DataLoader personDL = environment.getDataLoader("person") return personDL.load(source.getSuppliedById()).thenApply({ person -> if (person.id == 0) { throw new RuntimeException("Failure in suppliedByDF for person with ID == 0.") @@ -322,8 +321,7 @@ class DataLoaderHangingTest extends Specification { @Override Object get(DataFetchingEnvironment environment) { Person source = environment.getSource() - DataLoaderRegistry dlRegistry = environment.getGraphQlContext().get("registry") - DataLoader companyDL = dlRegistry.getDataLoader("company") + DataLoader companyDL = environment.getDataLoader("company") return companyDL.load(source.getCompanyId()) } } @@ -372,16 +370,18 @@ class DataLoaderHangingTest extends Specification { ExecutionInput executionInput = newExecutionInput() .query(query) - .graphQLContext(["registry": registry]) - .graphQLContext([(ENABLE_DATA_LOADER_CHAINING): false]) + .graphQLContext(dispatchConfiguration) .dataLoaderRegistry(registry) .build() - def executionResult = graphQL.execute(executionInput) + def executionResult = graphQL.executeAsync(executionInput).get(10, java.util.concurrent.TimeUnit.SECONDS) then: (executionResult.errors.size() > 0) + + where: + dispatchConfiguration << [[:], [(ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING): false], [(ENABLE_DATA_LOADER_CHAINING): true]] } } diff --git a/src/test/groovy/graphql/execution/instrumentation/dataloader/DeferWithDataLoaderTest.groovy b/src/test/groovy/graphql/execution/instrumentation/dataloader/DeferWithDataLoaderTest.groovy index 2f87b53283..463049e4f3 100644 --- a/src/test/groovy/graphql/execution/instrumentation/dataloader/DeferWithDataLoaderTest.groovy +++ b/src/test/groovy/graphql/execution/instrumentation/dataloader/DeferWithDataLoaderTest.groovy @@ -374,7 +374,7 @@ class DeferWithDataLoaderTest extends Specification { combined.errors == null combined.data == expectedExpensiveData - if (contextKey == ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING) { + if (contextKey == ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING || contextKey == null) { // based on the timing of shops vs expensiveShops DF it could be one or two batch loader calls batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 1 || batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 2 } else { diff --git a/src/test/groovy/graphql/schema/DataFetchingEnvironmentImplTest.groovy b/src/test/groovy/graphql/schema/DataFetchingEnvironmentImplTest.groovy index 8c401f0d63..5eee87d33f 100644 --- a/src/test/groovy/graphql/schema/DataFetchingEnvironmentImplTest.groovy +++ b/src/test/groovy/graphql/schema/DataFetchingEnvironmentImplTest.groovy @@ -137,6 +137,42 @@ class DataFetchingEnvironmentImplTest extends Specification { } + def "loader calls are tracked for the default and explicitly configured dispatch strategies"() { + given: + def context = GraphQLContext.newContext().build() + if (exhausted != null) { + context.put(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING, exhausted) + } + if (chaining != null) { + context.put(DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING, chaining) + } + def environment = newDataFetchingEnvironment(executionContext).graphQLContext(context).build() + def registeredLoader = dataLoaderRegistry.getDataLoader("dataLoader") + + when: + def loader = environment.getDataLoader("dataLoader") + + then: + (loader instanceof DataLoaderWithContext) == wrapped + if (wrapped) { + assert loader.delegate.is(registeredLoader) + } else { + assert loader.is(registeredLoader) + } + environment.getDataLoader("missing") == null + + where: + exhausted | chaining | wrapped + null | null | true + null | false | true + null | true | true + false | null | false + false | false | false + false | true | true + true | null | true + true | false | true + } + def "get or default support"() { when: def dfe = newDataFetchingEnvironment(executionContext)