Skip to content

Conversation

@anmenaga
Copy link

@anmenaga anmenaga commented Aug 30, 2018

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


$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
Copy link
Author

@anmenaga anmenaga Aug 30, 2018

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
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
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
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
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
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.

)


$responce = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')
Copy link
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
Author

Choose a reason for hiding this comment

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

updated


$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
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
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
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
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 adityapatwardhan merged commit dba6fc2 into PowerShell:master Sep 4, 2018
TravisEz13 pushed a commit that referenced this pull request Sep 5, 2018
@TravisEz13 TravisEz13 added this to the v6.1.0 milestone Sep 7, 2018
@anmenaga anmenaga deleted the UpdateAndRefactorDockerTests branch October 31, 2018 21:17
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