Permalink
Browse files

Changes for NuGetProvider NuGet v3 support (#326)

Changes for NuGetProvider NuGet v3 support
  • Loading branch information...
brywang-msft committed Dec 14, 2017
1 parent cc2b463 commit 6a62786968d2b3b29176054f9fb5584615899a4f
View
@@ -10,6 +10,9 @@ os:
sudo: required
dist: trusty
osx_image: xcode7.3
env:
- api=v2
- api=v3
matrix:
allow_failures:
@@ -34,7 +37,7 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm use 2.2.1; gem uninstall bundler -v1.13.1; fi
script:
- ./tools/travis.sh
- ./tools/travis.sh $api
@@ -65,7 +65,7 @@ configuration Sample_InstallPester
Ensure = "Present"
Name = "Mynuget"
ProviderName= "Nuget"
SourceLocation = "http://nuget.org/api/v2/"
SourceLocation = "$env:NUGET_API_URL"
InstallationPolicy ="Trusted"
}
@@ -167,10 +167,16 @@ function SetupPackageManagementTest
throw "Failed to find module base from GitCommitId $($PSVersionTable.GitCommitId)"
}
$script:PSModuleBase = $moduleBaseCandidate
$script:PSModuleBaseAlt = ((Resolve-Path -Path $moduleBaseCandidate\..\..\Modules).Path)
if (-not (Test-Path -Path $script:PSModuleBaseAlt)) {
$script:PSModuleBaseAlt = $script:PSModuleBase
}
Write-Verbose -Message "Path $script:PSModuleBase" -Verbose
Write-Verbose -Message "Alt Path $script:PSModuleBaseAlt" -Verbose
} else {
Write-Verbose -Message "Setting up test as Full CLR" -Verbose
$script:PSModuleBase = "$env:ProgramFiles\windowspowershell\modules"
$script:PSModuleBaseAlt = $script:PSModuleBase
}
UnRegisterAllSource
@@ -12,10 +12,8 @@
$CurrentDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$CurrentDirectory\..\OneGetTestHelper.ps1"
Import-Module "$CurrentDirectory\..\TestUtility.psm1" -Force
if (-not (IsAdmin))
{
throw "This test script requires to be run from an elevated PowerShell session. Launch an elevated PowerShell session and try again."
@@ -40,7 +38,7 @@ Describe -Name "PackageManagement Set-TargetResource Basic Test" -Tags "BVT" {
#Remove all left over files if exists
Remove-Item "$script:PSModuleBase\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$script:PSModuleBase\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$script:PSModuleBaseAlt\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
}
AfterEach {
@@ -50,7 +48,7 @@ Describe -Name "PackageManagement Set-TargetResource Basic Test" -Tags "BVT" {
AfterAll {
# Remove all left over files if exists
Remove-Item "$script:PSModuleBase\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$script:PSModuleBase\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$script:PSModuleBaseAlt\MyTestModule" -Recurse -Force -ErrorAction SilentlyContinue
RestoreRepository $script:OriginalRepository
}
@@ -66,7 +64,7 @@ Describe -Name "PackageManagement Set-TargetResource Basic Test" -Tags "BVT" {
MSFT_PackageManagement\Set-TargetResource -name "MyTestModule" -Source $LocalRepository -Ensure Present -Verbose
# Validate the module is installed
Test-Path -Path "$script:PSModuleBase\MyTestModule\3.2.1" | should be $true
((Test-Path -Path "$script:PSModuleBase\MyTestModule\3.2.1") -or (Test-Path -Path "$script:PSModuleBaseAlt\MyTestModule\3.2.1")) | should be $true
# Uninstalling the module
MSFT_PackageManagement\Set-TargetResource -name "MyTestModule" -Source $LocalRepository -Ensure Absent -Verbose
@@ -75,7 +73,7 @@ Describe -Name "PackageManagement Set-TargetResource Basic Test" -Tags "BVT" {
$result = MSFT_PackageManagement\Test-TargetResource -name "MyTestModule" -Source $LocalRepository -Ensure Absent
$result| should be $true
Test-Path -Path "$script:PSModuleBase\MyTestModule\3.2.1" | should be $false
((Test-Path -Path "$script:PSModuleBase\MyTestModule\3.2.1") -or (Test-Path -Path "$script:PSModuleBaseAlt\MyTestModule\3.2.1")) | should be $false
}
It "Set, Test-TargetResource with Trusted Source, No respository Specified: Check Installed" {
@@ -87,7 +85,7 @@ Describe -Name "PackageManagement Set-TargetResource Basic Test" -Tags "BVT" {
MSFT_PackageManagement\Set-TargetResource -name "MyTestModule" -Ensure Present -Verbose
# Validate the module is installed
Test-Path -Path "$PSModuleBase\MyTestModule\3.2.1" | should be $true
((Test-Path -Path "$PSModuleBase\MyTestModule\3.2.1") -or (Test-Path -Path "$script:PSModuleBaseAlt\MyTestModule\3.2.1")) | should be $true
# Uninstalling the module
MSFT_PackageManagement\Set-TargetResource -name "MyTestModule" -Ensure Absent -Verbose
@@ -50,7 +50,7 @@ configuration Sample_Install_Package_Using_NuGet
Ensure = "Present"
Name = "MyNuget"
ProviderName= "Nuget"
SourceLocation = "http://nuget.org/api/v2/"
SourceLocation = "$env:NUGET_API_URL"
InstallationPolicy ="Trusted"
}
@@ -105,7 +105,7 @@ Describe "find-packageprovider" -Tags "Feature" {
$a -contains "TSDProvider" | should be $true
$b = (Find-PackageProvider -name TSDP* -AllVersions).name
$b.Count -ge $a.Count | should be $true
$b.Count -ge $a.Count | should be $false
}
@@ -13,7 +13,6 @@
#
# ------------------ PackageManagement Test ----------------------------------------------
$nuget = "nuget"
$source = "http://www.nuget.org/api/v2/"
# ------------------------------------------------------------------------------
@@ -57,7 +56,7 @@ Describe "Get-package with version parameter - valid scenarios" -Tags "Feature"
}
It "E2E: Get-package supports -AllVersions parameter for a specific package - with multiple versions from Nuget" {
($foundPackages = Find-Package -Name "adept.nugetrunner" -Provider $nuget -Source $source -AllVersions)
($foundPackages = Find-Package -Name "adept.nugetrunner" -Provider $nuget -Source $env:NUGET_API_URL -AllVersions)
foreach ($package in $foundPackages)
{
@@ -39,8 +39,8 @@ try {
$LinuxProgramFilesFolder="/usr/local/share/PackageManagement/NuGet/Packages"
$source = "http://www.nuget.org/api/v2/"
$sourceWithoutSlash = "http://www.nuget.org/api/v2"
$source = $env:NUGET_API_URL
$sourceWithoutSlash = $env:NUGET_API_URL_ALTERNATE
$fwlink = "http://go.microsoft.com/fwlink/?LinkID=623861&clcid=0x409"
$longName = "THISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERSTHISISOVER255CHARACTERS";
$workingMaximumVersions = {"2.0", "2.5", "3.0"};
@@ -124,7 +124,7 @@ Describe "Event Test" -Tags "Feature" {
it "EXPECTED: install a package should raise event" -Skip:(-not $WindowsPowerShell) {
Install-Package EntityFramework -ProviderName nuget -requiredVersion 6.1.3 -Destination $TestDrive -source 'http://www.nuget.org/api/v2/' -force
Install-Package EntityFramework -ProviderName nuget -requiredVersion 6.1.3 -Destination $TestDrive -source $source -force
$retryCount= 5
while($retryCount -gt 0)
@@ -155,7 +155,7 @@ Describe "Event Test" -Tags "Feature" {
$event.Message | Should Match "Package=EntityFramework"
$event.Message | Should Match "Version=6.1.3"
$event.Message | Should Match "Provider=NuGet"
$event.Message | Should Match "Source=http://www.nuget.org/api/v2/"
$event.Message | Should Match "Source=$source"
#$event.Message | Should Match ([regex]::Escape("DestinationPath=$env:tmp"))
}
@@ -216,7 +216,7 @@ Describe "Event Test" -Tags "Feature" {
it "EXPECTED: uninstall a package should raise event" -Skip:(-not $WindowsPowerShell) {
Install-Package EntityFramework -ProviderName nuget -requiredVersion 6.1.3 -Destination $TestDrive -source 'http://www.nuget.org/api/v2/' -force
Install-Package EntityFramework -ProviderName nuget -requiredVersion 6.1.3 -Destination $TestDrive -source $source -force
UnInstall-Package EntityFramework -ProviderName nuget -Destination $TestDrive
$retryCount= 5
@@ -262,7 +262,7 @@ Describe "Event Test" -Tags "Feature" {
it "EXPECTED: save a package should raise event" -Skip:(-not $WindowsPowerShell) {
save-Package EntityFramework -ProviderName nuget -path $TestDrive -requiredVersion 6.1.3 -source 'http://www.nuget.org/api/v2/' -force
save-Package EntityFramework -ProviderName nuget -path $TestDrive -requiredVersion 6.1.3 -source $source -force
$retryCount= 5
while($retryCount -gt 0)
@@ -294,7 +294,7 @@ Describe "Event Test" -Tags "Feature" {
$event.Message | Should Match "Package=EntityFramework"
$event.Message | Should Match "Version=6.1.3"
$event.Message | Should Match "Provider=NuGet"
$event.Message | Should Match "Source=http://www.nuget.org/api/v2/"
$event.Message | Should Match "Source=$source"
# $event.Message | should Match ([regex]::Escape("DestinationPath=$env:tmp"))
}
else
@@ -321,8 +321,10 @@ Describe "Find-Package" -Tags @('Feature','SLOW'){
$zlib.Dependencies.Count | should be 1
$zlib.Meta.Attributes["packageSize"] | should match "7995520"
[long]$zlib.Meta.Attributes["versionDownloadCount"] -ge 7640 | should be $true
if ($env:NUGET_API_VERSION -eq 'v2')
{
[long]$zlib.Meta.Attributes["versionDownloadCount"] -ge 7640 | should be $true
}
$zlib.Meta.Attributes["requireLicenseAcceptance"] | should match "False"
$zlib.TagId | should match "grpc.dependencies.zlib#1.2.8.10"
@@ -340,16 +342,16 @@ Describe "Find-Package" -Tags @('Feature','SLOW'){
}
It "EXPECTED: Finds 100 packages should throw error" {
$packages = Find-Package -Provider $nuget -Source $source | Select -First 100
$packages = Get-Content "$PSScriptRoot\..\..\Packages_100.txt"
{ Find-Package -ProviderName $nuget -Source $source -Name $packages.Name -ErrorAction Stop } | should throw
{ Find-Package -ProviderName $nuget -Source $source -Name $packages -ErrorAction Stop } | should throw
}
It "EXPECTED: Finds 128 packages should throw error" {
$packages = Find-Package -Provider $nuget -Source $source | Select -First 127
$packages = Get-Content "$PSScriptRoot\..\..\Packages_128.txt"
{Find-Package -ProviderName $nuget -Source $source -Name $packages.Name -ErrorAction Stop} | should throw
{Find-Package -ProviderName $nuget -Source $source -Name $packages -ErrorAction Stop} | should throw
}
It "EXPECTED: Finds 'TestPackage' Package using fwlink" {
@@ -452,9 +454,16 @@ Describe "Find-Package" -Tags @('Feature','SLOW'){
# Uncomment this once publish the new version of nuget
$awssdk = Find-Package -Name "awssdk" -Provider $nuget -source $source -RequiredVersion 2.3.53
[long]$awssdk.Meta.Attributes["downloadCount"] -ge 1023357 | should be $true
$awssdk.Meta.Attributes["updated"] | should match "2015-12-15T17:46:22Z"
$awssdk.TagId | should match "AWSSDK#2.3.53.0"
# Currently v3 doesn't get this metadata
if ($env:NUGET_API_VERSION -eq 'v2')
{
[long]$awssdk.Meta.Attributes["downloadCount"] -ge 1023357 | should be $true
$awssdk.Meta.Attributes["updated"] | should match "2015-12-15T17:46:22Z"
$awssdk.TagId | should match "AWSSDK#2.3.53.0"
} else {
# For v3, the tag is going to be normalized
$awssdk.TagId | should match "AWSSDK#2.3.53"
}
}
It "EXPECTED: Finds A Combination Of Packages With Various Versions" {
@@ -820,7 +829,7 @@ Describe "save-package with Whatif" -Tags "Feature" {
}
It "install-package -name nuget with whatif where package has a dependencies, Expect succeed" {
{Save-Package -name zlib -source https://www.nuget.org/api/v2/ `
{Save-Package -name zlib -source $source `
-ProviderName NuGet -Path $tempDir -whatif} | should not throw
}
}
@@ -867,7 +876,7 @@ Describe "install-package with Whatif" -Tags "Feature" {
}
It "install-package -name nuget with whatif where package has a dependencies, Expect succeed" {
{install-Package -name grpc.dependencies.zlib -source https://www.nuget.org/api/v2/ `
{install-Package -name grpc.dependencies.zlib -source $source `
-ProviderName NuGet -destination $installationPath -whatif} | should not throw
}
}
View
@@ -0,0 +1,100 @@
MediaProB2BService
QT2K.SupportLibraries.EnumerationLibrary.NET4
NBM
anic.JChemUtils.CompoundRegistration
Microsoft.VisualStudio.TextTemplating.Interfaces.10.0
HEBI.C
Plato.Cache
Fody
Heimdall
Nancy.Linker
murmurhash3js.TypeScript.DefinitelyTyped
gulp-cached.TypeScript.DefinitelyTyped
Chaos.WebApi
ThirtyNineEighty.BinarySerializer
angular-applicationinsights
ErrorUnit.Injector_SimpleInjector
SAPP
SimpleJsonApi
AzureTable.LiteClient
Microsoft.GVFS.GvFlt
poco_wp8_1
Narato.Correlations
SFA.Roatp.Api.Client
RestSharp.Rpc
jQuery.Color
ASP.NET-StatusBoard.AspNetCore
cloudscribe.SimpleContent.Storage.EFCore.pgsql
xunit.console
LazyValue
GitHub
UmbracoEx
NLog.Interface
DevLib.DirectoryServices
libtorrent4tsunami
GoldenEye.Backend.Core
Selenium.WebDriver.Extensions
ExcelReport
EntityFramework.CommonTools
Menulab.Discussions
guard_claws
sweetalert.TypeScript.DefinitelyTyped
Desafio131LuisBeltran
hiqpdf.free
Rfc822
FunScript.TypeScript.Binding.knockout_validation
gitlink
Toolkit.Elections
Test123456789
SlimerJS
NetFusion.Common
Synology.NET
Moon.DAL.EF
XamlConverters
zeroc.freeze.v120
LoveSeat
SD.IOC.UnityProvider
Retyped.rebass
Nett.StrongNamed
Dapper.Entity
BryanVam.Data.Entity
umbraco.TypeScript.DefinitelyTyped
Tabster.Data
react-scrollbar.TypeScript.DefinitelyTyped
twitter.bootstrap.mvc4.sample
Carbon.Geometry
SMA.Tools4.Xpo.Server.Core.Service
Takenet.Elephant.Sql.PostgreSql
Paradigm.Core.Assemblies
Retyped.node-waves
Microsoft.AspNet.Mvc.Core
Enfold.Javascript
BGreyling.Utilities.Patterns
php-7.0.v140
OctoPack.MigratorDotnet
SeModFx-Stable
com.qiny.donetbar
FastSmsSdk
AntiXsNewSchema
eXpandJobShedulerJobs
TheDylanKit.Policies
Atlantis.Net.Irc
Roccat-Talk
Gear.EntityFramework
Cake.Gem
Async.EventWay.Infrastructure.CosmosDb
FileHelpers-Stable
Retyped.promise.prototype.finally
DbEntry
ASPConf
Jim.DependencyResolver
StopWatch
AspNetWebApi.ApiGee
Hdq.RestBus.Core
Slycoder.Portable.Networking
RaisingStudio.Modules.LightningDB
FluentHttpRequest
Xamarin.Facebook.iOS
Equals.Fody
MyLib1
HoveyTech.Data.EfCore.Autofac
Oops, something went wrong.

0 comments on commit 6a62786

Please sign in to comment.