Giter VIP home page Giter VIP logo

neofs-testcases's Introduction

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 [email protected]: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 [email protected]: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

  4. Clone neofs-dev-env git clone [email protected]: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.10
python3.10-dev
python3.10-venv
libssl-dev
awscli version 2

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

  1. Fix OpenSSL ripemd160

Hashlib uses OpenSSL for ripemd160 and apparently OpenSSL disabled some older crypto algos around version 3.0 in November 2021. All the functions are still there but require manual enabling. See openssl/openssl#16994

But we use ripemd160 for tests. For ripemd160 to be supported, make sure that the config file /usr/lib/ssl/openssl.cnf contains following lines:

openssl_conf = openssl_init

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1
  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.

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.

neofs-testcases's People

Contributors

vvarg229 avatar roman-khimov avatar aprasolova avatar vdomnich-yadro avatar elichin avatar yadro-vavdeev avatar dansingjulia avatar abereziny avatar anikeev-yadro avatar anatoly-bogatyrev avatar alipayy avatar vkarak1 avatar dependabot[bot] avatar alexchetaev avatar alexvanin avatar evgeniiz321 avatar carpawell avatar cthulhu-rider avatar acheyda avatar fyrchik avatar karmadim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.