diff --git a/docker/tests/README.md b/docker/tests/README.md deleted file mode 100644 index 716a7d6f62..0000000000 --- a/docker/tests/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Docker tests - -## Windows and Linux containers - -The tests must be run separately on the Windows and Linux docker daemons. You can use the Linux docker daemon on Windows, but that will only test Linux containers not Windows Containers. - -## To building and basic behavior of the containers - -```PowerShell -Invoke-Pester -``` - -Note: be sure to do this using both the Windows and Linux docker daemon. - -## To test the productions containers - -```PowerShell -Invoke-Pester -Tag Behavior -``` - -## To test only building the containers - -```PowerShell -Invoke-Pester -Tag Build -``` diff --git a/docker/tests/Templates/centos7/Dockerfile b/docker/tests/Templates/centos7/Dockerfile deleted file mode 100644 index dddf243944..0000000000 --- a/docker/tests/Templates/centos7/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM centos:7 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN yum install -y \ - curl \ - glibc-locale-source \ - git - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME \ - && yum install -y $PACKAGENAME -RUN $TESTDOWNLOADCOMMAND -RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/debian.9/Dockerfile b/docker/tests/Templates/debian.9/Dockerfile deleted file mode 100644 index f2de0f8d61..0000000000 --- a/docker/tests/Templates/debian.9/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM debian:stretch - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - curl \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME -RUN dpkg -i $PACKAGENAME || : -RUN apt-get install -y -f --no-install-recommends -RUN $TESTDOWNLOADCOMMAND -RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fedora28/Dockerfile b/docker/tests/Templates/fedora28/Dockerfile deleted file mode 100644 index 9c9f958f54..0000000000 --- a/docker/tests/Templates/fedora28/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM fedora:28 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN dnf install -y \ - curl \ - glibc-locale-source \ - git \ - compat-openssl10 \ - && dnf upgrade-minimal -y --security \ - && dnf clean all - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME -RUN dnf install -y $PACKAGENAME -RUN $TESTDOWNLOADCOMMAND -RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-centos7/Dockerfile b/docker/tests/Templates/fxdependent-centos7/Dockerfile deleted file mode 100644 index 10cde0cd12..0000000000 --- a/docker/tests/Templates/fxdependent-centos7/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM centos:7 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN yum install -y \ - glibc-locale-source \ - git - -# Install dotnet-runtime -RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm -RUN yum install -y \ - dotnet-runtime-2.1 - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell -RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-debian.9/Dockerfile b/docker/tests/Templates/fxdependent-debian.9/Dockerfile deleted file mode 100644 index 2d7beff913..0000000000 --- a/docker/tests/Templates/fxdependent-debian.9/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM microsoft/dotnet:2.1.7-runtime-stretch-slim - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell -RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-dotnetsdk-latest/Dockerfile b/docker/tests/Templates/fxdependent-dotnetsdk-latest/Dockerfile deleted file mode 100644 index cf56e4ec07..0000000000 --- a/docker/tests/Templates/fxdependent-dotnetsdk-latest/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM microsoft/dotnet:3.0.100-preview-sdk - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell \ - && tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-fedora28/Dockerfile b/docker/tests/Templates/fxdependent-fedora28/Dockerfile deleted file mode 100644 index 6acb745244..0000000000 --- a/docker/tests/Templates/fxdependent-fedora28/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM fedora:28 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN dnf install -y \ - glibc-locale-source \ - git \ - compat-openssl10 \ - && dnf upgrade-minimal -y --security \ - && dnf clean all - -# Install dotnet-runtime -RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -ADD https://packages.microsoft.com/config/fedora/27/prod.repo . -RUN mv prod.repo /etc/yum.repos.d/microsoft-prod.repo -RUN dnf install -y \ - dotnet-runtime-2.1 \ - && dnf upgrade-minimal -y --security \ - && dnf clean all - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell \ - && tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-opensuse42.3/Dockerfile b/docker/tests/Templates/fxdependent-opensuse42.3/Dockerfile deleted file mode 100644 index 74b4bc9825..0000000000 --- a/docker/tests/Templates/fxdependent-opensuse42.3/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -FROM opensuse:42.3 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN zypper --non-interactive update --skip-interactive \ - && zypper --non-interactive install \ - glibc-locale \ - glibc-i18ndata \ - tar \ - libunwind \ - libicu \ - openssl \ - git - -# Install dotnet-runtime -ADD https://packages.microsoft.com/keys/microsoft.asc . -RUN rpmkeys --import microsoft.asc -ADD https://packages.microsoft.com/config/opensuse/42.2/prod.repo . -RUN mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo -RUN zypper --non-interactive update --skip-interactive \ - && zypper --non-interactive install \ - dotnet-runtime-2.1 - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell -RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-ubuntu16.04/Dockerfile b/docker/tests/Templates/fxdependent-ubuntu16.04/Dockerfile deleted file mode 100644 index aa976ddb19..0000000000 --- a/docker/tests/Templates/fxdependent-ubuntu16.04/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM ubuntu:xenial - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Install dotnet-runtime -ADD https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb . -RUN dpkg -i packages-microsoft-prod.deb -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - dotnet-runtime-2.1 \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell \ - && tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/fxdependent-ubuntu18.04/Dockerfile b/docker/tests/Templates/fxdependent-ubuntu18.04/Dockerfile deleted file mode 100644 index adc9219a07..0000000000 --- a/docker/tests/Templates/fxdependent-ubuntu18.04/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM microsoft/dotnet:2.1.7-runtime-bionic - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -# Install PowerShell package -ADD $PACKAGELOCATION/$PACKAGENAME . -RUN mkdir -p /opt/microsoft/powershell \ - && tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Download and run tests -RUN $TESTDOWNLOADCOMMAND -RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/opensuse42.3/Dockerfile b/docker/tests/Templates/opensuse42.3/Dockerfile deleted file mode 100644 index d401e61138..0000000000 --- a/docker/tests/Templates/opensuse42.3/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM opensuse:42.3 - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -ARG POWERSHELL_LINKFILE=/usr/bin/pwsh - -# Install dependencies -RUN zypper --non-interactive update --skip-interactive \ - && zypper --non-interactive install \ - glibc-locale \ - glibc-i18ndata \ - tar \ - curl \ - libunwind \ - libicu \ - openssl \ - git - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME - -# Create the target folder where powershell will be placed -RUN mkdir -p /opt/microsoft/powershell -# Expand powershell to the target folder -RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell - -# Create the symbolic link that points to powershell -RUN ln -s /opt/microsoft/powershell/pwsh $POWERSHELL_LINKFILE - -RUN $TESTDOWNLOADCOMMAND -RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/ubuntu16.04/Dockerfile b/docker/tests/Templates/ubuntu16.04/Dockerfile deleted file mode 100644 index 7439eda5a7..0000000000 --- a/docker/tests/Templates/ubuntu16.04/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ubuntu:xenial - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - curl \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME -RUN dpkg -i $PACKAGENAME || : -RUN apt-get install -y -f --no-install-recommends -RUN $TESTDOWNLOADCOMMAND -RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/Templates/ubuntu18.04/Dockerfile b/docker/tests/Templates/ubuntu18.04/Dockerfile deleted file mode 100644 index 6c7a960130..0000000000 --- a/docker/tests/Templates/ubuntu18.04/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ubuntu:bionic - -ARG PACKAGENAME -ARG PACKAGELOCATION -ARG PREVIEWSUFFIX= -ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module -ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git" - -# Install dependencies -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - ca-certificates \ - curl \ - apt-transport-https \ - locales \ - git \ - && apt-get clean - -# Setup the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL $LANG -RUN locale-gen $LANG && update-locale - -RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME -RUN dpkg -i $PACKAGENAME || : -RUN apt-get install -y -f --no-install-recommends -RUN $TESTDOWNLOADCOMMAND -RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount" diff --git a/docker/tests/containerTestCommon.psm1 b/docker/tests/containerTestCommon.psm1 deleted file mode 100644 index c6b540abd7..0000000000 --- a/docker/tests/containerTestCommon.psm1 +++ /dev/null @@ -1,370 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -$script:forcePull = $true -# Get docker Engine OS -function Get-DockerEngineOs -{ - docker info --format '{{ .OperatingSystem }}' -} - -# Call Docker with appropriate result checksfunction Invoke-Docker -function Invoke-Docker -{ - param( - [Parameter(Mandatory=$true)] - [string[]] - $Command, - [ValidateSet("error","warning",'ignore')] - $FailureAction = 'error', - - [Parameter(Mandatory=$true)] - [string[]] - $Params, - - [switch] - $PassThru, - [switch] - $SuppressHostOutput - ) - - $ErrorActionPreference = 'Continue' - - # Log how we are running docker for troubleshooting issues - Write-Verbose "Running docker $command $params" -Verbose - if($SuppressHostOutput.IsPresent) - { - $result = docker $command $params 2>&1 - } - else - { - &'docker' $command $params 2>&1 | Tee-Object -Variable result -ErrorAction SilentlyContinue | Out-String -Stream -ErrorAction SilentlyContinue | Write-Host -ErrorAction SilentlyContinue - } - - $dockerExitCode = $LASTEXITCODE - if($PassThru.IsPresent) - { - Write-Verbose "passing through docker result$($result.length)..." -Verbose - return $result - } - elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'error') - { - Write-Error "docker $command failed with: $result" -ErrorAction Stop - return $false - } - elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'warning') - { - Write-Warning "docker $command failed with: $result" - return $false - } - elseif($dockerExitCode -ne 0) - { - return $false - } - - return $true -} - -# Return a list of Linux Container Test Cases -function Get-LinuxContainer -{ - foreach($os in 'centos7','ubuntu16.04') - { - Write-Output @{ - Name = $os - Path = "$PSScriptRoot/../release/$os" - } - } -} - -# Return a list of Windows Container Test Cases -function Get-WindowsContainer -{ - foreach($os in 'windowsservercore','nanoserver') - { - Write-Output @{ - Name = $os - Path = "$PSScriptRoot/../release/$os" - } - } -} - -$script:repoName = 'microsoft/powershell' -function Get-RepoName -{ - return $script:repoName -} - -function Set-RepoName -{ - param([string]$RepoName) - - $script:repoName = $RepoName - $script:forcePull = $false -} - -function Test-SkipWindows -{ - [bool] $canRunWindows = (Get-DockerEngineOs) -like 'Windows*' - return ($IsLinux -or $IsMacOS -or !$canRunWindows) -} - -function Test-SkipLinux -{ - $os = Get-DockerEngineOs - - switch -wildcard ($os) - { - '*Linux*' { - return $false - } - '*Mac' { - return $false - } - # Docker for Windows means we are running the linux kernel - 'Docker for Windows' { - return $false - } - 'Windows*' { - return $true - } - default { - throw "Unknown docker os '$os'" - } - } -} - -function Get-TestContext -{ - param( - [ValidateSet('Linux','Windows','macOS')] - [string]$Type - ) - - $resultFileName = 'results.xml' - $logFileName = 'results.log' - $containerTestDrive = '/test' - - # Return a windows context if the Context in Windows *AND* - # the current system is windows, otherwise Join-path will fail. - if($Type -eq 'Windows' -and $IsWindows) - { - $ContainerTestDrive = 'C:\test' - } - $resolvedTestDrive = (Resolve-Path "Testdrive:\").providerPath - - return @{ - ResolvedTestDrive = $resolvedTestDrive - ResolvedXmlPath = Join-Path $resolvedTestDrive -ChildPath $resultFileName - ResolvedLogPath = Join-Path $resolvedTestDrive -ChildPath $logFileName - ContainerTestDrive = $ContainerTestDrive - ContainerXmlPath = Join-Path $containerTestDrive -ChildPath $resultFileName - ContainerLogPath = Join-Path $containerTestDrive -ChildPath $logFileName - Type = $Type - ForcePull = $script:forcePull - } -} - -function Get-ContainerPowerShellVersion -{ - param( - [HashTable] $TestContext, - [string] $RepoName, - [string] $Name - ) - - $imageTag = "${script:repoName}:${Name}" - - if($TestContext.ForcePull) - { - $null=Invoke-Docker -Command 'image', 'pull' -Params $imageTag -SuppressHostOutput - } - - $runParams = @() - $localVolumeName = $testContext.resolvedTestDrive - $runParams += '--rm' - if($TestContext.Type -ne 'Windows' -and $IsWindows) - { - # use a container volume on windows because host volumes are not automatic - $volumeName = "test-volume-" + (Get-Random -Minimum 100 -Maximum 999) - - # using alpine because it's tiny - $null=Invoke-Docker -Command create -Params '-v', '/test', '--name', $volumeName, 'alpine' -SuppressHostOutput - $runParams += '--volumes-from' - $runParams += $volumeName - } - else { - $runParams += '-v' - $runParams += "${localVolumeName}:$($testContext.containerTestDrive)" - } - - $runParams += $imageTag - $runParams += 'pwsh' - $runParams += '-c' - $runParams += ('$PSVersionTable.PSVersion.ToString() | out-string | out-file -encoding ascii -FilePath '+$testContext.containerLogPath) - - $null = Invoke-Docker -Command run -Params $runParams -SuppressHostOutput - if($TestContext.Type -ne 'Windows' -and $IsWindows) - { - $null = Invoke-Docker -Command cp -Params "${volumeName}:$($testContext.containerLogPath)", $TestContext.ResolvedLogPath - $null = Invoke-Docker -Command container, rm -Params $volumeName, '--force' -SuppressHostOutput - } - return (Get-Content -Encoding Ascii $testContext.resolvedLogPath)[0] -} - -# Function defines a config mapping for testing Preview packages. -# The list of supported OS for each release can be found here: -# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms -function Get-DefaultPreviewConfigForPackageValidation -{ - # format: = - @{ 'centos7'='rhel.7'; - 'debian.9'='debian.9'; - 'fedora28'='rhel.7'; - 'opensuse42.3'='linux-x64.tar.gz'; - 'ubuntu16.04'='ubuntu.16.04'; - 'ubuntu18.04'='ubuntu.18.04'; - 'fxdependent-centos7'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-fedora28'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-ubuntu18.04'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-dotnetsdk-latest'='linux-x64-fxd-dotnetsdk.tar.gz' - } -} - -# Function defines a config mapping for testing Stable packages. -# The list of supported OS for each release can be found here: -# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms -function Get-DefaultStableConfigForPackageValidation -{ - # format: = - @{ 'centos7'='rhel.7'; - 'debian.9'='debian.9'; - 'opensuse42.3'='linux-x64.tar.gz'; - 'ubuntu16.04'='ubuntu.16.04'; - 'fxdependent-centos7'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz'; - 'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz' - } -} - -# Returns a list of files in a specified Azure container. -function Get-PackageNamesOnAzureBlob -{ - param( - [string] - $ContainerUrl, - - # $SAS (shared access signature) param should include beginning '?' and trailing '&' - [string] - $SAS - ) - - - $response = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list') - - $xmlResponce = [xml]$response.Substring($response.IndexOf('