From 36fadb357fdb7cd41964f67eb09bc93a979faf07 Mon Sep 17 00:00:00 2001 From: Yashwanth Anantharaju Date: Tue, 14 Apr 2026 23:33:30 +0000 Subject: [PATCH] test: update CommitHash length assertion for SHA-256 support Allow CommitHash to be either 40 chars (SHA-1) or 64 chars (SHA-256). Add hex format validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Test/L0/ConstantGenerationL0.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs index f3c1b8f9eaf..4ff2dbb3093 100644 --- a/src/Test/L0/ConstantGenerationL0.cs +++ b/src/Test/L0/ConstantGenerationL0.cs @@ -24,7 +24,10 @@ public void BuildConstantGenerateSucceed() "osx-arm64" }; - Assert.Equal(40, BuildConstants.Source.CommitHash.Length); + Assert.True( + BuildConstants.Source.CommitHash.Length == 40 || BuildConstants.Source.CommitHash.Length == 64, + "CommitHash should be a 40-char SHA-1 or 64-char SHA-256 hex string"); + Assert.Matches("^[0-9a-f]+$", BuildConstants.Source.CommitHash); Assert.True(validPackageNames.Contains(BuildConstants.RunnerPackage.PackageName), $"PackageName should be one of the following '{string.Join(", ", validPackageNames)}', current PackageName is '{BuildConstants.RunnerPackage.PackageName}'"); } }