-
Notifications
You must be signed in to change notification settings - Fork 183
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
[Test Proxy] Support matching GZip request content #4103
Comments
Label prediction was below confidence level |
Test Proxy might be able to detect if request is Gzip based on content-encoding, and use that as a signal to decompress the bodies before comparing. |
This is an ask on the test framework. Gzip by nature is non-deterministic so we need a way to check if the content encoding is Gzip and compare the uncompressed request body instead in the proxy. |
This should be handled in the Test Proxy itself, as it will be an issue for all languages. |
This is currently not a blocker because we have told the tests to not compare the text bodies of requests. It is something we should address soon though |
/cc @scbedd |
@JoshLove-msft: If this was handled in the test proxy, would that let Monitor just re-record the tests and things work - or would we need additional adjustments in the test framework to accommodate playback mode? |
Ideally, the monitor tests would not need to be re-recorded. The Test Proxy should check the content-encoding of a request, and if it is Gzip, then it needs to decompress the request body and the recorded request body before comparing them. |
Ah, gotcha. So the proxy does the comparison, not the framework. That's where I wasn't aware. |
Yep, the playback matching happens within the test proxy. |
Can I please see what the requests would look like in json form? We absolutely already automatically un-gzip request bodies when it is indicated by the header values. I suspect that the body differences are actually real. |
I think this is one example - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.Ingestion/tests/SessionRecords/MonitorIngestionLiveTest/ValidInputFromArrayAsJsonWithSingleBatchWithGzip.json#L17-L22 So the body is decompressed from the request when recording, but what about during playback? I don't see where the incoming request body is decompressed there. Without doing this, we end up comparing the compressed body with the decompressed one, so even without the issue of determinism (which may turn out to have not really been an issue here), the bodies won't match if the request is zipped. |
I'm really thinking this is the case. We absolutely re-compress as we should, but it looks like there is a bug with decompressing the incoming. I'll add this to the list of "get these done ASAP" bugs for test-proxy. The only other item on that list is for the further multipart/mixed fixes. I'm grinding super hard trying to get asset-sync stuff ready to go before MQ, but I'll definitely dedicate some time to this bug in the very near future. |
I looked into this more and the proxy is storing decompressed Gzip for response bodies. This issue is specifically about the need to decompress request bodies when matching, and potentially when recording. If you look at the linked recording files, you can see that the data that was recorded contains a bunch of |
To be completed by 2nd Preview in mid September
Explore if .Net gzip is deterministic?
When running tests in Record vs. Playback it seems like the length of the gzipped requests vary slightly. The test framework needs the a test's RequestBody's to match when running in Playback.
Possible solution: add a boolean property in TextProxy that for gzipped libraries that when true does not compare the Request Body in a Recording
The text was updated successfully, but these errors were encountered: