Skip to content
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

[WIP] Argument caching #442

Merged
merged 6 commits into from
Apr 18, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
TST check that _gc works for saved arguments
  • Loading branch information
kmike committed Apr 15, 2016
commit c6c0f25e35a0cc324cb90742b97bc5c487ebe7a6
15 changes: 15 additions & 0 deletions splash/tests/test_argument_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class RenderHtmlArgumentCachingTest(BaseRenderTest):
endpoint = 'render.html'

def test_cache_url(self):
# make a save_args request
resp = self.request({
"url": self.mockurl('jsrender'),
"wait": 0.5,
Expand All @@ -19,11 +20,25 @@ def test_cache_url(self):
self.assertStatusCode(resp, 200)
self.assertIn("After", resp.text)

# use load_args to avoid sending parameter values
header = resp.headers['X-Splash-Saved-Arguments']
resp2 = self.request({"load_args": header})
self.assertStatusCode(resp2, 200)
assert resp2.text == resp.text

# clear cache
resp3 = self.post({}, endpoint="_gc")
self.assertStatusCode(resp3, 200)
data = resp3.json()
assert data['cached_args_removed'] >= 2
assert data['pyobjects_collected'] > 0
assert data['status'] == 'ok'

# check that argument cache is cleared
resp4 = self.request({"load_args": header})
data = self.assertJsonError(resp4, 498, 'ExpiredArguments')
assert set(data['info']['expired']) == {'wait', 'url'}


class ArgumentCachingTest(BaseLuaRenderTest):
request_handler = JsonPostRequestHandler
Expand Down