Updated Docker package tests, fixed error on opensuse42 (#6783)

This PR addresses minor issues with PS-package docker tests.

Historically rpm package version string was different from other packages, however, this is no longer the case, so updating tests to account for that (to simplify things - removing RPM-version parameter from dockerfiles because it is no longer used).
Configs that use 'linux-x64.tar.gz' (currently only "opensuse42.2") are failing, so fixing that in the script.
This commit is contained in:
Andrew 2018-05-01 10:38:43 -07:00 committed by Travis Plunk
parent 03b1f2bb99
commit 0e8665dfc0
11 changed files with 18 additions and 21 deletions

View file

@ -1,7 +1,6 @@
FROM centos:7
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
@ -17,7 +16,7 @@ ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN yum install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN yum install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN git clone --recursive $GITLOCATION
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"

View file

@ -1,7 +1,6 @@
FROM debian:jessie
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM debian:stretch
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM fedora:26
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
@ -18,7 +17,7 @@ ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN dnf install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN dnf install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN git clone --recursive $GITLOCATION
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"

View file

@ -1,7 +1,6 @@
FROM fedora:27
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git
@ -17,7 +16,7 @@ ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
RUN curl -L -o powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN dnf install -y powershell-$PSVERSIONSTUBRPM-1.rhel.7.x86_64.rpm
RUN curl -L -o powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm $PACKAGELOCATIONSTUB/powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN dnf install -y powershell-$PSVERSIONSTUB-1.rhel.7.x86_64.rpm
RUN git clone --recursive $GITLOCATION
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLISTSTUB -PassThru).FailedCount"

View file

@ -1,7 +1,6 @@
FROM kalilinux/kali-linux-docker:latest
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM opensuse:42.2
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM ubuntu:trusty
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM ubuntu:xenial
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -1,7 +1,6 @@
FROM ubuntu:artful
ARG PSVERSIONSTUB=6.0.2
ARG PSVERSIONSTUBRPM=6.0.2
ARG PACKAGELOCATIONSTUB
ARG TESTLISTSTUB=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
ARG GITLOCATION=https://github.com/PowerShell/PowerShell.git

View file

@ -224,7 +224,7 @@ function Test-PSPackage
[Parameter(Mandatory=$true)]
$PSPackageLocation, # e.g. Azure storage
[string]
$PSVersion = "6.0.2",
$PSVersion = "6.0.2", # e.g. "6.1.0~preview.2"
[string]
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module",
[string]
@ -246,8 +246,6 @@ function Test-PSPackage
Copy-Item -Recurse $SourceFolder $RootFolder
$versionRpmStubName = 'PSVERSIONSTUBRPM'
$versionRpmStubValue = $PSVersion -replace '-','_'
$versionStubName = 'PSVERSIONSTUB'
$versionStubValue = $PSVersion
$testlistStubName = 'TESTLISTSTUB'
@ -264,8 +262,17 @@ function Test-PSPackage
foreach($dir in Get-ChildItem -Path $RootFolder)
{
$buildArgs = @()
$buildArgs += "--build-arg","$versionRpmStubName=$versionRpmStubValue"
$buildArgs += "--build-arg","$versionStubName=$versionStubValue"
if ($dir.Name -eq "opensuse42.2") # special cases that use dash instead of tilda as preview separator, e.g. 'powershell-6.1.0-preview.2-linux-x64.tar.gz'
{
$versionStubDashValue = $PSVersion -replace '~','-'
$buildArgs += "--build-arg","$versionStubName=$versionStubDashValue"
}
else # majority of configurations - they use tilda as preview separator, e.g. 'powershell-6.1.0~preview.2-1.rhel.7.x86_64.rpm'
{
$buildArgs += "--build-arg","$versionStubName=$versionStubValue"
}
$buildArgs += "--build-arg","$testlistStubName=$testlistStubValue"
$buildArgs += "--build-arg","$packageLocationStubName=$packageLocationStubValue"
$buildArgs += "--build-arg","$GitLocationStubName=$GitLocationStubValue"