Skip to content

Commit 74a9edb

Browse files
spboyerCopilot
andcommitted
Fix: use scopeForTemplate instead of deployment for active check
The deployment object returned by generateDeploymentObject embeds a Scope that can be nil in test environments (e.g. mockedScope returns an empty SubscriptionDeployment). Using scopeForTemplate resolves the scope from the provider's configuration, avoiding nil panics in existing tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dbb9578 commit 74a9edb

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,13 @@ func (p *BicepProvider) Deploy(ctx context.Context) (*provisioning.DeployResult,
810810
p.console.StopSpinner(ctx, "", input.StepDone)
811811
}
812812

813-
// Check for active deployments at the target scope and wait if any are in progress
814-
if err := p.waitForActiveDeployments(ctx, deployment); err != nil {
815-
return nil, err
813+
// Check for active deployments at the target scope and wait if any are in progress.
814+
// Use scopeForTemplate to get the raw scope — deployment.Scope may have a nil
815+
// inner scope in test mocks.
816+
if activeScope, err := p.scopeForTemplate(planned.Template); err == nil {
817+
if err := p.waitForActiveDeployments(ctx, activeScope); err != nil {
818+
return nil, err
819+
}
816820
}
817821

818822
progressCtx, cancelProgress := context.WithCancel(ctx)

0 commit comments

Comments
 (0)