Closed eddyashton closed 9 months ago
CI failed, but it looks like this was due to a race condition, concurrently accessing files:
Failed Restler.Test.Dictionary+DictionaryTests.quoting is correct in the grammar [1 s]
Error Message:
System.IO.IOException : The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\restlerTest\202142\grammar.json' because it is being used by another process.
Stack Trace:
...
Failed Restler.Test.Dictionary+DictionaryTests.path and body parameter set to the same uuid suffix payload [30 ms]
Error Message:
System.IO.IOException : The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\restlerTest\202142\grammar.json' because it is being used by another process.
Is this a known flaky test? Should the CI simply be re-run?
CI failed, but it looks like this was due to a race condition, concurrently accessing files:
Failed Restler.Test.Dictionary+DictionaryTests.quoting is correct in the grammar [1 s] Error Message: System.IO.IOException : The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\restlerTest\202142\grammar.json' because it is being used by another process. Stack Trace: ... Failed Restler.Test.Dictionary+DictionaryTests.path and body parameter set to the same uuid suffix payload [30 ms] Error Message: System.IO.IOException : The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\restlerTest\202142\grammar.json' because it is being used by another process.
Is this a known flaky test? Should the CI simply be re-run?
Correct, this failure is a known race condition and it's fine to merge if the test passes on re-run.
I was surprised by how permissive the JSON deserialization is, and it resulted in error messages hiding useful information.
My motivating use case was an annotations file like this:
Trying to compile a grammar with that produces an extremely generic null-reference message:
It turns out that even though
ProducerConsumerUserAnnotation
saysproducer_endpoint : string
(implying a non-optional field), it will parse{}
and produce an object with{producer_endpoint: null}
. Despite sensible checks on the result oftryDeserialize
, this is missed and blows up later. I think this should be a parsing error, caught by all callers ofUtilities.JsonSerialization.tryDeserialize
and reported correctly.This PR makes that change, by specifying a
ContractResolver
fromFSharpLu.Json
. The original example now produces a descriptive error:(Disclaimer - I'm not familiar with F# or .NET, and I've only just started experimenting with restler, so this is a purely speculative change from a bit of docs-probing. Please let me know if there's a better way to achieve this, or some reason that the original behaviour is required)