Skip to content

Added azure provisioning tests#22275

Closed
laurenastrid1 wants to merge 4 commits into
mainfrom
laurenastrid1/azureProvisioningTests
Closed

Added azure provisioning tests#22275
laurenastrid1 wants to merge 4 commits into
mainfrom
laurenastrid1/azureProvisioningTests

Conversation

@laurenastrid1
Copy link
Copy Markdown
Contributor

Description

Added azure provisioning unit tests, and tests for the added azure functions.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds unit test coverage around Azure provisioning helpers and extends Azure SQL Database provisioning to pass a selectable max vCores value through to database creation, with accompanying localization updates. It also includes webview UI changes on the Azure SQL Database deployment flow.

Changes:

  • Added new unit tests for azureSqlDatabaseHelpers and expanded tests in azureHelpers.
  • Added maxVcores to the Azure SQL Database deployment form state, form components, and provisioning call into createAzureSqlDatabase.
  • Updated Azure SQL Database deployment webviews (notably removing the provisioning “What’s next” links card and removing the free-offer limit behavior selection UI).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Localization entries for new Azure SQL strings (auto-generated localization file).
extensions/mssql/test/unit/azureSqlDatabaseHelpers.test.ts New unit tests covering Azure SQL Database deployment helper behaviors.
extensions/mssql/test/unit/azureHelpers.test.ts Added unit tests for tenant/account helpers and standalone account/tenant loaders.
extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseProvisioningPage.tsx Removes the completed-state docs links (“What’s next”) card from the provisioning page.
extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseFormPage.tsx Removes the free-offer exhaustion behavior selection UI from the form page.
extensions/mssql/src/sharedInterfaces/azureSqlDatabase.ts Adds maxVcores to the Azure SQL Database form state contract.
extensions/mssql/src/deployment/azureSqlDatabaseHelpers.ts Initializes and wires maxVcores into provisioning, and adds a maxVcores dropdown component.
extensions/mssql/src/constants/locConstants.ts Adds localized backend strings for “Max vCores” and “Select Max vCores”.
extensions/mssql/src/connectionconfig/azureHelpers.ts Uses maxVcores to shape the ARM SKU name/capacity for free-offer DB creation.
extensions/mssql/l10n/bundle.l10n.json Adds the new localization keys for the max vCores strings.

Comment on lines 380 to 391
{renderFormField("databaseName")}
{formState.authenticationType !== AuthenticationType.AzureMFA &&
!serverCreatedWithAuth && (
<>
{renderFormField("userName", {
readOnly: !!formState.userName,
})}
{renderFormField("password")}
{renderFormField("savePassword")}
</>
)}
<div className={classes.fieldContainer}>
<div style={{ flex: 1, width: "100%" }}>
<Label weight="semibold">
{locConstants.azureSqlDatabase.freeLimitBehavior}
</Label>
<RadioGroup
value={localFreeLimitBehavior}
onChange={(_e, data) => {
setLocalFreeLimitBehavior(data.value);
context.formAction({
propertyName: "freeLimitBehavior",
isAction: false,
value: data.value,
});
}}>
<div>
<Radio
value={KnownFreeLimitExhaustionBehavior.AutoPause}
label={locConstants.azureSqlDatabase.autoPauseOption}
/>
<Text
size={200}
style={{
display: "block",
color: "var(--vscode-descriptionForeground)",
marginLeft: "36px",
marginTop: "-4px",
}}>
{locConstants.azureSqlDatabase.autoPauseDescription}
</Text>
</div>
<div>
<Radio
value={KnownFreeLimitExhaustionBehavior.BillOverUsage}
label={locConstants.azureSqlDatabase.continueChargesOption}
/>
<Text
size={200}
style={{
display: "block",
color: "var(--vscode-descriptionForeground)",
marginLeft: "36px",
marginTop: "-4px",
}}>
{locConstants.azureSqlDatabase.continueChargesDescription}
</Text>
</div>
</RadioGroup>
</div>
</div>
{localFreeLimitBehavior === KnownFreeLimitExhaustionBehavior.BillOverUsage && (
<Card
style={{
display: "flex",
flexDirection: "column",
backgroundColor: "var(--colorPaletteYellowBackground1)",
borderLeft: "3px solid var(--colorPaletteYellowForeground1)",
padding: "10px 12px",
gap: "6px",
marginLeft: "2px",
}}>
<div
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: "10px",
}}>
<WarningFilled
style={{
color: "var(--colorStatusWarningForeground1)",
fontSize: "20px",
flexShrink: 0,
}}
/>
<span>{locConstants.azureSqlDatabase.continueChargesWarning}</span>
</div>
<Link
className={classes.linkDiv}
href={AzureSqlDatabaseLinks.freeOffer}>
{locConstants.common.learnMore}
<ArrowRight12Regular style={{ marginTop: "2px" }} />
</Link>
</Card>
)}
{renderFormField("profileName")}
Comment on lines +419 to 428
const skuName = options.maxVcores ? `GP_S_Gen5_${options.maxVcores}` : "GP_S_Gen5";

const freeOfferOptions = options.useFreeLimit
? {
sku: {
name: "GP_S_Gen5",
name: skuName,
tier: "GeneralPurpose",
family: "Gen5",
capacity: 2,
capacity: options.maxVcores ? Number(options.maxVcores) : 2,
},
Comment on lines 174 to 179
)}
</div>
</DeploymentStepCard>
{isDeploymentComplete && (
<DocsLinkCard
title={locConstants.azureSqlDatabase.whatsNext}
links={whatsNextLinks}
/>
)}
</div>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants