Skip to content

Updates to Docker package tests - #7667

Merged
Aditya Patwardhan (adityapatwardhan) merged 3 commits into
PowerShell:masterfrom
anmenaga:UpdateAndRefactorDockerTests
Sep 4, 2018
Merged

Aditya Patwardhan (adityapatwardhan) merged 3 commits into
PowerShell:masterfrom
anmenaga:UpdateAndRefactorDockerTests

Conversation

@anmenaga

@anmenaga Andrew (anmenaga) commented Aug 30, 2018 •

Copy link
Copy Markdown

PR Summary

This PR updates tests for package validation.
Primary change is switching from constructing expected package filenames based on PS version to query the Azure Blob for actual packages that it has. This greatly improves reliability and makes test failure diagnostics much easier. This also removes 'special-case-code-paths' that were needed previously when constructing expected package filenames in some cases (e.g. opensuse).

Other updates:

  • same set of dockerfiles used for both preview and stable packages;
  • renamed/changed dockerfile ARGs to be more flexible:
    ** removed "PSVERSIONSTUB" in favor of "PACKAGENAME" that is found on Azure Blob
    ** renamed "PACKAGELOCATIONSTUB" to "PACKAGELOCATION"
    ** added "PREVIEWSUFFIX" that has to be "-preview" for preview packages
    ** renamed "TESTLISTSTUB" to "TESTLIST"
    ** removed "GITLOCATION" in favor of "TESTDOWNLOADCOMMAND" to have better control how tests are obtained (e.g. allowing to use PAT)
  • Config updates:
    ** removed ubuntu17.10
    ** added fedora28
    ** added opensuse42.3
    ** added ubuntu18.04

PR Checklist

Comment thread docker/tests/containerTestCommon.psm1 Outdated

$responce = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')

$xmlResponce = [xml]$responce.Remove(0,3) # remove some bad chars in the beginning that break XML parsing

@anmenaga Andrew (anmenaga) Aug 30, 2018 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fragile. It needs to remove chars based on where it finds beginning of XML code rather than removing hardcoded number of chars. Will update shortly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN yum install -y $PACKAGENAME
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -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 $TESTLIST -PassThru).FailedCount"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a $null = before New-Item

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
RUN yum install -y $PACKAGENAME
RUN $TESTDOWNLOADCOMMAND
RUN pwsh$PREVIEWSUFFIX -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 $TESTLIST -PassThru).FailedCount"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Start-PSPester might be better instead of Invoke-Pester as it loads helpers. It uses -Path parameter for the test list.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After we discussed this, I could not make it work. We'll need to dig deeper later; for this PR this change is not required.

Comment thread docker/tests/containerTestCommon.psm1 Outdated
)


$responce = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo responce -> response

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment thread docker/tests/containerTestCommon.psm1 Outdated

$responce = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')

$xmlResponce = [xml]$responce.Substring($responce.IndexOf('<EnumerationResults')) # remove some bad chars in the beginning that break XML parsing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typo

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


function Get-DefaultPreviewConfigForPackageValidation
{
@{ 'centos7'='rhel.7';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about where to get the list of the supported OS for each release

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Updated.

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit dba6fc2 into PowerShell:master Sep 4, 2018
@TravisEz13 Travis Plunk (TravisEz13) added this to the v6.1.0 milestone Sep 7, 2018
@anmenaga
Andrew (anmenaga) deleted the UpdateAndRefactorDockerTests branch October 31, 2018 21:17
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants