Use context parallelism

This commit is contained in:
Omar Ismail 2021-09-22 17:59:47 -04:00 committed by Chris Arcand
parent 1791b71196
commit 594a390f84
4 changed files with 10 additions and 6 deletions

View File

@ -42,7 +42,7 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backend.Operatio
return nil, diags.Err()
}
if op.Parallelism != defaultParallelism {
if b.ContextOpts != nil && b.ContextOpts.Parallelism != defaultParallelism {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Custom parallelism values are currently not supported",

View File

@ -46,7 +46,6 @@ func testOperationApplyWithTimeout(t *testing.T, configDir string, timeout time.
return &backend.Operation{
ConfigDir: configDir,
ConfigLoader: configLoader,
Parallelism: defaultParallelism,
PlanRefresh: true,
StateLocker: clistate.NewLocker(timeout, stateLockerView),
Type: backend.OperationTypeApply,
@ -223,7 +222,10 @@ func TestCloud_applyWithParallelism(t *testing.T) {
op, configCleanup, done := testOperationApply(t, "./testdata/apply")
defer configCleanup()
op.Parallelism = 3
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = backend.DefaultStateName
run, err := b.Operation(context.Background(), op)

View File

@ -38,7 +38,7 @@ func (b *Cloud) opPlan(stopCtx, cancelCtx context.Context, op *backend.Operation
return nil, diags.Err()
}
if op.Parallelism != defaultParallelism {
if b.ContextOpts != nil && b.ContextOpts.Parallelism != defaultParallelism {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Custom parallelism values are currently not supported",

View File

@ -44,7 +44,6 @@ func testOperationPlanWithTimeout(t *testing.T, configDir string, timeout time.D
return &backend.Operation{
ConfigDir: configDir,
ConfigLoader: configLoader,
Parallelism: defaultParallelism,
PlanRefresh: true,
StateLocker: clistate.NewLocker(timeout, stateLockerView),
Type: backend.OperationTypePlan,
@ -198,7 +197,10 @@ func TestCloud_planWithParallelism(t *testing.T) {
op, configCleanup, done := testOperationPlan(t, "./testdata/plan")
defer configCleanup()
op.Parallelism = 3
if b.ContextOpts == nil {
b.ContextOpts = &terraform.ContextOpts{}
}
b.ContextOpts.Parallelism = 3
op.Workspace = backend.DefaultStateName
run, err := b.Operation(context.Background(), op)