Add delays to http gateway tests
There were 2 delays added: - Waiting for GC pass is driven by system design. - Waiting after HTTP upload is just termporary workaround. Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
08081a8629
commit
18e87e3a13
1 changed files with 14 additions and 5 deletions
|
@ -5,7 +5,7 @@ from time import sleep
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
from common import COMPLEX_OBJ_SIZE
|
from common import COMPLEX_OBJ_SIZE, SHARD_0_GC_SLEEP
|
||||||
from container import create_container
|
from container import create_container
|
||||||
from epoch import get_epoch, tick_epoch
|
from epoch import get_epoch, tick_epoch
|
||||||
from python_keywords.http_gate import (get_via_http_curl, get_via_http_gate,
|
from python_keywords.http_gate import (get_via_http_curl, get_via_http_gate,
|
||||||
|
@ -14,12 +14,14 @@ from python_keywords.http_gate import (get_via_http_curl, get_via_http_gate,
|
||||||
from python_keywords.neofs_verbs import get_object, put_object
|
from python_keywords.neofs_verbs import get_object, put_object
|
||||||
from python_keywords.storage_policy import get_nodes_without_object
|
from python_keywords.storage_policy import get_nodes_without_object
|
||||||
from python_keywords.utility_keywords import generate_file, get_file_hash
|
from python_keywords.utility_keywords import generate_file, get_file_hash
|
||||||
|
from utility import robot_time_to_int
|
||||||
from wellknown_acl import PUBLIC_ACL
|
from wellknown_acl import PUBLIC_ACL
|
||||||
|
|
||||||
logger = logging.getLogger('NeoLogger')
|
logger = logging.getLogger('NeoLogger')
|
||||||
|
|
||||||
CLEANUP_TIMEOUT = 10
|
# For some reason object uploaded via http gateway is not immediately available for downloading
|
||||||
|
# Until this issue is resolved we are waiting for some time before attempting to read an object
|
||||||
|
OBJECT_UPLOAD_DELAY = 10
|
||||||
|
|
||||||
@allure.link('https://github.com/nspcc-dev/neofs-http-gw#neofs-http-gateway', name='neofs-http-gateway')
|
@allure.link('https://github.com/nspcc-dev/neofs-http-gw#neofs-http-gateway', name='neofs-http-gateway')
|
||||||
@allure.link('https://github.com/nspcc-dev/neofs-http-gw#uploading', name='uploading')
|
@allure.link('https://github.com/nspcc-dev/neofs-http-gw#uploading', name='uploading')
|
||||||
|
@ -117,6 +119,8 @@ class TestHttpGate:
|
||||||
headers = self._attr_into_header(attributes)
|
headers = self._attr_into_header(attributes)
|
||||||
oid = upload_via_http_gate(cid=cid, path=file_path, headers=headers)
|
oid = upload_via_http_gate(cid=cid, path=file_path, headers=headers)
|
||||||
|
|
||||||
|
sleep(OBJECT_UPLOAD_DELAY)
|
||||||
|
|
||||||
self.get_object_by_attr_and_verify_hashes(oid, file_path, cid, attributes)
|
self.get_object_by_attr_and_verify_hashes(oid, file_path, cid, attributes)
|
||||||
|
|
||||||
@allure.title('Test Expiration-Epoch in HTTP header')
|
@allure.title('Test Expiration-Epoch in HTTP header')
|
||||||
|
@ -135,7 +139,7 @@ class TestHttpGate:
|
||||||
with allure.step('Put objects using HTTP with attribute Expiration-Epoch'):
|
with allure.step('Put objects using HTTP with attribute Expiration-Epoch'):
|
||||||
oids.append(upload_via_http_gate(cid=cid, path=file_path, headers=headers))
|
oids.append(upload_via_http_gate(cid=cid, path=file_path, headers=headers))
|
||||||
|
|
||||||
assert len(oids) == len(epochs), 'Expected all objects has been put successfully'
|
assert len(oids) == len(epochs), 'Expected all objects have been put successfully'
|
||||||
|
|
||||||
with allure.step('All objects can be get'):
|
with allure.step('All objects can be get'):
|
||||||
for oid in oids:
|
for oid in oids:
|
||||||
|
@ -143,7 +147,10 @@ class TestHttpGate:
|
||||||
|
|
||||||
for expired_objects, not_expired_objects in [(oids[:1], oids[1:]), (oids[:2], oids[2:])]:
|
for expired_objects, not_expired_objects in [(oids[:1], oids[1:]), (oids[:2], oids[2:])]:
|
||||||
tick_epoch()
|
tick_epoch()
|
||||||
sleep(CLEANUP_TIMEOUT)
|
|
||||||
|
# Wait for GC, because object with expiration is counted as alive until GC removes it
|
||||||
|
with allure.step('Wait until GC completes on storage nodes'):
|
||||||
|
sleep(robot_time_to_int(SHARD_0_GC_SLEEP))
|
||||||
|
|
||||||
for oid in expired_objects:
|
for oid in expired_objects:
|
||||||
self.try_to_get_object_and_expect_error(
|
self.try_to_get_object_and_expect_error(
|
||||||
|
@ -168,6 +175,8 @@ class TestHttpGate:
|
||||||
upload_via_http_gate(cid=cid, path=file_path_simple, headers=headers1)
|
upload_via_http_gate(cid=cid, path=file_path_simple, headers=headers1)
|
||||||
upload_via_http_gate(cid=cid, path=file_path_large, headers=headers2)
|
upload_via_http_gate(cid=cid, path=file_path_large, headers=headers2)
|
||||||
|
|
||||||
|
sleep(OBJECT_UPLOAD_DELAY)
|
||||||
|
|
||||||
dir_path = get_via_zip_http_gate(cid=cid, prefix=common_prefix)
|
dir_path = get_via_zip_http_gate(cid=cid, prefix=common_prefix)
|
||||||
|
|
||||||
with allure.step('Verify hashes'):
|
with allure.step('Verify hashes'):
|
||||||
|
|
Loading…
Reference in a new issue