-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement cache for files read operation
Implements [0]. Added new operations: * GET files/configuration * PUT files/configuration&readCache=<true|false> Also, - Metrics measurements are moved to file manager and operated from SafeFile. In this way, metrics references are lazily created once when file manager is created. This avoid error to create those references everytime a SafeFile is dynamically created when a new file is managed. SafeFile has now a file manager pointer reference to access increments for every counter. - Move close delay microseconds to write interface instead of store it as SafeFile member (also removed from json representation). This allows to change the delay for different operations in the same file, and eases the fact that read and write can be performed over it. - Fixed short/long term files close delay configuration in command-line: zero value was not accepted due to bug in numeric control. - Short term/long term identification has been changed from original procedure (compares original target value with final replaced) to a new way: check if there are variable patterns @{varname} regardless they are replaced or not. This is because one missing variable is not replaced instead of being replaced by empty value, and it seems more intuitive that: "target@{var_not_replaced}" is also short term, and a trick to force shorttermness: "/my/file@{shortterm}.txt". - README.md updated with benchmark and helpers scripts. Also, improved file targets description about short-term mode force procedure. - Update benchmark script to include cache configuration mode. True by default due to performance impact of not having it. - Remove delays in unit tests and component tests related to file manager, to speed up testing and make it more robust. [0] #63
- Loading branch information
1 parent
5c7202f
commit 93d539a
Showing
15 changed files
with
332 additions
and
148 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import pytest | ||
import json | ||
import time | ||
from conftest import ADMIN_FILES_URI, string2dict, FILE_GENERATION_PROVISION | ||
from conftest import ADMIN_FILES_URI, string2dict, FILE_MANAGER_PROVISION | ||
|
||
|
||
@pytest.mark.admin | ||
def test_001_i_want_to_get_process_files(h2ac_admin, admin_server_provision, h2ac_traffic): | ||
|
||
# Provision | ||
admin_server_provision(string2dict(FILE_GENERATION_PROVISION)) | ||
admin_server_provision(string2dict(FILE_MANAGER_PROVISION)) | ||
|
||
# Check file before traffic: skipped because the test could re-run | ||
#response = h2ac_admin.get(ADMIN_FILES_URI) | ||
#assert response["status"] == 204 | ||
|
||
# Send GET | ||
response = h2ac_traffic.get("/app/v1/foo/bar") | ||
|
||
# Check file | ||
response = h2ac_admin.get(ADMIN_FILES_URI) | ||
responseBodyRef = [{ "bytes":0, "path": "/tmp/example.txt", "state": "opened", "closeDelayUsecs": 1000000 }] | ||
h2ac_admin.assert_response__status_body_headers(response, 200, responseBodyRef) | ||
|
||
# Wait 2 seconds (long-term file closes in 1 second by default) | ||
time.sleep(2) | ||
|
||
h2ac_admin.assert_response__status_body_headers(response, 200, "hello") | ||
|
||
# # Check file | ||
# response = h2ac_admin.get(ADMIN_FILES_URI) | ||
# responseBodyRef = [{ "bytes":0, "path": "/tmp/example.txt", "state": "opened" }] | ||
# h2ac_admin.assert_response__status_body_headers(response, 200, responseBodyRef) | ||
# | ||
# # Wait 2 seconds (long-term file closes in 1 second by default) | ||
# time.sleep(2) | ||
# | ||
# Check file | ||
response = h2ac_admin.get(ADMIN_FILES_URI) | ||
responseBodyRef = [{ "bytes":5, "path": "/tmp/example.txt", "state": "closed", "closeDelayUsecs": 1000000 }] | ||
responseBodyRef = [{ "bytes":5, "path": "/tmp/example.txt", "state": "closed" }] | ||
h2ac_admin.assert_response__status_body_headers(response, 200, responseBodyRef) | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.