-
-
Notifications
You must be signed in to change notification settings - Fork 614
[CacheResponsesPlugin] Serve out of cache. #442
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Tests for cache file contents with embedded proxy. * Attempt to use a separate file for each request In fact, it will not, because the file name is generated from plugin UID. A more advanced scheme is needed. This is required if we want to create answers from cache. * Create cache dir if it does not exist. * Added a cache list file. The cache list is a text file whose lines are composed of five space-separated fields: - The HTTP(S) request method - The HTTP(S) request host - The HTTP(S) request path - A SHA512 sum of the request body, if any (else 'None'). - The name of the cache file. * Support for multi-processing in cache store. Since the list file will be shared accross all processes, we must ensure reads are sychronized. * Load cached request from cache. To be done: - Tests (currently only test for the presence of the file). - No support for HTTPS (explicitly disabled). * Tests for caching HTTP request from upstream. * Select test class using test name prefix only. * Tests for loading responses from cache. * Implementation on enabled feature. Cache is enabled by default. * VCR feature of TestCase class with tests. In this case, the cache should be disabled by default. * Flush list when cache file is written on disk. * When used with HTTPS resquests, `request.host` may be None Use `Host` header in this case. * Tests for caching HTTPS responses from upstream. * Tests for answering HTTPS request from cache. * Added newline in cache file test. Co-authored-by: Abhinav Singh <[email protected]>
Codecov Report
@@ Coverage Diff @@
## develop #442 +/- ##
===========================================
+ Coverage 78.58% 79.25% +0.67%
===========================================
Files 83 85 +2
Lines 3124 3182 +58
===========================================
+ Hits 2455 2522 +67
+ Misses 669 660 -9
Continue to review full report at Codecov.
|
* Add request fingerprinting method. 1) Fix some tests due to change in default cache directory 2) Fix event propogation using multiprocessing manager I/O error on closed resource is still an issue. Doesn't result in test error but a warning is thrown (tested on Python 3.8). * Separate ReplayTestCase which also removes need of dynamic plugin enable/disable need * Rename VCR to Replay * Deprecate list.txt, use fingerprint of the request as cached file name. 1) Temporarily disable cache response plugin with tls interception. These are broken due to fingerprint mismatch. For a https request, fingerprint must capture both CONNECT and then the sub-request state. * Refactor tls_interception_enabled, add no cover tags on abc classes * Add reference to issue#443
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP: DO NOT MERGE
This pull request contains all the changes related to the cache server plugin, which is currently maintained under "cache-server" branch. Pull request gives us a running CI/CD for changes happening in "cache-server" branch (also helps in early detection of merge conflict may arise). Any core changes will be patched separately leaving this PR only with changes related to cache server. See individual commits underneath for all the PRs.