applyTestEnvironmentOverride function

void applyTestEnvironmentOverride({
  1. required EnsembleTestContext context,
  2. required OperationInput input,
})

Applies a validated environment override through the shared test context.

Session-backed and executor operation paths retain their own authorization checks, then delegate mutation and argument validation here.

Implementation

void applyTestEnvironmentOverride({
  required EnsembleTestContext context,
  required OperationInput input,
}) {
  final key = input.arguments['key']?.toString();
  if (key == null || key.isEmpty) {
    throw EnsembleTestFailure('setEnv requires "key"');
  }
  context.setEnv(key, input.arguments['value']);
}