Skip to content

Commit

Permalink
Tests for replace_objects option
Browse files Browse the repository at this point in the history
Signed-off-by: MaxGelbakhiani <[email protected]>
  • Loading branch information
MaxGelbakhiani committed Mar 19, 2024
1 parent 3173757 commit 5eca1b9
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
URL_PREFIX: ${{ env.URL_PREFIX }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False

- name: Run tests
env:
Expand All @@ -96,6 +98,8 @@ jobs:
LIFETIME: ${{ vars.LIFETIME }}
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
URL_PREFIX: ${{ env.URL_PREFIX }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False

- name: Run tests
env:
Expand Down Expand Up @@ -136,6 +140,8 @@ jobs:
LIFETIME: ${{ vars.LIFETIME }}
PATH_TO_FILES_DIR: ${{ env.PREFIX_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False

- name: Run tests
env:
Expand All @@ -144,3 +150,56 @@ jobs:
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL" --report_dir="$REPORT_DIR"
working-directory: ./tests

- name: Prepare directory name for tests with object by object replacement
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "REPL_DATA_DIR=${{ github.run_number }}-$TIMESTAMP-$(uuidgen)-obj-by-obj-replacement" >> $GITHUB_ENV
- name: Create a directory tree for tests with objects replacement
shell: bash
run: |
mkdir "$REPL_DATA_DIR"
- name: Move files to the directory tree for tests with url prefix
shell: bash
env:
SOURCE_DIR: ${{ env.TESTS_DATA_DIR }}
DEST_DIR: ${{ env.REPL_DATA_DIR }}
run: |
rsync -av "$SOURCE_DIR" "$DEST_DIR"
- name: Modify test data
shell: bash
env:
DATA_DIR: ${{ env.REPL_DATA_DIR }}
run: |
"find $DATA_DIR -type f -name '*.txt' -exec sed -i '$ s/$/_replaced_obj_by_obj/' {} +"
working-directory: ${{ env.GITHUB_WORKSPACE }}

- name: tmate session
if: always()
uses: mxschmitt/action-tmate@v3

- name: Run gh-push-to-neofs with objects replacement
id: gh_push_to_neofs_with_replace_objects
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
PATH_TO_FILES_DIR: ${{ env.REPL_DATA_DIR }}
REPLACE_OBJECTS: True
REPLACE_CONTAINER_CONTENTS: False

- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_with_url_prefix.outputs.OUTPUT_CONTAINER_URL }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL"
working-directory: ./tests

0 comments on commit 5eca1b9

Please sign in to comment.