Skip to content

Conversation

@daxian-dbw
Copy link
Member

Related to #5590

Make the -SslProtocol tests pending for now.

Copy link
Contributor

@markekraus markekraus left a comment

Choose a reason for hiding this comment

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

This covered IWR, but what about the IRM failing tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is all very hard to read and follow what is doing what. If we are going to use a foreach anyway, we might as well have them structured like this:

$testCases1 = @( 
    @{Test = @{SslProtocol = 'Default'; ActualProtocol = 'Default'}; Pending = $false }
    @{Test = @{SslProtocol = 'Tls'; ActualProtocol = 'Tls'}; Pending = $false }
    @{Test = @{SslProtocol = 'Tls11'; ActualProtocol = 'Tls11'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls12'; ActualProtocol = 'Tls12'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls11'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls'}; Pending = $IsMacOS }
    @{Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls12'}; Pending = -not $IsWindows }

)
foreach ($entry in $testCases1) {
    It "Verifies Invoke-WebRequest -SslProtocol <SslProtocol> works on <ActualProtocol>" -TestCases ($entry.test) -Pending:($entry.Pending) {
        param($SslProtocol, $ActualProtocol)
        $params = @{
            Uri = Get-WebListenerUrl -Test 'Get' -Https -SslProtocol $ActualProtocol
            SslProtocol = $SslProtocol
            SkipCertificateCheck = $true
        }
        $response = Invoke-WebRequest @params
        $result = $Response.Content | ConvertFrom-Json

        $result.headers.Host | Should Be $params.Uri.Authority
    }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, forgot the Invoke-RestMethod tests 😨 Will add soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

Some of the tests are currently not run in macOS. I thought they didn't apply to macOS.
Mark a test pending means the test should pass but it doesn't, and thus need to be fixed.
Mark a test Skip means it doesn't apply to a platform, and it's expected that the test doesn't run on that platform.
Do you think all test cases should work on all platforms? Or some tests should be marked as -Skip on some platforms?

Copy link
Contributor

Choose a reason for hiding this comment

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

I originally did the test this way because I was trying to avoid a forereach loop. at the time the logic was simpler.. but.. it continues to get more complex 😦 .

In a perfect world, these should all work on all platforms. CoreFX does not have a any of these issues we've run into here documented. by all Accounts macOS should support multiple protocols at once (either they need to document that it's not supported or this is an issue) , and that one that fails on Linux should work. I need to open issues with CoreFX, but... I have make simple C# repros and I haven't had the time.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I will update the change to mark the tests -Pending on the platforms they currently don't run.
Thanks @markekraus !

Copy link
Contributor

@markekraus markekraus left a comment

Choose a reason for hiding this comment

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

LGTM. My requested changes are not blocking.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this to possible CoreFX issue, please? My own missing word it bugging me 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks for spotting it!

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, if you would be so kind.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@adityapatwardhan
Copy link
Member

@daxian-dbw please fix, merge conflict.

@adityapatwardhan adityapatwardhan merged commit c6f27dc into PowerShell:master Dec 4, 2017
@daxian-dbw daxian-dbw deleted the disablessl branch December 4, 2017 19:38
@TravisEz13 TravisEz13 added this to the 6.0.0-RC.2 milestone Dec 5, 2017
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Dec 5, 2017
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.

4 participants