Skip to content

Commit

Permalink
tests: adapt rest gw tests to update network info
Browse files Browse the repository at this point in the history
closes #882

Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Oct 25, 2024
1 parent 4a25bd2 commit 9271e88
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ jobs:
make build
working-directory: xk6-neofs

- name: Checkout neofs-rest-gw repository
uses: actions/checkout@v4
with:
repository: nspcc-dev/neofs-rest-gw
ref: master
path: neofs-rest-gw

- name: Build neofs-rest-gw
run: |
make all
working-directory: neofs-rest-gw

- name: Copy and chmod built neofs-rest-gw
timeout-minutes: 30
run: |
cp ../neofs-rest-gw/bin/* .
sudo chmod a+x neofs-rest-gw
working-directory: neofs-testcases

- name: Prepare venv
id: prepare_venv
timeout-minutes: 30
Expand Down
7 changes: 7 additions & 0 deletions neofs-testlib/neofs_testlib/env/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,13 @@ def _launch_process(self):
env=rest_gw_env,
)

def _get_version(self) -> str:
raw_version_output = self.neofs_env._run_single_command(self.neofs_env.neofs_rest_gw_path, "--version")
for line in raw_version_output.splitlines():
if "Version:" in line:
return line.split("Version:")[1].strip()
return ""


class XK6:
def __init__(self, neofs_env: NeoFSEnv):
Expand Down
16 changes: 13 additions & 3 deletions pytest_tests/tests/services/rest_gate/test_rest_system_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from helpers.neofs_verbs import get_netmap_netinfo, get_object_from_random_node, head_object
from helpers.rest_gate import (
attr_into_str_header,
get_epoch_duration_via_rest_gate,
try_to_get_object_and_expect_error,
upload_via_rest_gate,
)
Expand Down Expand Up @@ -251,7 +252,10 @@ def test_http_attr_priority_dur_timestamp(
):
self.tick_epochs_and_wait(1)
epoch_count = 2
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
if self.neofs_env.rest_gw._get_version() <= "0.11.0":
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
else:
expected_epoch = int(get_epoch_duration_via_rest_gate(gw_endpoint)) + epoch_count
logger.info(
f"epoch duration={epoch_duration}, current_epoch= {neofs_epoch.get_epoch(self.neofs_env)} expected_epoch {expected_epoch}"
)
Expand Down Expand Up @@ -307,7 +311,10 @@ def test_http_attr_priority_timestamp_rfc(
):
self.tick_epochs_and_wait(1)
epoch_count = 2
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
if self.neofs_env.rest_gw._get_version() <= "0.11.0":
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
else:
expected_epoch = int(get_epoch_duration_via_rest_gate(gw_endpoint)) + epoch_count
logger.info(
f"epoch duration={epoch_duration}, current_epoch= {neofs_epoch.get_epoch(self.neofs_env)} expected_epoch {expected_epoch}"
)
Expand Down Expand Up @@ -363,7 +370,10 @@ def test_http_rfc_object_unavailable_after_expir(
):
self.tick_epochs_and_wait(1)
epoch_count = 2
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
if self.neofs_env.rest_gw._get_version() <= "0.11.0":
expected_epoch = neofs_epoch.get_epoch(self.neofs_env) + epoch_count
else:
expected_epoch = int(get_epoch_duration_via_rest_gate(gw_endpoint)) + epoch_count
logger.info(
f"epoch duration={epoch_duration}, current_epoch= {neofs_epoch.get_epoch(self.neofs_env)} expected_epoch {expected_epoch}"
)
Expand Down

0 comments on commit 9271e88

Please sign in to comment.