FrostFS integration testcases
Find a file
Dmitriy Zayakin 8e5793e545
Some checks reported warnings
DCO check / Commits Check (pull_request) Has been cancelled
[#298] Add set mode shards in teardown test ec
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
2024-09-03 15:09:21 +03:00
.github/workflows [#272] Update CODEOWNERS 2024-07-18 15:01:09 +03:00
pytest_tests [#298] Add set mode shards in teardown test ec 2024-09-03 15:09:21 +03:00
venv/local-pytest Change all imports to imports from root and remove robot 2023-02-28 11:48:06 +01:00
.flake8 Add helper function to wait for GC pass on storage nodes 2022-08-05 13:29:31 +03:00
.gitignore [#216] Enable http tests, since we remove them in plugin 2024-04-16 15:17:49 +03:00
.pre-commit-config.yaml [#293] Integrate allure-validator into pre-commit hook 2024-08-27 16:25:23 +00:00
CODEOWNERS [#272] Update CODEOWNERS 2024-07-18 15:01:09 +03:00
CONTRIBUTING.md [#142] Renamed Github to Gitea in links 2023-11-15 12:21:26 +03:00
LICENSE [#397] Prepare public release 2022-11-02 13:13:28 +03:00
Makefile Fix method name 2023-07-27 12:05:49 +03:00
pyproject.toml [#262] Added new test for EC policy 2024-07-01 15:41:14 +00:00
pytest.ini [#278] Add object operation tests with -g flag 2024-07-31 10:17:27 +03:00
README.md [#142] Renamed Github to Gitea in links 2023-11-15 12:21:26 +03:00
requirements.txt [#277] Updates related to testing platform 2024-07-26 13:28:19 +00:00
requirements_dev.txt Added code validation targets 2023-07-18 20:50:15 +03:00
venv_template.mk Remove neofs-keywords dependency and fix make venv.local-pytest 2022-11-10 18:06: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 Pytest Framework.

Testcases execution

Initial preparation

  1. Install frostfs-cli

    • git clone git@git.frostfs.info:TrueCloudLab/frostfs-node.git
    • cd frostfs-node
    • make
    • sudo cp bin/frostfs-cli /usr/local/bin/frostfs-cli
  2. Install frostfs-s3-authmate

    • git clone git@git.frostfs.info:TrueCloudLab/frostfs-s3-gw.git
    • cd frostfs-s3-gw
    • make
    • sudo cp bin/frostfs-s3-authmate /usr/local/bin/frostfs-s3-authmate
  3. Install neo-go

    • git clone git@git.frostfs.info:TrueCloudLab/neo-go.git
    • cd neo-go
    • git checkout v0.101.0 (or the current version in the frostfs-dev-env)
    • make
    • sudo cp bin/neo-go /usr/local/bin/neo-go or download binary from releases: https://git.frostfs.info/TrueCloudLab/neo-go/releases
  4. Clone frostfs-dev-env git clone git@git.frostfs.info:TrueCloudLab/frostfs-dev-env.git

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

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

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

  1. Prepare virtualenv
$ make venv
$ source venv.frostfs-testcases-3.10/bin/activate
  1. 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 frostfs-testcases. For example, you can place it under /tmp path.

Contributing

Feel free to contribute to this project after reading the contributing guidelines.

Before starting to work on a certain topic, create a new issue first, describing the feature/topic you are going to implement.

License

Pytest marks

Custom pytest marks used in tests:

  • sanity - Tests must be runs in sanity testruns.
  • smoke - Tests must be runs in smoke testruns.