Skip to content

Conversation

TheOnlyWei
Copy link

Description

Added tests and fixed some commands. See AksArc/AksArc/ChangeLog.md.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
    Got this error:
Import-Module: The member 'FormatsToProcess' in the module manifest is not valid: Cannot find path 'C:\...\azure-powershell\src\AksArc\AksArc\AksArc.Autorest/Az.AksArc.format.ps1xml' because it does not exist.. Verify that a valid value is specified for this field in the 'C:\...\azure-powershell\src\AksArc\AksArc\Az.AksArc.psd1' file.
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@isra-fel
Copy link
Member

isra-fel commented Oct 6, 2025

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@TheOnlyWei TheOnlyWei marked this pull request as ready for review October 7, 2025 00:39
@Copilot Copilot AI review requested due to automatic review settings October 7, 2025 00:39
Copy link
Contributor

@Copilot 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 comprehensive tests for the Az.AksArc PowerShell module and fixes various command parameter set configurations. The changes include creating extensive test coverage for cluster management operations, improving parameter organization, and correcting documentation to ensure proper command functionality.

  • Extensive test suite implementation with live-only tests for cluster and nodepool operations
  • Parameter set restructuring and validation fixes for Update/New/Remove commands
  • Documentation corrections and help file updates for improved clarity

Reviewed Changes

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

Show a summary per file
File Description
src/AksArc/AksArc/help/*.md Updates command help documentation with corrected parameter sets and descriptions
src/AksArc/AksArc/ChangeLog.md Documents fixes and test additions for version 0.2.4
src/AksArc/AksArc/Az.AksArc.psd1 Updates module dependencies and configuration settings
src/AksArc/AksArc.Autorest/test/*.ps1 Adds comprehensive test coverage for all AksArc commands
src/AksArc/AksArc.Autorest/test/utils.ps1 Implements test environment setup with cluster creation

### -KubernetesVersion
The version of Kubernetes in use by the provisioned cluster.
Kubernetes version to upgrade to.
If not provided, the cluster will be upgraded to the latest supported version.
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

The description provides clear information about the default behavior when no version is specified, which is helpful for users understanding the command's functionality.

Suggested change
If not provided, the cluster will be upgraded to the latest supported version.

Copilot uses AI. Check for mistakes.

Comment on lines +86 to +87
apt update
apt install openssh-client
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

Consider adding error handling for the apt commands to gracefully handle cases where the package manager is not available or the commands fail.

Suggested change
apt update
apt install openssh-client
if (-not (Get-Command apt -ErrorAction SilentlyContinue)) {
throw "apt package manager is not available. Please install openssh-client manually."
}
& apt update
if ($LASTEXITCODE -ne 0) {
throw "Failed to run 'apt update'. Please check your network connection and package sources."
}
& apt install -y openssh-client
if ($LASTEXITCODE -ne 0) {
throw "Failed to install openssh-client. Please check your package sources and try again."
}

Copilot uses AI. Check for mistakes.

Comment on lines +28 to +29
# May need to update this periodically to update to available versions.
$k8sVersion = "1.32.6"
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

Hard-coding the Kubernetes version may cause test failures when this version becomes unavailable. Consider dynamically selecting an available version or making this configurable.

Suggested change
# May need to update this periodically to update to available versions.
$k8sVersion = "1.32.6"
# Dynamically select Kubernetes version: use env var if set, else get latest available, else fallback.
if ($env:K8S_VERSION) {
$k8sVersion = $env:K8S_VERSION
} else {
try {
# Attempt to get the latest available Kubernetes version for the location
Import-Module Az.AksArc -ErrorAction SilentlyContinue
$location = $env:LOCATION
if (-not $location) {
# Fallback to a default location if not set
$location = "eastus"
}
$versions = Get-AzAksArcKubernetesVersion -Location $location | Sort-Object -Property OrchestratorVersion -Descending
if ($versions -and $versions[0].OrchestratorVersion) {
$k8sVersion = $versions[0].OrchestratorVersion
} else {
$k8sVersion = "1.32.6" # fallback
}
} catch {
$k8sVersion = "1.32.6" # fallback
}
}

Copilot uses AI. Check for mistakes.

@TheOnlyWei TheOnlyWei force-pushed the improve-aksarc-test-coverage branch from 4127fdd to 108b404 Compare October 7, 2025 01:05
@TheOnlyWei TheOnlyWei force-pushed the improve-aksarc-test-coverage branch from 108b404 to 617e476 Compare October 7, 2025 01:28
@isra-fel isra-fel self-assigned this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants