FrostFS integration testcases
Find a file
anikeev-yadro 31d43fbba9 Fix timeout for node returned wait
Signed-off-by: anikeev-yadro <a.anikeev@yadro.com>
2022-10-13 13:17:54 +03:00
.github/workflows [nspcc-dev/nspcc-infra#840]: Add DCO check 2022-09-22 19:21:21 +03:00
build_assets [#145][#153]: added neofs-keywords as a module 2022-02-17 14:34:47 +03:00
neofs-keywords@5865009936 Fix node management tests 2022-08-05 13:29:30 +03:00
pytest_tests [#312] Add new multipart upload test 2022-10-13 10:20:44 +03:00
robot Fix timeout for node returned wait 2022-10-13 13:17:54 +03:00
venv/local-pytest removed robot tests 2022-08-17 14:20:41 +03:00
.flake8 Add helper function to wait for GC pass on storage nodes 2022-08-05 13:29:31 +03:00
.gitignore [#341] Remove duplication of wallet passwords in configs 2022-10-06 12:53:47 +04:00
.gitmodules fixes and refactoring in HTTP and S3 tests 2022-03-14 10:16:06 +03:00
.pre-commit-config.yaml Add black formatter and isort into a precommit hook 2022-09-21 12:18:17 +04:00
Makefile Cleanup sbercloud config 2022-08-05 13:31:22 +03:00
pyproject.toml [#314] Format all files with black and isort 2022-09-30 13:45:25 +04:00
README.md Add black formatter and isort into a precommit hook 2022-09-21 12:18:17 +04:00
requirements.txt [#103] Test to check eACL filter keys for objects 2021-11-24 16:54:00 +03:00
venv_template.mk python3.8 -> python3.9 in venv.localtest 2022-05-16 12:58:57 +03:00

Testcases structure

Tests written with PyTest Framework are located under pytest_tests/testsuites directory.

These tests rely on resources and utility modules that have been originally developed for Robot Framework:

robot/resources/files - static files that are used in tests' commands.

robot/resources/lib/ - common Python libraries that provide utility functions used as building blocks in tests.

robot/variables/ - constants and configuration variables for tests.

Testcases execution

Initial preparation

  1. Install neofs-cli

    • git clone git@github.com:nspcc-dev/neofs-node.git
    • cd neofs-node
    • make
    • sudo cp bin/neofs-cli /usr/local/bin/neofs-cli
  2. Install neofs-authmate

    • git clone git@github.com:nspcc-dev/neofs-s3-gw.git
    • cd neofs-s3-gw
    • make
    • sudo cp bin/neofs-authmate /usr/local/bin/neofs-authmate
  3. Install neo-go

    • git clone git@github.com:nspcc-dev/neo-go.git
    • cd neo-go
    • git checkout v0.92.0 (or the current version in the neofs-dev-env)
    • make
    • sudo cp bin/neo-go /usr/local/bin/neo-go or download binary from releases: https://github.com/nspcc-dev/neo-go/releases
  4. Clone neofs-dev-env git clone git@github.com:nspcc-dev/neofs-dev-env.git

Note that we expect neofs-dev-env to be located under the <testcases_root_dir>/../neofs-dev-env directory. If you put this repo in any other place, manually set the full path to neofs-dev-env in the environment variable DEVENV_PATH at this step.

  1. Make sure you have installed all of the following prerequisites on your machine
make
python3.9
python3.9-dev
libssl-dev

As we use neofs-dev-env, you'll also need to install prerequisites of this repository.

  1. Prepare virtualenv
$ make venv.local-pytest
$ . venv.local-pytest/bin/activate
  1. Setup pre-commit hooks to run code formatters on staged files before you run a git commit command:
$ pre-commit install

Optionally you might want to integrate code formatters with your code editor to apply formatters to code files as you go:

  • isort is supported by PyCharm, VS Code. Plugins exist for other IDEs/editors as well.
  • black can be integrated with multiple editors, please, instructions are available here.
  1. Install Allure CLI

Allure CLI installation is not an easy task, so a better option might be to run allure from docker container (please, refer to p.2 of the next section for instructions).

To install Allure CLI you may take one of the following ways:

$ wget https://github.com/allure-framework/allure2/releases/download/2.18.1/allure_2.18.1-1_all.deb
$ sudo apt install ./allure_2.18.1-1_all.deb

You also need the default-jre package installed.

If none of the options worked for you, please complete the instruction with your approach.

Run and get report

  1. Run tests

Make sure that the virtualenv is activated, then execute the following command to run a singular test suite or all the suites in the directory

$ pytest --alluredir my-allure-123 pytest_tests/testsuites/object/test_object_api.py
$ pytest --alluredir my-allure-123 pytest_tests/testsuites/
  1. Generate report

If you opted to install Allure CLI, you can generate a report using the command allure generate. The web representation of the report will be under allure-report directory:

$ allure generate my-allure-123
$ ls allure-report/
app.js  data  export  favicon.ico  history  index.html  plugins  styles.css  widgets

To inspect the report in a browser, run

$ allure serve my-allure-123

If you prefer to run allure from Docker, you can use the following command:

$ mkdir -p $PWD/allure-reports 
$ docker run -p 5050:5050 -e CHECK_RESULTS_EVERY_SECONDS=30 -e KEEP_HISTORY=1 \
    -v $PWD/my-allure-123:/app/allure-results \
    -v $PWD/allure-reports:/app/default-reports \
    frankescobar/allure-docker-service

Then, you can check the allure report in your browser by this link

NOTE: feel free to select a different location for allure-reports directory, there is no requirement to have it inside neofs-testcases. For example, you can place it under /tmp path.

Code style

The names of Python variables, functions and classes must comply with PEP8 rules, in particular:

  • Name of a variable/function must be in snake_case (lowercase, with words separated by underscores as necessary to improve readability).
  • Name of a global variable must be in UPPER_SNAKE_CASE, the underscore (_) symbol must be used as a separator between words.
  • Name of a class must be in PascalCase (the first letter of each compound word in a variable name is capitalized).
  • Names of other variables should not be ended with the underscore symbol.

Line length limit is set as 100 characters.

Imports should be ordered in accordance with isort default rules.