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

Update rest gw streaming test #810

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 6 additions & 18 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,13 @@ jobs:
file: 'neofs-s3-authmate-linux-amd64'
target: 'neofs-testcases/neofs-s3-authmate'

- name: Checkout neofs-rest-gw repository
uses: actions/checkout@v4
- name: Download latest stable neofs-rest-gw
uses: dsaltares/[email protected]
with:
repository: nspcc-dev/neofs-rest-gw
ref: v0.9.0
path: neofs-rest-gw

- name: Build neofs-rest-gw
timeout-minutes: 5
run: |
make all
echo "$(pwd)/bin" >> $GITHUB_PATH
working-directory: neofs-rest-gw

- name: Copy built binaries
timeout-minutes: 30
run: |
cp ../neofs-rest-gw/bin/neofs-rest-gw .
working-directory: neofs-testcases
repo: 'nspcc-dev/neofs-rest-gw'
version: 'tags/v0.10.0'
file: 'neofs-rest-gw-linux-amd64'
target: 'neofs-testcases/neofs-rest-gw'

- name: Download latest stable neo-go
uses: dsaltares/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ neofs-node
neofs-rest-gw
neofs-s3-authmate
neofs-s3-gw
neofs_env_*.zip
temp_files.zip
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ binaries:

neofs_rest_gw:
repo: 'nspcc-dev/neofs-rest-gw'
version: 'v0.9.0'
version: 'v0.10.0'
file: 'neofs-rest-gw-linux-amd64'

neo_go:
Expand Down
21 changes: 18 additions & 3 deletions pytest_tests/tests/services/rest_gate/test_rest_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import allure
import pytest
import requests
from helpers.container import create_container
from helpers.file_helper import generate_file
from helpers.rest_gate import upload_via_rest_gate
from helpers.wellknown_acl import PUBLIC_ACL
from rest_gw.rest_utils import get_object_and_verify_hashes
from neofs_env.neofs_env_test_base import NeofsEnvTestBase
from rest_gw.rest_utils import get_object_and_verify_hashes

logger = logging.getLogger("NeoLogger")

Expand Down Expand Up @@ -54,7 +54,22 @@ def test_object_can_be_put_get_by_streaming(self, object_size: int, gw_endpoint)
file_path = generate_file(object_size)

with allure.step("Put objects and Get object and verify hashes [ get/$CID/$OID ]"):
oid = upload_via_rest_gate(cid=cid, path=file_path, endpoint=gw_endpoint)
# https://docs.python-requests.org/en/latest/user/advanced/#streaming-uploads
with open(file_path, "rb") as file:
resp = requests.post(f"{gw_endpoint}/objects/{cid}", data=file)

if not resp.ok:
raise Exception(
f"""Failed to stream object via REST gate:
request: {resp.request.path_url},
response: {resp.text},
status code: {resp.status_code} {resp.reason}"""
)

assert resp.json().get("object_id"), f"OID found in response {resp}"

oid = resp.json().get("object_id")

get_object_and_verify_hashes(
oid=oid,
file_name=file_path,
Expand Down
Loading