diff --git a/.github/workflows/iroha2-dev-pr.yml b/.github/workflows/iroha2-dev-pr.yml index 9a1aedc0f38..cb33a2f0449 100644 --- a/.github/workflows/iroha2-dev-pr.yml +++ b/.github/workflows/iroha2-dev-pr.yml @@ -17,7 +17,7 @@ concurrency: env: CARGO_TERM_COLOR: always - CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test" + IROHA_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test" DOCKER_COMPOSE_PATH: defaults TEST_DIR: "tmp/test" IROHA_BIN: "iroha" @@ -209,8 +209,8 @@ jobs: - name: Run Client CLI Tests working-directory: iroha_cli/pytests env: - CLIENT_CLI_BINARY: ../../${{ env.TEST_DIR }}/${{ env.IROHA_BIN }} - CLIENT_CLI_CONFIG: ../../${{ env.TEST_DIR }}/client.toml + IROHA_CLI_BINARY: ../../${{ env.TEST_DIR }}/${{ env.IROHA_BIN }} + IROHA_CLI_CONFIG: ../../${{ env.TEST_DIR }}/client.toml run: ${{ env.POETRY_PATH }} run pytest - name: Wipe docker-compose.yml containers if: always() diff --git a/iroha_cli/pytests/README.md b/iroha_cli/pytests/README.md index 874d92c46b4..64125b57410 100644 --- a/iroha_cli/pytests/README.md +++ b/iroha_cli/pytests/README.md @@ -66,8 +66,8 @@ The test model has the following structure: 3. Configure the tests by creating the following `.env` file in _this_ (`/iroha_cli/pytests/`) directory: ```shell - CLIENT_CLI_BINARY=/path/to/iroha_cli - CLIENT_CLI_CONFIG=/path/to/client.toml + IROHA_CLI_BINARY=/path/to/iroha_cli + IROHA_CLI_CONFIG=/path/to/client.toml TORII_API_PORT_MIN=8080 TORII_API_PORT_MAX=8083 ``` @@ -119,7 +119,7 @@ To do so, perform the following steps: 4. Proceed with _Step 2_ of the [Using Test Suites](#using-test-suites) instructions. > [!NOTE] -> Don't forget to specify the path to the directory created for the `iroha` binary and its `client.toml` configuration file (see Step 3) in the `CLIENT_CLI_DIR` variable of the `.env` file. +> Don't forget to specify the path to the directory created for the `iroha` binary and its `client.toml` configuration file (see Step 3) in the `IROHA_CLI_DIR` variable of the `.env` file. > For details, see [Tests Configuration](#tests-configuration) below. ### Poetry Configuration @@ -156,7 +156,7 @@ Tests are configured via environment variables. These variables can be optionall The variables: -- `CLIENT_CLI_DIR` — Specifies a path to a directory containing the `iroha` binary and its `client.toml` configuration file.\ +- `IROHA_CLI_DIR` — Specifies a path to a directory containing the `iroha` binary and its `client.toml` configuration file.\ Set to `/iroha_cli`, by default. - `TORII_API_PORT_MIN`/`TORII_API_PORT_MAX` — This pair specifies the range of local ports through which the Iroha 2 peers are deployed. A randomly selected port from the specified range is used for each test.\ Set to `8080` and `8083` respectively, by default. @@ -164,8 +164,8 @@ The variables: **Example**: ```shell -CLIENT_CLI_BINARY=/path/to/iroha_cli -CLIENT_CLI_CONFIG=/path/to/client.toml +IROHA_CLI_BINARY=/path/to/iroha_cli +IROHA_CLI_CONFIG=/path/to/client.toml TORII_API_PORT_MIN=8080 TORII_API_PORT_MAX=8083 ``` diff --git a/iroha_cli/pytests/common/settings.py b/iroha_cli/pytests/common/settings.py index 3593f91d0b7..176344b6dc9 100644 --- a/iroha_cli/pytests/common/settings.py +++ b/iroha_cli/pytests/common/settings.py @@ -11,10 +11,10 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -ROOT_DIR = os.environ.get("CLIENT_CLI_DIR", BASE_DIR) +ROOT_DIR = os.environ.get("IROHA_CLI_DIR", BASE_DIR) -PATH_CONFIG_CLIENT_CLI = os.environ["CLIENT_CLI_CONFIG"] -CLIENT_CLI_PATH = os.environ["CLIENT_CLI_BINARY"] +PATH_CONFIG_IROHA_CLI = os.environ["IROHA_CLI_CONFIG"] +IROHA_CLI_PATH = os.environ["IROHA_CLI_BINARY"] PEERS_CONFIGS_PATH = os.path.join(ROOT_DIR, "peers_configs") PORT_MIN = int(os.getenv("TORII_API_PORT_MIN", "8080")) diff --git a/iroha_cli/pytests/src/client_cli/__init__.py b/iroha_cli/pytests/src/client_cli/__init__.py index 417f746d612..79ead1cf183 100644 --- a/iroha_cli/pytests/src/client_cli/__init__.py +++ b/iroha_cli/pytests/src/client_cli/__init__.py @@ -2,12 +2,12 @@ This module initializes the Iroha client and configuration using environment variables. """ -from common.settings import PATH_CONFIG_CLIENT_CLI, PORT_MAX, PORT_MIN +from common.settings import PATH_CONFIG_IROHA_CLI, PORT_MAX, PORT_MIN from src.iroha_cli.iroha_cli import IrohaCli from src.iroha_cli.configuration import Config from src.iroha_cli.iroha import Iroha config = Config(PORT_MIN, PORT_MAX) -config.load(PATH_CONFIG_CLIENT_CLI) +config.load(PATH_CONFIG_IROHA_CLI) iroha_cli = IrohaCli(config) iroha = Iroha(config) diff --git a/iroha_cli/pytests/src/client_cli/client_cli.py b/iroha_cli/pytests/src/client_cli/client_cli.py index 06fab2b967a..364ba75865c 100644 --- a/iroha_cli/pytests/src/client_cli/client_cli.py +++ b/iroha_cli/pytests/src/client_cli/client_cli.py @@ -12,7 +12,7 @@ import allure # type: ignore from common.helpers import extract_hash, read_isi_from_json, write_isi_to_json -from common.settings import BASE_DIR, CLIENT_CLI_PATH, PATH_CONFIG_CLIENT_CLI, ROOT_DIR +from common.settings import BASE_DIR, IROHA_CLI_PATH, PATH_CONFIG_IROHA_CLI, ROOT_DIR from src.iroha_cli.configuration import Config @@ -21,8 +21,8 @@ class IrohaCli: A class to represent the Iroha client command line interface. """ - BASE_PATH = CLIENT_CLI_PATH - BASE_FLAGS = ["--config=" + PATH_CONFIG_CLIENT_CLI] + BASE_PATH = IROHA_CLI_PATH + BASE_FLAGS = ["--config=" + PATH_CONFIG_IROHA_CLI] def __init__(self, config: Config): """ diff --git a/iroha_cli/pytests/src/client_cli/configuration.py b/iroha_cli/pytests/src/client_cli/configuration.py index 09ff381c0df..d55bc79963d 100644 --- a/iroha_cli/pytests/src/client_cli/configuration.py +++ b/iroha_cli/pytests/src/client_cli/configuration.py @@ -29,23 +29,23 @@ def __init__(self, port_min, port_max): self.port_max = port_max self._envs = dict() - def load(self, path_config_client_cli): + def load(self, path_config_iroha_cli): """ Load the configuration from the given config file. - :param path_config_client_cli: The path to the configuration file. - :type path_config_client_cli: str + :param path_config_iroha_cli: The path to the configuration file. + :type path_config_iroha_cli: str :raises IOError: If the file does not exist. """ - if not os.path.exists(path_config_client_cli): - raise IOError(f"No config file found at {path_config_client_cli}") + if not os.path.exists(path_config_iroha_cli): + raise IOError(f"No config file found at {path_config_iroha_cli}") - if not os.path.isfile(path_config_client_cli): - raise IOError(f"The path is not a file: {path_config_client_cli}") + if not os.path.isfile(path_config_iroha_cli): + raise IOError(f"The path is not a file: {path_config_iroha_cli}") - with open(path_config_client_cli, "r", encoding="utf-8") as config_file: + with open(path_config_iroha_cli, "r", encoding="utf-8") as config_file: self._config = tomlkit.load(config_file) - self.file = path_config_client_cli + self.file = path_config_iroha_cli def generate_by_peers(self, peers_configs_dir): """ diff --git a/iroha_cli/pytests/src/client_cli/have.py b/iroha_cli/pytests/src/client_cli/have.py index 88bc2cb0a2a..98aaef76b00 100644 --- a/iroha_cli/pytests/src/client_cli/have.py +++ b/iroha_cli/pytests/src/client_cli/have.py @@ -150,4 +150,4 @@ def error(expected): :param expected: The expected error message. :return: True if the error is present, False otherwise. """ - return match.client_cli_have_error(expected=expected, actual=iroha_cli.stderr) + return match.iroha_cli_have_error(expected=expected, actual=iroha_cli.stderr) diff --git a/iroha_cli/pytests/src/client_cli/match.py b/iroha_cli/pytests/src/client_cli/match.py index 9f597495c5d..72f47d3ec4d 100644 --- a/iroha_cli/pytests/src/client_cli/match.py +++ b/iroha_cli/pytests/src/client_cli/match.py @@ -5,7 +5,7 @@ import allure # type: ignore -def client_cli_have_error(expected: str, actual: str): +def iroha_cli_have_error(expected: str, actual: str): """ Checks if the command-line client has the expected error. diff --git a/iroha_cli/pytests/test/accounts/test_accounts_query_filters.py b/iroha_cli/pytests/test/accounts/test_accounts_query_filters.py index d7668c8a01f..fc39df43808 100644 --- a/iroha_cli/pytests/test/accounts/test_accounts_query_filters.py +++ b/iroha_cli/pytests/test/accounts/test_accounts_query_filters.py @@ -9,9 +9,7 @@ def test_filter_by_domain(GIVEN_registered_account): def condition(): domain = GIVEN_registered_account.domain - with allure.step( - f"WHEN iroha_cli query accounts " f'in the "{domain}" domain' - ): + with allure.step(f"WHEN iroha_cli query accounts " f'in the "{domain}" domain'): accounts = iroha.list_filter( {"Identifiable": {"EndsWith": f"@{domain}"}} ).accounts() diff --git a/iroha_cli/pytests/test/accounts/test_register_accounts.py b/iroha_cli/pytests/test/accounts/test_register_accounts.py index b18057d61f7..1d70dd7d0fd 100644 --- a/iroha_cli/pytests/test/accounts/test_register_accounts.py +++ b/iroha_cli/pytests/test/accounts/test_register_accounts.py @@ -66,9 +66,9 @@ def test_register_account_with_invalid_character_in_key( with allure.step( "WHEN iroha_cli tries to register an account with invalid character in the key" ): - client_cli.register().account( + iroha_cli.register().account( signatory=GIVEN_key_with_invalid_character_in_key, domain=GIVEN_registered_domain.name, ) with allure.step("THEN iroha_cli should have the error"): - client_cli.should(have.error(Stderr.INVALID_CHARACTER.value)) + iroha_cli.should(have.error(Stderr.INVALID_CHARACTER.value)) diff --git a/iroha_cli/pytests/test/conftest.py b/iroha_cli/pytests/test/conftest.py index 6bb5e6d8de3..6de905a7793 100644 --- a/iroha_cli/pytests/test/conftest.py +++ b/iroha_cli/pytests/test/conftest.py @@ -71,9 +71,7 @@ def GIVEN_registered_account(GIVEN_registered_domain, GIVEN_public_key): with allure.step( f'GIVEN the account "{GIVEN_public_key}" in the "{GIVEN_registered_domain.name}" domain' ): - iroha_cli.register().account( - signatory=account.signatory, domain=account.domain - ) + iroha_cli.register().account(signatory=account.signatory, domain=account.domain) return account @@ -145,7 +143,7 @@ def GIVEN_numeric_asset_for_account( domain=asset.definition.domain, type_=asset.definition.type_, ) - client_cli.mint().asset( + iroha_cli.mint().asset( account=account, asset_definition=asset.definition, value_of_type=asset.value, @@ -168,7 +166,7 @@ def GIVEN_registered_asset_definition_with_numeric_type( f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' f'in the "{GIVEN_registered_domain.name}" domain' ): - client_cli.register().asset_definition( + iroha_cli.register().asset_definition( asset=asset_def.name, domain=asset_def.domain, type_=asset_def.type_, @@ -190,7 +188,7 @@ def GIVEN_minted_asset_quantity( definition=GIVEN_registered_asset_definition_with_numeric_type, value=GIVEN_numeric_value, ) - client_cli.mint().asset( + iroha_cli.mint().asset( account=asset.account, asset_definition=asset.definition, value_of_type=asset.value, @@ -212,7 +210,7 @@ def GIVEN_registered_asset_definition_with_store_type( f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' f'in the "{GIVEN_registered_domain.name}" domain' ): - client_cli.register().asset_definition( + iroha_cli.register().asset_definition( asset=asset_def.name, domain=asset_def.domain, type=asset_def.type, diff --git a/iroha_cli/pytests/test/domains/test_register_domains.py b/iroha_cli/pytests/test/domains/test_register_domains.py index 8227fd6fa9d..1d5ba64af23 100644 --- a/iroha_cli/pytests/test/domains/test_register_domains.py +++ b/iroha_cli/pytests/test/domains/test_register_domains.py @@ -49,7 +49,7 @@ def test_register_existing_domain_uppercase_with_uppercase_letter( f"WHEN iroha_cli registers an existing domain, " f'but with uppercase letter "{GIVEN_registered_domain_with_uppercase_letter.name}"' ): - client_cli.register().domain(GIVEN_registered_domain_with_uppercase_letter.name) + iroha_cli.register().domain(GIVEN_registered_domain_with_uppercase_letter.name) with allure.step( f'THEN Iroha should have the domain name "{GIVEN_registered_domain_with_uppercase_letter.name}"' ): @@ -61,7 +61,7 @@ def test_register_one_letter_domain(GIVEN_random_character): with allure.step( f'WHEN iroha_cli registers the one letter domain "{GIVEN_random_character}"' ): - client_cli.register().domain(GIVEN_random_character) + iroha_cli.register().domain(GIVEN_random_character) with allure.step(f'THEN Iroha should have the domain "{GIVEN_random_character}"'): iroha.should(have.domain(GIVEN_random_character)) @@ -72,11 +72,11 @@ def test_register_domain_with_reserved_character(GIVEN_string_with_reserved_char f'WHEN iroha_cli registers a domain "' f'{GIVEN_string_with_reserved_character}" with reserved characters' ): - client_cli.register().domain(GIVEN_string_with_reserved_character) + iroha_cli.register().domain(GIVEN_string_with_reserved_character) with allure.step( f'THEN iroha_cli should has the domain error: "{Stderr.RESERVED_CHARACTER.value}"' ): - client_cli.should(have.error(Stderr.RESERVED_CHARACTER.value)) + iroha_cli.should(have.error(Stderr.RESERVED_CHARACTER.value)) @allure.label("sdk_test_id", "register_domain_with_whitespaces") @@ -84,8 +84,8 @@ def test_register_domain_with_whitespaces(GIVEN_string_with_whitespaces): with allure.step( f'WHEN iroha_cli registers a domain "{GIVEN_string_with_whitespaces}" with whitespaces' ): - client_cli.register().domain(GIVEN_string_with_whitespaces) + iroha_cli.register().domain(GIVEN_string_with_whitespaces) with allure.step( f'THEN iroha_cli should has the domain error: "{Stderr.WHITESPACES.value}"' ): - client_cli.should(have.error(Stderr.WHITESPACES.value)) + iroha_cli.should(have.error(Stderr.WHITESPACES.value))