Skip to content

Commit

Permalink
fix build and test failures (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
alerickson committed Oct 9, 2018
1 parent 8ddf87a commit 00e3fae
Show file tree
Hide file tree
Showing 21 changed files with 798 additions and 882 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ os:
- osx
sudo: required
dist: trusty
osx_image: xcode7.3
osx_image: xcode9.4
env:
- api=v2
- api=v3
Expand All @@ -19,22 +19,17 @@ matrix:
- os: osx
fast_finish: true


addons:
artifacts:
paths: $(ls ./src/out/OneGet.coreclr.zip | tr "\n" ":")


install:
- export PATH=~/.dotnet:$PATH
- pushd tools
- chmod +x download.sh
- chmod +x travis.sh
- ./download.sh
- popd
# Default 2.0.0 Ruby is buggy
# Default bundler version is buggy
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm use 2.2.1; gem uninstall bundler -v1.13.1; fi

script:
- ./tools/travis.sh $api
Expand Down
4 changes: 1 addition & 3 deletions Test/DSCTests/tests/PackageManagement.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# ------------------ PackageManagement Test -----------------------------------

$InternalGallery = "https://dtlgalleryint.cloudapp.net/api/v2/"
$InternalGallery = "https://www.poshtestgallery.com/api/v2/"
$InternalSource = 'OneGetTestSource'


Expand All @@ -33,7 +33,6 @@ Describe "PackageManagement Acceptance Test" -Tags "Feature" {
$gpp | ?{ $_.name -eq "PowerShellGet" } | should not BeNullOrEmpty
}


It "find-packageprovider PowerShellGet" {
$fpp = (Find-PackageProvider -Name "PowerShellGet" -force).name
$fpp -contains "PowerShellGet" | should be $true
Expand All @@ -43,7 +42,6 @@ Describe "PackageManagement Acceptance Test" -Tags "Feature" {
$ipp = (install-PackageProvider -name gistprovider -force -source $InternalSource -Scope CurrentUser).name
$ipp -contains "gistprovider" | should be $true
}


it "Find-package" {
$f = Find-Package -ProviderName NuGet -Name jquery -source Nugettest
Expand Down
77 changes: 35 additions & 42 deletions Test/ModuleTests/tests/find-packageprovider.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# limitations under the License.
#
# ------------------ PackageManagement Test -----------------------------------
$InternalGallery = "https://dtlgalleryint.cloudapp.net/api/v2/"
$InternalGallery = "https://www.poshtestgallery.com/api/v2/"
try {
$WindowsPowerShell = $PSHOME.Trim('\').EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase)
$WindowsPowerShell = $PSHOME.Trim('\').EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase)
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]

Expand All @@ -41,10 +41,10 @@ try {
Describe "find-packageprovider" -Tags "Feature" {
<#make sure the package repository exists
$a=Get-PackageSource | select Location, ProviderName
$found = $false
foreach ($item in $a)
{
{
#name contains "." foo.bar for example for the registered sources internally
if(($item.ProviderName -eq "PowerShellGet") -and ($item.Location -eq $InternalGallery))
{
Expand All @@ -58,87 +58,87 @@ Describe "find-packageprovider" -Tags "Feature" {
Register-PackageSource -Name 'OneGetTestSource' -Location $InternalGallery -ProviderName 'PowerShellGet' -ErrorAction SilentlyContinue
}#>

BeforeAll{
BeforeAll{
Get-PackageProvider -Name NuGet -Force -ForceBootstrap
Get-PackageProvider -Verbose
Register-PackageSource -Name 'OneGetTestSource' -Location $InternalGallery -ProviderName 'PowerShellGet' -ErrorAction SilentlyContinue -force -ForceBootstrap

Register-PackageSource -Name 'OneGetTestSource' -Trusted -Location $InternalGallery -ProviderName 'PowerShellGet' -ErrorAction SilentlyContinue -force -ForceBootstrap
}

It "find-packageprovider without any parameters, Expect succeed" {
$a = (Find-PackageProvider -force).name
$a = (Find-PackageProvider -force).name
$a -contains "TSDProvider" | should be $true
}

It "find-packageprovider -name, Expect succeed" -Skip:(-not $WindowsPowerShell){
$a = (Find-PackageProvider -name nuget -Force).name
$a = (Find-PackageProvider -name nuget -Force).name
$a -contains "GistProvider" | should be $false
}

It "find-packageprovider -name with wildcards, Expect succeed" {
$a = (Find-PackageProvider -name gist*).name
$a = (Find-PackageProvider -name gist*).name
$a -contains "GistProvider" | should be $true
}

It "find-packageprovider -name with wildcards, Expect succeed" {
$a = (Find-PackageProvider -name nu*).name
$a = (Find-PackageProvider -name nu*).name
$a -contains "GistProvider" | should be $false
}

It "find-packageprovider -name array, Expect succeed" {
$names=@("gistprovider", "TSD*")

$a = (Find-PackageProvider -name $names).name
$a = (Find-PackageProvider -name $names).name
$a -contains "GistProvider" | should be $true
$a -contains "TSDProvider" | should be $true
}

}

<# Temporarily skip this test because it times out
It "find-packageprovider -allversions, Expect succeed" {
$a = (Find-PackageProvider -allversions)
$a.Name -contains "TSDProvider" | should be $true
$a.Count -ge 1 | should be $true
}
#>

It "find-packageprovider -name -allversions, Expect succeed" {
$a = (Find-PackageProvider -name TSDProvider -AllVersions).name
$a = (Find-PackageProvider -name TSDProvider -AllVersions).name
$a -contains "TSDProvider" | should be $true

$b = (Find-PackageProvider -name TSDP* -AllVersions).name
$b = (Find-PackageProvider -name TSDP* -AllVersions -WarningAction SilentlyContinue).name
$b.Count -ge $a.Count | should be $false
}

}

It "EXPECTED: success 'find-packageprovider nuget -allVersions'" -Skip:($IsCoreCLR){
$a = find-packageprovider -name nuget -allVersions
$a = find-packageprovider -name nuget -allVersions
$a.Count -ge 4| should be $true

$b = find-packageprovider -allVersions
$b = find-packageprovider -allVersions
$b.Count -gt $a.Count| should be $true
}

It "find-packageprovider -Source, Expect succeed" {
$a = (Find-PackageProvider -source $InternalGallery).name
$a = (Find-PackageProvider -source $InternalGallery).name
$a -contains "TSDProvider" | should be $true
}

It "find-packageprovider -Source -Name, Expect succeed" {
$a = (Find-PackageProvider -name gistprovider -source $InternalGallery).name
$a = (Find-PackageProvider -name gistprovider -source $InternalGallery).name
$a -contains "gistprovider" | should be $true
}

It "find-packageprovider -Name with dependencies, Expect succeed" {
# gistprovider 1.5 depends on tsdprovider 0.2
$a = (Find-PackageProvider -name gistprovider -RequiredVersion 1.5 -source $InternalGallery -IncludeDependencies)
$a = (Find-PackageProvider -name gistprovider -RequiredVersion 1.5 -source $InternalGallery -IncludeDependencies)
$a.Name -contains "gistprovider" | should be $true
$a.Name -contains "tsdprovider" | should be $true
}
It "find-install-packageprovider with PowerShell provider, Expect succeed" {

It "find-install-packageprovider with PowerShell provider, Expect succeed" {
$provider= find-packageprovider -name TSDProvider -MinimumVersion 0.1 -MaximumVersion 0.2 -Source $InternalGallery
$provider | ?{ $_.Version -eq "0.2" } | should not BeNullOrEmpty

$a=install-packageprovider -name TSDProvider -MinimumVersion 0.1 -MaximumVersion 0.2 -Force -Source $InternalGallery
$a=install-packageprovider -name TSDProvider -MinimumVersion 0.1 -MaximumVersion 0.2 -Force -Source $InternalGallery -WarningAction SilentlyContinue
$a.Name | should match "TSDProvider"
$a.Version | should match "0.2"
}
Expand All @@ -156,22 +156,18 @@ Describe "find-packageprovider" -Tags "Feature" {
$b= Get-PackageProvider -ListAvailable
$b | ?{ $_.Version -eq "2.8.5.122" } | should not BeNullOrEmpty
}

}

Describe "Find-Package With FilterOnTag" -Tags "Feature" {

it "EXPECTED: Find a package with FilterOnTag" {

$a=find-package -ProviderName nuget -source $InternalGallery -Name gistprovider -FilterOnTag Provider
$a.name | should match "GistProvider"
}

it "EXPECTED: Find a package with array of FilterOnTags" {

$a=find-package -ProviderName nuget -source $InternalGallery -Name gistprovider -FilterOnTag @('Provider','PackageManagement')
$a.name | should match "GistProvider"

$a.name | should match "GistProvider"
}

it "EXPECTED: Find a package with a bad tag" {
Expand All @@ -198,16 +194,15 @@ Describe "Find-PackageProvider with Versions" -Tags "Feature" {
It "EXPECTED: success 'Find a provider -requiredVersion 3.5'" -Skip:($IsCoreCLR){
(find-packageprovider -name Nuget -RequiredVersion 2.8.5.122).Version.ToString() | should match "2.8.5.122"
}


It "EXPECTED: success 'find a provider with MinimumVersion and MaximumVersion'" -Skip:($IsCoreCLR){
(find-packageprovider -name nuget -MinimumVersion 2.8.5.105 -MaximumVersion 2.8.5.123).Version.ToString() | should match "2.8.5.122"
}

It "EXPECTED: success 'find a provider with MaximumVersion'" -Skip:($IsCoreCLR){
(find-packageprovider -name nuget -MaximumVersion 2.8.5.122).Version -contains "2.8.5.122" | should be $true
}
}
}



Expand All @@ -227,13 +222,11 @@ Describe "find-packageprovider Error Cases" -Tags "Feature" {
$ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
}


It "EXPECTED: returns an error when asking for a provider that does not exist" {
$Error.Clear()
find-packageprovider -name NOT_EXISTS -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
}


It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MinimumVersion" {
$Error.Clear()
Expand Down Expand Up @@ -270,12 +263,12 @@ Describe "find-packageprovider Error Cases" -Tags "Feature" {
find-packageprovider -name "AnyName*" -RequiredVersion 4.5 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "MultipleNamesWithVersionNotAllowed,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
}

It "EXPECTED: returns an error when asking for a provider that has name with wildcard and version" {
$Error.Clear()
find-packageprovider -name "AnyName" -RequiredVersion 4.5 -allVersions -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "AllVersionsCannotBeUsedWithOtherVersionParameters,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
}
}
}


22 changes: 9 additions & 13 deletions Test/ModuleTests/tests/get-package.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,22 @@ Describe "Get-package with version parameter - valid scenarios" -Tags "Feature"
$destination = Join-Path $TestDrive GetPackageTests

It "Get-package supports -AllVersions parameter" -Skip:($IsCoreCLR){

$outputWithAllVersions = (Get-Package -providername Programs,Msi -AllVersions)
$outputWithoutAllVersions = (Get-Package -providername Programs,Msi)
$outputWithAllVersions.count -ge $outputWithoutAllVersions.count | should be $true

}

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 $env:NUGET_API_URL -AllVersions)
($foundPackages = Find-Package -Name "adept.nugetrunner" -Provider $nuget -Source $env:NUGET_API_URL -AllVersions)

foreach ($package in $foundPackages)
{
($package | Install-Package -Destination $destination -Force)
}

$installedPackages = (Get-Package -Name "adept.nugetrunner" -Provider $nuget -Destination $destination -AllVersions)
$installedPackages.Name | should be "adept.nugetrunner"
$installedPackages.Count -eq $foundPackages.Count | should be $true
$installedPackages.Name[0] | should be "adept.nugetrunner"
$installedPackages.Count -eq $foundPackages.Count | should be $true

# check that getting attributes from meta is not case sensitive
$packageToInspect = $installedPackages[0]
Expand All @@ -77,11 +75,11 @@ Describe "Get-package with version parameter - valid scenarios" -Tags "Feature"

# the 2 descriptions should be the same
$firstDescr -eq $secondDescr | should be $true
if (Test-Path $destination\adept.nugetrunner*) {
(Remove-Item -Recurse -Force -Path $destination\adept.nugetrunner*)
}
}

if (Test-Path $destination\adept.nugetrunner*) {
(Remove-Item -Recurse -Force -Path $destination\adept.nugetrunner*)
}
}
}

Describe "Get-package with version parameter - Error scenarios" -Tags "Feature" {
Expand All @@ -90,13 +88,11 @@ Describe "Get-package with version parameter - Error scenarios" -Tags "Feature"
$Error.Clear()
Get-Package -AllVersions -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "AllVersionsCannotBeUsedWithOtherVersionParameters,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage"

}

It "Get-package -RequiredVersion -- Cannot be used with Min/Max version parameters" {
$Error.Clear()
Get-Package -RequiredVersion 1.0 -MinimumVersion 2.0 -MaximumVersion 3.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage"

}
}
15 changes: 6 additions & 9 deletions Test/ModuleTests/tests/get-packageprovider.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Describe "get-packageprovider" -Tags @('BVT', 'DRT'){
It "EXPECTED: Gets The 'Programs' Package Provider" -Skip:($IsCoreCLR){
$x = (get-packageprovider -name "Programs").name | should match "Programs"
}

It "EXPECTED: Gets The 'P*' Package Provider" {
$x = (get-packageprovider -name "P*").name.Contains('PowerShellGet')| should be $true
}

It "EXPECTED: returns an error when asking for a provider that does not exist" -Skip:($IsCoreCLR){
$Error.Clear()
$msg = powershell 'get-packageprovider -name NOT_EXISTS -warningaction:silentlycontinue -ea silentlycontinue; $ERROR[0].FullyQualifiedErrorId'
Expand All @@ -64,7 +64,7 @@ Describe "get-packageprovider" -Tags @('BVT', 'DRT'){
$msg = powershell 'get-packageprovider -name NOT_EXISTS,NOT_EXISTS2 -warningaction:silentlycontinue -ea silentlycontinue; $ERROR[0].FullyQualifiedErrorId'
$msg | should be "UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider"
}

It "EXPECTED: returns an error when asking for multiple providers that do not exist -list" -Skip:($IsCoreCLR){
$Error.Clear()
$msg = powershell 'get-packageprovider -name NOT_EXISTS,NOT_EXISTS2 -ListAvailable -warningaction:silentlycontinue -ea silentlycontinue; $ERROR[0].FullyQualifiedErrorId'
Expand All @@ -73,7 +73,6 @@ Describe "get-packageprovider" -Tags @('BVT', 'DRT'){

It "EXPECTED: returns swidtag conformed object for powershell-based provider" -Skip {
$onegettest = (Get-PackageProvider OneGetTest -ListAvailable | Where-Object {$_.Version.ToString() -eq "9.9.0.0"} | Select -First 1)

$onegettest.Links.Count | should be 3

$found = $false
Expand Down Expand Up @@ -116,15 +115,13 @@ Describe "Get-PackageProvider with list" -Tags @('BVT', 'DRT'){
(get-packageprovider -name "PowerShellGet" -ListAvailable).name | should match "PowerShellGet"

$providers = get-packageprovider -Name OneGetTest, PowerShellGet -ListAvailable

$providers | ?{ $_.name -eq "OneGetTest" } | should not BeNullOrEmpty

$providers | ?{ $_.name -eq "PowerShellGet" } | should not BeNullOrEmpty
$providers | ?{ $_.name -eq "PowerShellGet" } | should not BeNullOrEmpty
}

It "List two providers with wildcard chars" -Skip:($IsCoreCLR){
$providers = get-packageprovider -Name OneGetTest* -ListAvailable

$providers | ?{ $_.name -eq "OneGetTest" } | should not BeNullOrEmpty
#all versions of the OneGetTest provider should be displayed
$providers.Count -ge 3 | should be $true
Expand Down
Loading

0 comments on commit 00e3fae

Please sign in to comment.