GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Replace HttpListener Response Tests with WebListener by markekraus · Pull Request #5540 · PowerShell/PowerShell

Conversation

@markekraus

@markekraus Mark Kraus (markekraus) commented Nov 24, 2017

Copy link
Copy Markdown
Contributor

ref #5464 , #2504, #3267

  • replaces HttpListener "response" tests with WebListener
  • Adds /Response/ test to WebListener
  • removes HtmlWebResponseObject tests as HTML parsing will no longer be done by the web cmdlets Webcmdlets should parse the <html><head><meta charset="foo"> attribute for the correct encoding if not in http header #3267 (comment)
  • test bodies that used the system new line have been replaced normalized with `n
  • multiple headers with the same name test enabled for windows (still pending for macOS/Linux)

This should alleviate some of the macOS HttpListener related failures.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@markekraus
Mark Kraus (markekraus) requested review from Travis Plunk (TravisEz13), Aditya Patwardhan (adityapatwardhan) and Dongbo Wang (daxian-dbw) as code owners November 24, 2017 21:52
@markekraus Mark Kraus (markekraus) mentioned this pull request Nov 24, 2017
macOS is hanging during webcmdlets tests #5464
Closed
5 tasks done
@markekraus

Mark Kraus (markekraus) commented Nov 25, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

AppVeyor CI fail is being addressed by #5542 #5554

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) reviewed Nov 25, 2017
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 Outdated

@iSazonov Ilya (iSazonov) Nov 25, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is it ok to use explicit port?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 25, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

In this case, the port is not used. The header is echoed back like so:

Link: <http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=1>; rel="self"
Link: <http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=2>; rel="next"
Link: <http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=5>; rel="last"

and then the test is to ensure the RelationLink.Count is 3 and the the exact urls are provided. These URLs could be anything for this test, but since the linkheader API still lives on HttpListener and not WebListener, I kept the URLs as is so they can actually be useful if you manually repro the test.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 Outdated

@iSazonov Ilya (iSazonov) Nov 25, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could you please explain why we want to remove these tests?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 25, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I did in the PR description.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 Outdated

@iSazonov Ilya (iSazonov) Nov 25, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We can remove the BeforeAll .

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 25, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/tools/WebListener/Controllers/ResponseController.cs Outdated

@iSazonov Ilya (iSazonov) Nov 25, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please remove the extra line.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 25, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/tools/WebListener/Controllers/ResponseController.cs Outdated

@iSazonov Ilya (iSazonov) Nov 25, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We never use the formatting.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 25, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Do i really need to have this all on one line where you have to scroll for an eternity to see it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Nov 26, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I believe we use the pattern:

if (Request.Query.TryGetValue("statuscode", out statusCodes) &&   
    Int32.TryParse(statusCodes.FirstOrDefault(), out statusCode))  
{
    ...
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markekraus Mark Kraus (markekraus) Nov 26, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iSazonov
Ilya (iSazonov) approved these changes Nov 27, 2017
View reviewed changes
@iSazonov Ilya (iSazonov) assigned Aditya Patwardhan (adityapatwardhan) Nov 27, 2017
adityapatwardhan
Aditya Patwardhan (adityapatwardhan) approved these changes Nov 27, 2017
View reviewed changes
TravisEz13
Travis Plunk (TravisEz13) approved these changes Nov 28, 2017
View reviewed changes
@iSazonov

Ilya (iSazonov) commented Nov 29, 2017

Copy link
Copy Markdown
Collaborator

Mark Kraus (@markekraus) Could you please rebase to pass CI Appveyor?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markekraus

Mark Kraus (markekraus) commented Nov 29, 2017

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) Rebase wont help this one. It already picked up #5554 in the last empty commit to re-run CI. The problem now is fail in #5567 (which is actually a dup of an older issue where I noted the same behavior randomly happening).

I will rebase anyway in hopes that the WMF links are working now and we don't find some other transient test issue in the feature tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mark Kraus (markekraus) added 4 commits November 29, 2017 04:08
@markekraus
Add Response Controller
d33deef
@markekraus
[Feature] Replace HttpListener Response tests with WebListener
97ee405
@markekraus
[Feature] Address PR Feedback
97af3a2
@markekraus
[Feature] Address PR Feedback
26d4ebe
@markekraus
Mark Kraus (markekraus) force-pushed the HttpListenerToWebListener branch from f256997 to 26d4ebe Compare November 29, 2017 10:11
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Nov 29, 2017

Copy link
Copy Markdown
Member

The test run got a hard failure:

  WebListener -> /home/travis/build/PowerShell/PowerShell/test/tools/WebListener/bin/Linux/netcoreapp2.0/linux-x64/WebListener.dll
  WebListener -> /home/travis/build/PowerShell/PowerShell/test/tools/WebListener/bin/
Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Management.Automation.Tracing.PSEtwLog' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Management.Automation.Tracing.PSSysLogProvider' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'psl-native': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at System.Management.Automation.Tracing.NativeMethods.OpenLog(IntPtr ident, SysLogPriority facility)
   at System.Management.Automation.Tracing.SysLogProvider..ctor(String applicationId, PSLevel level, PSKeyword keywords, PSChannel channels)
   at System.Management.Automation.Tracing.PSSysLogProvider..cctor()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Tracing.PSSysLogProvider..ctor()
   at System.Management.Automation.Tracing.PSEtwLog..cctor()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Tracing.PSEtwLog.LogOperationalInformation(PSEventId id, PSOpcode opcode, PSTask task, PSKeyword keyword, Object[] args)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args, Int32 argc)
   at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args) in /home/travis/build/PowerShell/PowerShell/src/powershell/Program.cs:line 23

Mark Kraus (@markekraus) I'm not sure how the PSEtwLog came in the play, but it unveils a bug in SysLogProvider.cs, where libpsl-native should be used instead of psl-native. I opened bug #5577 for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markekraus

Mark Kraus (markekraus) commented Nov 29, 2017

Copy link
Copy Markdown
Contributor Author

Is there some reason we don't run the feature tests on every PR? I run into so many CI fails because most of the web cmdlet tests are gated behind the feature tag. Changes made in other PR's that affect the Feature tests are not being properly vetted. In the past even my own PRs have been approved with broken feature tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Nov 29, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Feature test run takes more time and not every PR needs the full feature test run, so it's not on by default.
It can be turned on with the [Feature] tag, so the maintainer assigned to the PR or any reviewers of the PR can request a feature test run for the PR to be merged.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Nov 30, 2017

Copy link
Copy Markdown
Collaborator

I'm not sure how the PSEtwLog came in the play

Dan Travison (@dantraMSFT) Have you any ideas why the PSEtwLog is activated from WebListener?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markekraus

Mark Kraus (markekraus) commented Nov 30, 2017

Copy link
Copy Markdown
Contributor Author

PSEtwLog is not being activated from WebListener...
This line

WebListener -> /home/travis/build/PowerShell/PowerShell/test/tools/WebListener/bin/

indicates that the Publish-PSTestTools has completed:

PowerShell/build.psm1

Line 960 in 7dce411

Publish-PSTestTools | ForEach-Object {Write-Host $_}

WebListener is not being run at that point. and the compile appears to be successful

This is failing sometime after Publish-PSTestTools and before the pester tests start. After weblistener is compiled Start-PSPester builds the command line and path then starts a native execution of pwsh. Plenty of places there for PSEtwLog to trigger.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Nov 30, 2017

Copy link
Copy Markdown
Member

The root cause of the loading failure was that one of our team members uploaded a libpsl-native nuget package that contains a corrupted Linux binary file. The package has been fixed.
As for #5577, .NET Core actually support lack of "lib" prefix in DllImport name (see dotnet/coreclr#1248), but #5580 was merged anyways to make the naming consistent.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markekraus

Mark Kraus (markekraus) commented Nov 30, 2017

Copy link
Copy Markdown
Contributor Author

thanks. This PR shouldn't have anything outstanding on it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 95a8a64 into PowerShell:master Dec 4, 2017
@TravisEz13 Travis Plunk (TravisEz13) added this to the 6.0.0-RC.2 milestone Dec 5, 2017
Travis Plunk (TravisEz13) pushed a commit to TravisEz13/PowerShell that referenced this pull request Dec 5, 2017
@markekraus @TravisEz13
Replace HttpListener Response Tests with WebListener (PowerShell#5540)
0c4f3be
* Add Response Controller

* [Feature] Replace HttpListener Response tests with WebListener
@TravisEz13 Travis Plunk (TravisEz13) mentioned this pull request Dec 5, 2017
Merge changes from master to 6.0.0-rc.2 #5626
Merged
Travis Plunk (TravisEz13) pushed a commit that referenced this pull request Dec 5, 2017
@markekraus @TravisEz13
Replace HttpListener Response Tests with WebListener (#5540)
7da528c
* Add Response Controller

* [Feature] Replace HttpListener Response tests with WebListener
@markekraus
Mark Kraus (markekraus) deleted the HttpListenerToWebListener branch January 19, 2018 18:58
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@markekraus @adityapatwardhan
Replace HttpListener Response Tests with WebListener (PowerShell#5540)
cd68492
* Add Response Controller

* [Feature] Replace HttpListener Response tests with WebListener
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@markekraus @TravisEz13
Replace HttpListener Response Tests with WebListener (PowerShell#5540)
02a0498
* Add Response Controller

* [Feature] Replace HttpListener Response tests with WebListener
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) adityapatwardhan approved these changes
@iSazonov Ilya (iSazonov) iSazonov approved these changes
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@adityapatwardhan Aditya Patwardhan (adityapatwardhan)

Labels

None yet

Projects

None yet

Milestone

6.0.0-RC.2

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@markekraus @iSazonov @daxian-dbw @TravisEz13 @adityapatwardhan
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.