Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add some HttpListener authentication tests - #20102

Merged
stephentoub merged 3 commits into
dotnet:masterfrom
hughbe:httplistener-auth
May 23, 2017
Merged

Add some HttpListener authentication tests#20102
stephentoub merged 3 commits into
dotnet:masterfrom
hughbe:httplistener-auth

Conversation

@hughbe

@hughbe hughbe commented May 22, 2017

Copy link
Copy Markdown

Lots more managed test failures, sorry - also a Windows implementation bug. This prevented me from adding more tests, but I verified that the disabled tests pass on netfx

Contributes to #13618

public class Helpers
public static class Helpers
{
public static bool IsWindowsImplementation { get; } = false;//PlatformDetection.IsWindows && PlatformDetection.IsNotOneCoreUAP;

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.

Why is this always false?

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.

Ah that's an accident when I was testing the managed implementation.
I basically discovered that the managed tests can be run on Windows which means I can debug them very easily using VS.

By using ConditionalFact/ConditionalTheory I can run managed tests on Windows without hanging tests and spammy failures.
The idea behind these is that the difference isn't between windows/unix so doesn't really fit into TestPlatforms, but rather managed and Windows, where the managed implementation can also run on windows

await ValidateValidUser();
}

[ConditionalTheory(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20099, TestPlatforms.Unix)]

@stephentoub stephentoub May 22, 2017

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.

Why is this ConditionalTheory construct being used like this with IsWindowsImplementation? It doesn't work to just add the active issue for unix?

[ActiveIssue(20099, TestPlatforms.AnyUnix)]
[ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))]

?

}

[ConditionalFact(nameof(Helpers) + "." + nameof(Helpers.IsWindowsImplementation))] // [ActiveIssue(20101, TestPlatforms.AnyUnix)]
[ActiveIssue(20096)]

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.

Similarly, why can't this be:

[ActiveIssue(20096, TestPlatforms.Windows)]
[ActiveIssue(20101, TestPlatforms.AnyUnix)]
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotOneCoreUAP))] 

? Does that not work?

hughbe added 3 commits May 23, 2017 08:04
I don't know why these are failing but I don't think it's a bug as
Windows and managed share the same code here
@karelz karelz added this to the 2.1.0 milestone May 23, 2017
Assert.Throws<ObjectDisposedException>(() => listener.Realm = null);
}

public async Task<HttpResponseMessage> AuthenticationFailure(HttpClient client, HttpStatusCode errorCode)

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.

Nit: we should make this private instead of public so that it's clear it's not a mistake that it doesn't have a Theory attribute on it.

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.

(we don't have to restart CI for this though)

@stephentoub stephentoub left a comment

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.

Thanks!

@stephentoub

Copy link
Copy Markdown
Member

@dotnet-bot test outerloop netfx Windows_NT Debug
@dotnet-bot test outerloop netcoreapp Windows_NT Debug
@dotnet-bot test outerloop netcoreapp Ubuntu16.10 Debug

@stephentoub

Copy link
Copy Markdown
Member

@mmitche, do you know why these runs I triggered aren't getting executed?

@davidsh davidsh removed their assignment May 23, 2017
@mmitche

mmitche commented May 23, 2017

Copy link
Copy Markdown
Member

@stephentoub Azure stopped talking to us again. I'm rebooting it now. This should be fixed this week (made some tweaks to the plugin)

@stephentoub
stephentoub merged commit b88ad78 into dotnet:master May 23, 2017
@hughbe
hughbe deleted the httplistener-auth branch May 23, 2017 15:55
@CIPop CIPop removed their assignment May 23, 2017
stephentoub pushed a commit to stephentoub/corefx that referenced this pull request May 29, 2017
* Add HttpListener authorization tests

* Baseline managed test failures

* Fix non-Windows test failures

I don't know why these are failing but I don't think it's a bug as
Windows and managed share the same code here
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants