Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Server per test #3253

Merged
merged 3 commits into from
Nov 6, 2018
Merged

Server per test #3253

merged 3 commits into from
Nov 6, 2018

Conversation

BrennanConroy
Copy link
Member

Lets hash out the design.

Currently is working and an example of test log is below:

[0.001s] [TestLifetime] [Information] Starting test CanSendAndReceiveMessage_json_ServerSentEvents_default at 2018-11-02T16:17:51
[0.002s] [Microsoft.AspNetCore.SignalR.Tests.ServerFixture] [Information] Starting test server...
[0.004s] [Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager] [Information] User profile is available. Using 'C:\Users\brecon\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[0.027s] [Microsoft.AspNetCore.SignalR.Tests.ServerFixture] [Information] Test Server started
[0.031s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request starting HTTP/1.1 POST http://127.0.0.1:39919/default/negotiate  0
[0.031s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request finished in 0.6421ms 200 application/json
[0.032s] [Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport] [Information] e8GsoqDPQ1_44SDhQHsEMw - Starting transport. Transfer mode: Text.
[0.033s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request starting HTTP/1.1 GET http://127.0.0.1:39919/default?id=e8GsoqDPQ1_44SDhQHsEMw  
[0.033s] [Microsoft.AspNetCore.Http.Connections.Client.HttpConnection] [Information] e8GsoqDPQ1_44SDhQHsEMw - HttpConnection Started.
[0.034s] [Microsoft.AspNetCore.SignalR.Client.HubConnection] [Information] e8GsoqDPQ1_44SDhQHsEMw - Using HubProtocol 'json v1'.
[0.035s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request starting HTTP/1.1 POST http://127.0.0.1:39919/default?id=e8GsoqDPQ1_44SDhQHsEMw  32
[0.035s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request finished in 0.2683ms 200 text/plain
[0.035s] [Microsoft.AspNetCore.SignalR.HubConnectionContext] [Information] e8GsoqDPQ1_44SDhQHsEMw - e8GsoqDPQ1_44SDhQHsEMw - Completed connection handshake. Using HubProtocol 'json'.
[0.035s] [Microsoft.AspNetCore.SignalR.Client.HubConnection] [Information] e8GsoqDPQ1_44SDhQHsEMw - HubConnection started.
[0.036s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request starting HTTP/1.1 POST http://127.0.0.1:39919/default?id=e8GsoqDPQ1_44SDhQHsEMw  11
[0.036s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request finished in 0.1579ms 200 text/plain
[0.036s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request starting HTTP/1.1 POST http://127.0.0.1:39919/default?id=e8GsoqDPQ1_44SDhQHsEMw  70
[0.036s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request finished in 0.1762ms 200 text/plain
[0.037s] [Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport] [Information] e8GsoqDPQ1_44SDhQHsEMw - Transport is stopping.
[0.037s] [Microsoft.AspNetCore.Http.Connections.Client.HttpConnection] [Information] e8GsoqDPQ1_44SDhQHsEMw - HttpConnection Disposed.
[0.037s] [Microsoft.AspNetCore.Hosting.Internal.WebHost] [Information] Request finished in 4.5803ms 200 text/event-stream
[0.038s] [Microsoft.AspNetCore.SignalR.Tests.ServerFixture] [Information] Shutting down test server
[0.038s] [Microsoft.AspNetCore.SignalR.Tests.ServerFixture] [Information] Test server shut down
[0.038s] [TestLifetime] [Information] Finished test CanSendAndReceiveMessage_json_ServerSentEvents_default in 0.0365368s

Copy link
Contributor

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

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

I like it. I think that if possible we should reframe the VerifiableServerLoggedTest class into a base class for all functional tests that require a server. The logging is just a useful side-feature of that component.

Top-level suggestions:

  • Rename ServerFixture to "FunctionalTestServer" or something similar
  • Rename VerifiableServerLoggedTest to ServerTestBase or similar

And a couple comments inline

@@ -44,6 +43,20 @@ public VerifiableServerLoggedTest(ServerFixture serverFixture, ITestOutputHelper
};
}

public IDisposable StartVerifiableServerLog<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, LogLevel minLogLevel, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public IDisposable StartVerifiableServerLog<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, LogLevel minLogLevel, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class
public IDisposable StartServer<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, LogLevel minLogLevel, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class

return new MultiDisposable(serverFixture, disposable);
}

public IDisposable StartVerifiableServerLog<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public IDisposable StartVerifiableServerLog<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class
public IDisposable StartServer<T>(out ILoggerFactory loggerFactory, out ServerFixture<T> serverFixture, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null) where T : class

@analogrelay
Copy link
Contributor

Looking snazzy AF. Can you get some rough test run-time comparison numbers from before and after (with a little bit of warm-up)?

@BrennanConroy
Copy link
Member Author

Microsoft.AspNetCore.SignalR.Client.FunctionalTests

Before: Core 59 seconds, Full Framework 1 minute
After: Core 31.5 seconds, Full Framework 36.9 seconds

@analogrelay
Copy link
Contributor

analogrelay commented Nov 6, 2018

Seems super weird that it's faster after this change... I'd expect it to be slightly slower or about the same... Not going to block the merge on that though.

@BrennanConroy
Copy link
Member Author

BrennanConroy commented Nov 6, 2018

It has to be parallelization
Also, I don't think we dupe logs anymore, so server logs don't make their own file anymore.

@BrennanConroy
Copy link
Member Author

@muratg FYI, test only changes for release/2.2

Copy link

@muratg muratg left a comment

Choose a reason for hiding this comment

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

Approved.

@BrennanConroy BrennanConroy merged commit ffd4bcd into release/2.2 Nov 6, 2018
@BrennanConroy BrennanConroy deleted the brecon/serverPerTest branch November 6, 2018 17:33
@analogrelay
Copy link
Contributor

It has to be parallelization

Of course! Missed that part ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants