Skip to content

Fix case-insensitive Service Fabric durability parsing - #30015

Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 8 commits into
mainfrom
copilot/update-azservicefabricdurability-case-sensitivity
Open

Fix case-insensitive Service Fabric durability parsing#30015
Aditya Pujara (a0x1ab) with Copilot wants to merge 8 commits into
mainfrom
copilot/update-azservicefabricdurability-case-sensitivity

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Tests
️✔️ 18/18

Update-AzServiceFabricDurability failed before ShouldProcess when existing node type or VMSS extension durability values used lowercase casing (for example, silver).

  • Parsing
    • Parse durability values case-insensitively.
    • Return a clear error with valid values for malformed stored properties.
Enum.TryParse(durabilityLevel, ignoreCase: true, out parsedDurabilityLevel)
  • Shared behavior

    • Route Service Fabric node scaling durability parsing through the same helper.
  • Coverage

    • Add regression coverage for lowercase Bronze, Silver, and Gold values from node type and VMSS extension settings.

Copilot AI lite review requested due to automatic review settings August 14, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 14, 2026 17:14
Copilot AI changed the title [WIP] Fix Update-AzServiceFabricDurability for lowercase durability values Fix case-insensitive Service Fabric durability parsing Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file

Comment on lines +29 to +34
private sealed class TestServiceFabricClusterCmdlet : ServiceFabricClusterCmdlet
{
public DurabilityLevel GetNodeTypeDurabilityLevel(string durabilityLevel)
{
return GetDurabilityLevel(durabilityLevel);
}
@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

FAIL (exit )

Test projects: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~TestServiceFabric
PR head ref: copilot/update-azservicefabricdurability-case-sensitivity
PR head sha: 27ee459385dcf04302d32f2d72acde8cc6914574
PR base ref: main

Changed test files run
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/31827071365

Last 80 lines of dotnet test output
(no log captured)

Posted by agent-assist PowerShell live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Live-test review — build failure

The TestFx (Record) live test for the changed test file failed during the build step, before any test could run.

Test project: src/ServiceFabric/ServiceFabric.Test
Changed test file: src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs
Filter: FullyQualifiedName~TestServiceFabric

Build errors (6 total):

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(31,20): error CS0246: The type or namespace name 'DurabilityLevel' could not be found (are you missing a using directive or an assembly reference?)
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(36,20): error CS0246: The type or namespace name 'DurabilityLevel' could not be found (are you missing a using directive or an assembly reference?)
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(89,31): error CS0103: The name 'DurabilityLevel' does not exist in the current context
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(90,31): error CS0103: The name 'DurabilityLevel' does not exist in the current context
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(91,29): error CS0103: The name 'DurabilityLevel' does not exist in the current context
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs(92,86): error CS0246: The type or namespace name 'DurabilityLevel' could not be found (are you missing a using directive or an assembly reference?)

The test file references a DurabilityLevel type/enum that either doesn't exist in the referenced SDK/namespace or is missing a using directive. Since this PR's purpose is "Fix case-insensitive Service Fabric durability parsing," please:

  1. Confirm the correct fully-qualified type/enum for durability level values in the Service Fabric management SDK used by this module (it may need a using Microsoft.Azure.Management.ServiceFabric.Models; or similar, or the enum name may have changed/been renamed).
  2. Update TestServiceFabric.cs (and any production code under src/ServiceFabric/ServiceFabric.PowerShell.Cmdlets it depends on) so the project builds cleanly.
  3. Push the fix so CI/live-test can re-run.

Live-test run: https://github.com/Azure/issue-sentinel/actions/runs/31827071365

Regular CI checks on this PR are currently green, but the live test build failure must be resolved before this can be merged.


Posted by agent-assist (autonomous bug-fix pipeline).

@azure-client-tools-agent azure-client-tools-agent Bot added the azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent label Aug 14, 2026
@azure-client-tools-agent

Copy link
Copy Markdown

Started a Copilot task using claude-sonnet-4.6 for the automated review at #30015 (review): https://github.com/Azure/azure-powershell/tasks/f60b419f-56b3-4c5a-a04d-d09ca16261af


Posted by agent-assist (autonomous bug-fix pipeline).

…Fabric.cs

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file
Suppressed comments (2)

src/ServiceFabric/ServiceFabric/Commands/ServiceFabricClusterCmdlet.cs:134

  • Enum.TryParse will return true for numeric strings (e.g., "1" or "999"), producing enum values that are not actually defined (or bypassing the intended "valid values" check). That means malformed stored durability properties may still slip through instead of throwing the new actionable error. Consider additionally validating that the parsed value is a defined enum name (and trimming input) before returning it.
        protected DurabilityLevel GetDurabilityLevel(string durabilityLevel)
        {
            DurabilityLevel parsedDurabilityLevel;
            if (Enum.TryParse(durabilityLevel, true, out parsedDurabilityLevel))
            {

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs:110

  • The negative-path test only exercises a non-numeric invalid value ("invalid"). Since Enum.TryParse also accepts numeric strings, add coverage for numeric/undefined inputs (e.g., "1" and "999") to ensure malformed stored durability values reliably trigger the actionable error instead of being interpreted as enum integers.
        [Fact]
        public void GetDurabilityLevelReportsInvalidValue()
        {
            var cmdlet = new TestServiceFabricClusterCmdlet();

@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

FAIL (exit 1)

Test projects: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~TestServiceFabric
PR head ref: copilot/update-azservicefabricdurability-case-sensitivity
PR head sha: 9630dadcde8e8d522bc0a795efc7af0a7525dead
PR base ref: main

Changed test files run
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/31831639663

Last 80 lines of dotnet test output
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime: cannot open shared object file: No such file or directory
  See https://aka.ms/msal-net-wam#troubleshooting
  ---> System.DllNotFoundException (0x80131524): Unable to load shared library 'msalruntime' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/msalruntime.so: cannot open shared object file: No such file or directory
 libwebkit2gtk-4.1.so.0: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/libmsalruntime.so: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime: cannot open shared object file: No such file or directory
 
 
 [Common.Authentication]: Received exception SharedTokenCacheCredential authentication failed: Unable to load shared library 'msalruntime' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/msalruntime.so: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/msalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/msalruntime.so: cannot open shared object file: No such file or directory
 libwebkit2gtk-4.1.so.0: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/libmsalruntime.so: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime.so: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/msalruntime: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/msalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.powershell.native/7.4.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/runtime.linux-x64.runtime.native.system.io.ports/8.0.0/runtimes/linux-x64/native/libmsalruntime: cannot open shared object file: No such file or directory
 /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.30/libmsalruntime: cannot open shared object file: No such file or directory
 /home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime: cannot open shared object file: No such file or directory
  See https://aka.ms/msal-net-wam#troubleshooting, while authenticating.
 
 19:09:15 - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [Az.ServiceFabric], Cmdlet = [Get-AzServiceFabricCluster]. Returning default value [False].
 
 ---------------------------------------------------------------
 
 
 ---------------------------------------------------------------
 
 ERROR STREAM
 
 ---------------------------------------------------------------
 
 PowerShell Error Record: The specified module '/home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/artifacts/Debug/Az.Accounts/Az.Accounts.psd1' was not loaded because no valid module file was found in any module directory.
 Exception:System.IO.FileNotFoundException: The specified module '/home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/artifacts/Debug/Az.Accounts/Az.Accounts.psd1' was not loaded because no valid module file was found in any module directory.
 Details:
 Script Stack Trace: at <ScriptBlock>, <No file>: line 1
 : Target: /home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/artifacts/Debug/Az.Accounts/Az.Accounts.psd1
 
 
 ---------------------------------------------------------------
 
 


Results File: /home/runner/work/issue-sentinel/issue-sentinel/test-output/ServiceFabric.Test.trx

Failed!  - Failed:    14, Passed:     6, Skipped:     0, Total:    20, Duration: 9 s - Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (net8.0)

Posted by agent-assist PowerShell live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated Review — Live Test Failed

The dispatched live test (TestFx Record, PowerShell live-test workflow) for
this PR's changed test file failed on head SHA 9630dadcde8e8d522bc0a795efc7af0a7525dead.

Test project: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~TestServiceFabric
Changed test file: src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs
Result: ❌ FAIL (exit code 1)
Run: https://github.com/Azure/issue-sentinel/actions/runs/31831639663

Relevant error from the test output:

/home/runner/.nuget/packages/microsoft.identity.client.nativeinterop/0.20.4/lib/netstandard2.0/libmsalruntime: cannot open shared object file: No such file or directory
    at Microsoft.Azure.Commands.ServiceFabric.Commands.ServiceFabricClusterCmdlet.GetCurrentCluster() in src/ServiceFabric/ServiceFabric/Commands/ServiceFabricClusterCmdlet.cs:line 88
    at Microsoft.Azure.Commands.ServiceFabric.Commands.GetAzureRmServiceFabricCluster.ExecuteCmdlet() in src/ServiceFabric/ServiceFabric/Commands/GetAzureRmServiceFabricClusterResouce.cs:line 54
Script Stack Trace: at WaitForClusterReadyState, .../ScenarioTests/Common.ps1: line 181
at WaitForClusterReadyStateIfRecord, .../ScenarioTests/Common.ps1: line 170
at Test-AddAzureRmServiceFabricNodeType, .../ScenarioTests/TestServiceFabric.ps1: line 120

The failing scenario is Test-AddAzureRmServiceFabricNodeType, which calls
GetAzureRmServiceFabricClusterServiceFabricClusterCmdlet.GetCurrentCluster().
The exception is cannot open shared object file for
libmsalruntime, which surfaces from MSAL's native interop layer during
authentication in the test cmdlet path — this may point at an MSAL/auth
dependency resolution issue triggered by this PR's change, or at a native
library not being restored/copied to the test output directory. Please
investigate why libmsalruntime isn't being found from the test bin output at
runtime for this scenario, verify the fix for AzServiceFabricDurability case
sensitivity doesn't affect MSAL/auth dependency loading, and push a fix (or
confirm this is a pre-existing environment issue and adjust/re-run
accordingly). CI checks on the PR itself are all green; only this live test
step is failing.


Posted by agent-assist (autonomous bug-fix pipeline).

@azure-client-tools-agent

Copy link
Copy Markdown

Started a Copilot task using claude-sonnet-4.6 for the automated review at #30015 (review): https://github.com/Azure/azure-powershell/tasks/e503ffd0-b70a-420d-b68f-75682c761978


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI review requested due to automatic review settings August 19, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file

@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

PASS

Test projects: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~DurabilityLevelTests
PR head ref: copilot/update-azservicefabricdurability-case-sensitivity
PR head sha: a242fc74ce94abe5167cd36132903516ec204c28
PR base ref: main

Changed test files run
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/DurabilityLevelTests.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32275636013

Last 80 lines of dotnet test output
Test run for /home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/src/ServiceFabric/ServiceFabric.Test/bin/Debug/net8.0/Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (.NETCoreApp,Version=v8.0)
A total of 1 test files matched the specified pattern.
Results File: /home/runner/work/issue-sentinel/issue-sentinel/test-output/ServiceFabric.Test.trx

Passed!  - Failed:     0, Passed:     7, Skipped:     0, Total:     7, Duration: 33 ms - Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (net8.0)

Posted by agent-assist PowerShell live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated Review: All checks passing ✅

  • CI: 2/2 checks passed, no failures.
  • Live test (TestFx Record): completed successfully on the changed <Service>.Test files.

No issues found. This PR is ready for human maintainer review/merge.

@wangzelin007

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file
Suppressed comments (1)

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/DurabilityLevelTests.cs:22

  • CI runs are filtered to tests with the xUnit trait "AcceptanceType=CheckIn" (tools/ExecuteCIStep.ps1:333). Adding the trait at the class level ensures these regression tests actually run in CI.
namespace Microsoft.Azure.Commands.ServiceFabric.Test.ScenarioTests
{
    public class DurabilityLevelTests
    {

Comment on lines +15 to +17
using Microsoft.Azure.Commands.ServiceFabric.Commands;
using Microsoft.Azure.Commands.ServiceFabric.Models;
using Xunit;
var exception = Assert.Throws<System.Management.Automation.PSInvalidOperationException>(
() => cmdlet.GetNodeTypeDurabilityLevel("invalid"));

Assert.Contains("Valid values are Bronze, Silver, and Gold.", exception.Message);
@wangzelin007

Copy link
Copy Markdown
Member

@azure-client-tools-agent please fix the ci error.

@azure-client-tools-agent

Copy link
Copy Markdown

Started a Copilot task using claude-sonnet-4.6 for human feedback at #30015 (comment): https://github.com/Azure/azure-powershell/tasks/3b80875e-8d7b-415d-bd66-65c56b6d58d5

…sage

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file
Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

src/ServiceFabric/ServiceFabric/Commands/ServiceFabricClusterCmdlet.cs:136

  • GetDurabilityLevel(string) calls Trim() multiple times and formats the error message with the untrimmed input. This makes the method harder to read and can produce confusing errors for inputs that contain leading/trailing whitespace. Consider trimming once and reusing the trimmed value for both parsing and error reporting.
            DurabilityLevel parsedDurabilityLevel;
            if (!int.TryParse(durabilityLevel?.Trim(), out _) &&
                Enum.TryParse(durabilityLevel?.Trim(), true, out parsedDurabilityLevel) &&
                Enum.IsDefined(typeof(DurabilityLevel), parsedDurabilityLevel))
            {

src/ServiceFabric/ServiceFabric/ChangeLog.md:23

  • The second changelog entry describes behavior that is part of the same fix, but it doesn't include the issue reference. Adding the same issue link keeps the release notes consistent and makes it easier to trace back to the report.
* Fixed `Update-AzServiceFabricDurability` to accept durability values stored with lowercase casing.
    - Fixed issue [#30014]
* Fixed `Update-AzServiceFabricDurability` and related cmdlets to reject numeric strings (e.g., `'1'`, `'999'`) as durability level values and report a clear error instead.

Comment on lines +81 to +87
var exception = Assert.Throws<System.Management.Automation.PSInvalidOperationException>(
() => cmdlet.GetNodeTypeDurabilityLevel("invalid"));

Assert.Equal(
string.Format("Cannot parse durability level {0}. Valid values are Bronze, Silver, and Gold.", "invalid"),
exception.Message);
}
@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

PASS

Test projects: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~DurabilityLevelTests
PR head ref: copilot/update-azservicefabricdurability-case-sensitivity
PR head sha: aba99eb77e91e51c06ca1ff5714d88bf6b72db4b
PR base ref: main

Changed test files run
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/DurabilityLevelTests.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32804859615

Last 80 lines of dotnet test output
Test run for /home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/src/ServiceFabric/ServiceFabric.Test/bin/Debug/net8.0/Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (.NETCoreApp,Version=v8.0)
A total of 1 test files matched the specified pattern.
Results File: /home/runner/work/issue-sentinel/issue-sentinel/test-output/ServiceFabric.Test.trx

Passed!  - Failed:     0, Passed:     7, Skipped:     0, Total:     7, Duration: 37 ms - Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (net8.0)

Posted by agent-assist PowerShell live-test workflow.

Copilot AI review requested due to automatic review settings August 25, 2026 03:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/ServiceFabric/ServiceFabric/Properties/Resources.Designer.cs: Generated file
Suppressed comments (1)

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/DurabilityLevelTests.cs:86

  • This test asserts the full English exception message verbatim, which is brittle (resource text/punctuation changes will break the test without changing behavior). Consider asserting on key substrings instead (or on the resource string if it can be referenced) to keep the regression coverage focused on behavior.
            Assert.Equal(
                string.Format("Cannot parse durability level {0}. Valid values are Bronze, Silver, and Gold.", "invalid"),
                exception.Message);

Comment on lines +23 to 24
* Fixed `Update-AzServiceFabricDurability` and related cmdlets to reject numeric strings (e.g., `'1'`, `'999'`) as durability level values and report a clear error instead.

@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

PASS

Test projects: src/ServiceFabric/ServiceFabric.Test
Filter: FullyQualifiedName~DurabilityLevelTests
PR head ref: copilot/update-azservicefabricdurability-case-sensitivity
PR head sha: f258d74070c4829c012184fa4dd44c21ad24bea7
PR base ref: main

Changed test files run
src/ServiceFabric/ServiceFabric.Test/ScenarioTests/DurabilityLevelTests.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32806527976

Last 80 lines of dotnet test output
Test run for /home/runner/work/issue-sentinel/issue-sentinel/azure-powershell/src/ServiceFabric/ServiceFabric.Test/bin/Debug/net8.0/Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (.NETCoreApp,Version=v8.0)
A total of 1 test files matched the specified pattern.
Results File: /home/runner/work/issue-sentinel/issue-sentinel/test-output/ServiceFabric.Test.trx

Passed!  - Failed:     0, Passed:     7, Skipped:     0, Total:     7, Duration: 34 ms - Microsoft.Azure.PowerShell.Cmdlets.ServiceFabric.Test.dll (net8.0)

Posted by agent-assist PowerShell live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agent Assist review — pass

All checks are green and the change is well-scoped.

CI

All 12 checks passed (0 failed, 0 pending).

Test validation

  • Live test: Passed.
  • Regression coverage: Not applicable to the changed files.

Summary

GetDurabilityLevel(string) now trims and case-insensitively parses the durability value (previously Enum.Parse was case-sensitive, so lowercase values like silver threw before ShouldProcess), while explicitly rejecting numeric strings with a clear error message. UpdateAzureRmServiceFabricNodeBase was updated to reuse the fixed helper instead of duplicating the case-sensitive Enum.Parse call. A new unit test (DurabilityLevelTests) covers the node-type and VMSS-extension code paths for all three valid values plus invalid/numeric input, and ChangeLog.md documents both fixes under the correct release header.

Risk assessment

11/100 · Low · High confidence

Owning-squad review is recommended for servicefabric before merge. Main signals: failure-handling behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Az.ServiceFabric] Update-AzServiceFabricDurability fails when existing durability value is lowercase

4 participants