New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix mutable sync/async logging and support async tests #60
Conversation
I think I know how this should work. I've just been trying to add support for async tests. The executions of a test with logging should be made into an |
@@ -544,8 +527,12 @@ module Impl = | |||
|
|||
fun (printers: TestPrinters) map -> | |||
|
|||
let log test = | |||
if test.sequenced then Async.StartImmediate else Async.Start |
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.
It's really just the join at the end of the run that should decide the method with which logs are awaited... Just because we sequence tests, we don't have to start their logs immediately. Also, logger.infoWithBP
will only back-pressure the logger's buffer, not the printing. So the returned Async<unit>
from such a function call will yield as soon as the buffer has accepted the message – a final flush of the logging infrastructure at the end should then be enough.
I really like these changes. However, we may have to think about it a bit; see my in-code comment. |
Sure. I've been working on the async tests. I'll add that to the PR when its ready and we can discuss. Currently having some issues with the run taking 20s insead of 2s (logging ACK? not sure) |
The two are identical in the Facade: https://github.com/logary/logary/blob/master/src/Logary.Facade/Facade.fs#L703-L710 |
@haf Could you take a look at some point and let me know if you think I'm on the right track. |
@haf, Just to update you on the status of this. I've added number of parallel workers to command line and async test tests. Its basically done as far I can see apart from some docs. There are a few issues outstanding:
Failed: 7 |
Your failures may be fixed w/ string changes in #64 |
No 64 is merged now. |
rebased but I still see the errors. May be down to LF vs CRLF:
|
@@ -434,13 +434,13 @@ let isFasterThanSub (f1:Performance.Measurer<_,_>->'a) (f2:Performance.Measurer< | |||
Tests.failtestf "%s. Expected f1 (%s) to be faster than f2 (%s) but is ~%.0f%% slower." | |||
format (toString s1) (toString s2) ((s1.mean/s2.mean-1.0)*100.0) | |||
| Performance.MetricLessThan (s1,s2) -> | |||
Impl.logger.info ( | |||
Impl.logger.log Info ( |
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.
If we expect this to be sent all the way to the terminal before the process exists, logWithAck
should be used.
createSummaryMessage summary | ||
|> log.write Info | ||
|> logger.log Info |
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.
LogWithAck
Do you still have issues with speed? |
No its fine with the parallel-workers defaulting to logical processors. I'll add docs for this command line later and test if a .gitattributes with Will close #2 when docs are done. |
This is a good PR, I've merged it and tested it to some extent and it's looking good. I've also added the |
Cool |
Still have the 7 failing tests. Changing to LF doesn't seem to fix. |
Can you set up an appveyor.yml file to showcase the test errors? |
Sure will look to. I also did a contention profile and think that the problem with the slow down when using many workers is down to assertTestFails and multiple full evals running. Still experimenting but this probably could be transformed into a normal test without using the full runner inside the test. I may also pick up #68 later in the week if no one else has done it. I have an interest in what could be done later with FsCheck (scaling for stress testing, easy stdgen etc) |
Hopefully the style is ok.
I think for LF vs CRLF you need a .gitattributes file.
I think ultimately there must be a better way to handle sync/async logging. Needs to be able to be switched from async flush to manual flush.