Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

env: add attributes for storage nodes; config: include data files for published package #85

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "neofs-testlib"
version = "1.1.15"
version = "1.1.17"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely need double grade?

Copy link
Contributor Author

@evgeniiz321 evgeniiz321 Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there was a problem and I needed to manually update the version in pypi, so now the latest is actually 1.1.16.

description = "Building blocks and utilities to facilitate development of automated tests for NeoFS system"
readme = "README.md"
authors = [{ name = "NSPCC", email = "info@nspcc.ru" }]
Expand Down Expand Up @@ -50,7 +50,7 @@ line-length = 100
target-version = ["py310"]

[tool.bumpver]
current_version = "1.1.15"
current_version = "1.1.17"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "Bump version {old_version} -> {new_version}"
commit = true
Expand All @@ -60,3 +60,12 @@ push = false
[tool.bumpver.file_patterns]
"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"']
"src/neofs_testlib/__init__.py" = ["{version}"]

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"neofs_testlib.env.templates" = ["*.yaml", "*.crt", "*.key"]
2 changes: 1 addition & 1 deletion src/neofs_testlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.15"
__version__ = "1.1.17"
20 changes: 16 additions & 4 deletions src/neofs_testlib/env/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ def deploy_inner_ring_node(self):
self.inner_ring_nodes.append(new_inner_ring_node)

@allure.step("Deploy storage node")
def deploy_storage_nodes(self, count=1):
def deploy_storage_nodes(self, count=1, attrs: Optional[dict] = None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may be not very connvenient to use with raw dictionary imo, and with separated count. Some settings like LOCODE are quite interpretable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example is needed, not sure if I understand you correctly

logger.info(f"Going to deploy {count} storage nodes")
deploy_threads = []
for _ in range(count):
new_storage_node = StorageNode(self)
for idx in range(count):
attrs_list = None
if attrs:
attrs_list = attrs.get(idx, None)
new_storage_node = StorageNode(self, attrs=attrs_list)
self.storage_nodes.append(new_storage_node)
deploy_threads.append(
threading.Thread(target=new_storage_node.start, args=(len(self.storage_nodes),))
Expand Down Expand Up @@ -198,7 +201,15 @@ def load(cls, persisted_path: str) -> "NeoFSEnv":
def simple(cls) -> "NeoFSEnv":
neofs_env = NeoFSEnv()
neofs_env.deploy_inner_ring_node()
neofs_env.deploy_storage_nodes(count=4)
neofs_env.deploy_storage_nodes(
count=4,
attrs={
0: ["UN-LOCODE:RU MOW", "Price:22"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different prices are doubtful to be the default setup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values are from the current static dev-env. And since current tests rely on this dev-env, it is considered as the default. Actually, this code can be moved to testcases dir, maybe I will do it in the future. Cause this lib should provide only the basic blocks.

1: ["UN-LOCODE:RU LED", "Price:33"],
2: ["UN-LOCODE:SE STO", "Price:11"],
3: ["UN-LOCODE:FI HEL", "Price:44"]
}
)
neofs_env.deploy_s3_gw()
neofs_env.deploy_http_gw()
return neofs_env
Expand Down Expand Up @@ -366,6 +377,7 @@ def __str__(self):
Storage node:
- Endpoint: {self.endpoint}
- Control gRPC endpoint: {self.control_grpc_endpoint}
- Attributes: {self.attrs}
- STDOUT: {self.stdout}
- STDERR: {self.stderr}
"""
Expand Down
Loading