Skip to content

Commit 19be08e

Browse files
author
anamnavi
committed
address feedback - add comment and use InformationVariable in test
1 parent 66394d3 commit 19be08e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/code/ContainerRegistryServerAPICalls.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ internal string GetContainerRegistryAccessToken(bool needCatalogAccess, bool isP
398398
}
399399
else
400400
{
401+
// A container registry repository is determined to be unauthenticated if it allows anonymous pull access. However, push operations always require authentication.
401402
bool isRepositoryUnauthenticated = isPushOperation ? false : IsContainerRegistryUnauthenticated(Repository.Uri.ToString(), needCatalogAccess, out errRecord, out accessToken);
402403
_cmdletPassedIn.WriteInformation($"Value of isRepositoryUnauthenticated: {isRepositoryUnauthenticated}", new string[] { "PSRGContainerRegistryUnauthenticatedCheck" });
403404

test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Describe "Test Publish-PSResource" -tags 'CI' {
350350
$version = "15.0.0"
351351
New-ModuleManifest -Path (Join-Path -Path $script:PublishModuleBase -ChildPath "$script:PublishModuleName.psd1") -ModuleVersion $version -Description "$script:PublishModuleName module"
352352

353-
$infoRecord = & { Publish-PSResource -Path $script:PublishModuleBase -Repository $ACRRepoName 6>&1 } | Where-Object { $_ -is [System.Management.Automation.InformationRecord] }
353+
Publish-PSResource -Path $script:PublishModuleBase -Repository $ACRRepoName -InformationVariable RegistryUnauthenticated
354354

355355
$results = Find-PSResource -Name $script:PublishModuleName -Repository $ACRRepoName
356356
$results | Should -Not -BeNullOrEmpty
@@ -359,9 +359,9 @@ Describe "Test Publish-PSResource" -tags 'CI' {
359359

360360
if ($usingAzAuth)
361361
{
362-
$infoRecord | Should -Not -BeNullOrEmpty
363-
$infoRecord[0].Tags | Should -Be "PSRGContainerRegistryUnauthenticatedCheck"
364-
$infoRecord[0].MessageData | Should -Be "Value of isRepositoryUnauthenticated: False"
362+
$RegistryUnauthenticated | Should -Not -BeNullOrEmpty
363+
$RegistryUnauthenticated[0].Tags | Should -Be "PSRGContainerRegistryUnauthenticatedCheck"
364+
$RegistryUnauthenticated[0].MessageData | Should -Be "Value of isRepositoryUnauthenticated: False"
365365
}
366366
}
367367

0 commit comments

Comments
 (0)