This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove test credentials from all test (#659)
- Loading branch information
1 parent
b44dcfe
commit d59b2a8
Showing
5 changed files
with
234 additions
and
642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -582,59 +582,3 @@ Describe PowerShell.PSGet.FindModuleTests.P2 -Tags 'P2', 'OuterLoop' { | |
$i = $i + 1 | ||
} | ||
} | ||
|
||
|
||
Describe "Azure Artifacts Credential Provider Integration" -Tags 'BVT' { | ||
|
||
BeforeAll { | ||
$repoName = "OneGetTestPrivateFeed" | ||
# This pkg source is an Azure DevOps private feed | ||
$testLocation = "https://pkgs.dev.azure.com/onegettest/_packaging/onegettest/nuget/v2"; | ||
$username = "[email protected]" | ||
$PAT = "qo2xvzdnfi2mlcq3eq2jkoxup576kt4gnngcicqhup6bbix6sila" | ||
# see https://github.com/Microsoft/artifacts-credprovider#environment-variables for more info on env vars for the credential provider | ||
# The line below is purely for local testing. Make sure to update env vars in AppVeyor and Travis CI as necessary. | ||
$VSS_NUGET_EXTERNAL_FEED_ENDPOINTS = "{'endpointCredentials': [{'endpoint':'$testLocation', 'username':'$username', 'password':'$PAT'}]}" | ||
[System.Environment]::SetEnvironmentVariable("VSS_NUGET_EXTERNAL_FEED_ENDPOINTS", $VSS_NUGET_EXTERNAL_FEED_ENDPOINTS, [System.EnvironmentVariableTarget]::Process) | ||
|
||
|
||
# Figure out if Visual Studio is installed, and if it is, we'll use the credential provider that's installed there for the first test | ||
$VSinstalledCredProvider = $false; | ||
$programFiles = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ProgramFilesX86); | ||
$vswhereExePath = $programFiles + "\\Microsoft Visual Studio\\Installer\\vswhere.exe"; | ||
$fullVSwhereExePath = [System.Environment]::ExpandEnvironmentVariables($vswhereExePath); | ||
# If the env variable exists, check to see if the path itself exists | ||
if (Test-Path ($fullVSwhereExePath)) { | ||
$VSinstalledCredProvider = $true; | ||
} | ||
} | ||
|
||
AfterAll { | ||
UnRegister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | ||
} | ||
|
||
it "Register-PackageSource using Visual Studio installed credential provider" -Skip:(!$VSinstalledCredProvider) { | ||
Register-PSRepository $repoName -SourceLocation $testLocation | ||
|
||
(Get-PSRepository -Name $repoName).Name | should match $repoName | ||
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation | ||
|
||
Unregister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | ||
} | ||
|
||
it "Register-PackageSource using credential provider" -Skip:(!$IsWindows) { | ||
# Make sure the credential provider is installed (works for Windows, Linux, and Mac) | ||
# If the credential provider is already installed, will receive the message: "The netcore Credential Provider is already in C:\Users\<alias>\.nuget\plugins" | ||
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1')) | ||
|
||
Register-PSRepository $repoName -SourceLocation $testLocation | ||
|
||
(Get-PSRepository -Name $repoName).Name | should match $repoName | ||
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation | ||
} | ||
|
||
it "Find-Package using credential provider" -Skip:(!$IsWindows) { | ||
$pkg = Find-Module * -Repository $repoName | ||
$pkg.Count | should -BeGreaterThan 0 | ||
} | ||
} |
Oops, something went wrong.