Updates for local dev env runs

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2022-12-23 11:52:05 +03:00 committed by abereziny
parent 5c4f6b6a7d
commit 422636f68b
3 changed files with 43 additions and 2 deletions

View file

@ -7,6 +7,8 @@ hosts:
container_name: s01 container_name: s01
config_path: ../neofs-dev-env/services/storage/.storage.env config_path: ../neofs-dev-env/services/storage/.storage.env
wallet_path: ../neofs-dev-env/services/storage/wallet01.json wallet_path: ../neofs-dev-env/services/storage/wallet01.json
local_config_path: ./TemporaryDir/empty-password.yml
local_wallet_path: ../neofs-dev-env/services/storage/wallet01.json
wallet_password: "" wallet_password: ""
volume_name: storage_storage_s01 volume_name: storage_storage_s01
rpc_endpoint: s01.neofs.devenv:8080 rpc_endpoint: s01.neofs.devenv:8080
@ -17,6 +19,8 @@ hosts:
container_name: s02 container_name: s02
config_path: ../neofs-dev-env/services/storage/.storage.env config_path: ../neofs-dev-env/services/storage/.storage.env
wallet_path: ../neofs-dev-env/services/storage/wallet02.json wallet_path: ../neofs-dev-env/services/storage/wallet02.json
local_config_path: ./TemporaryDir/empty-password.yml
local_wallet_path: ../neofs-dev-env/services/storage/wallet02.json
wallet_password: "" wallet_password: ""
volume_name: storage_storage_s02 volume_name: storage_storage_s02
rpc_endpoint: s02.neofs.devenv:8080 rpc_endpoint: s02.neofs.devenv:8080
@ -27,6 +31,8 @@ hosts:
container_name: s03 container_name: s03
config_path: ../neofs-dev-env/services/storage/.storage.env config_path: ../neofs-dev-env/services/storage/.storage.env
wallet_path: ../neofs-dev-env/services/storage/wallet03.json wallet_path: ../neofs-dev-env/services/storage/wallet03.json
local_config_path: ./TemporaryDir/empty-password.yml
local_wallet_path: ../neofs-dev-env/services/storage/wallet03.json
wallet_password: "" wallet_password: ""
volume_name: storage_storage_s03 volume_name: storage_storage_s03
rpc_endpoint: s03.neofs.devenv:8080 rpc_endpoint: s03.neofs.devenv:8080
@ -37,6 +43,8 @@ hosts:
container_name: s04 container_name: s04
config_path: ../neofs-dev-env/services/storage/.storage.env config_path: ../neofs-dev-env/services/storage/.storage.env
wallet_path: ../neofs-dev-env/services/storage/wallet04.json wallet_path: ../neofs-dev-env/services/storage/wallet04.json
local_config_path: ./TemporaryDir/empty-password.yml
local_wallet_path: ../neofs-dev-env/services/storage/wallet04.json
wallet_password: "" wallet_password: ""
volume_name: storage_storage_s04 volume_name: storage_storage_s04
rpc_endpoint: s04.neofs.devenv:8080 rpc_endpoint: s04.neofs.devenv:8080
@ -47,6 +55,8 @@ hosts:
container_name: s3_gate container_name: s3_gate
config_path: ../neofs-dev-env/services/s3_gate/.s3.env config_path: ../neofs-dev-env/services/s3_gate/.s3.env
wallet_path: ../neofs-dev-env/services/s3_gate/wallet.json wallet_path: ../neofs-dev-env/services/s3_gate/wallet.json
local_config_path: ./TemporaryDir/password-s3.yml
local_wallet_path: ../neofs-dev-env/services/s3_gate/wallet.json
wallet_password: "s3" wallet_password: "s3"
endpoint: https://s3.neofs.devenv:8080 endpoint: https://s3.neofs.devenv:8080
- name: http-gate01 - name: http-gate01
@ -54,6 +64,8 @@ hosts:
container_name: http_gate container_name: http_gate
config_path: ../neofs-dev-env/services/http_gate/.http.env config_path: ../neofs-dev-env/services/http_gate/.http.env
wallet_path: ../neofs-dev-env/services/http_gate/wallet.json wallet_path: ../neofs-dev-env/services/http_gate/wallet.json
local_config_path: ./TemporaryDir/password-other.yml
local_wallet_path: ../neofs-dev-env/services/http_gate/wallet.json
wallet_password: "one" wallet_password: "one"
endpoint: http://http.neofs.devenv endpoint: http://http.neofs.devenv
- name: ir01 - name: ir01
@ -61,12 +73,16 @@ hosts:
container_name: ir01 container_name: ir01
config_path: ../neofs-dev-env/services/ir/.ir.env config_path: ../neofs-dev-env/services/ir/.ir.env
wallet_path: ../neofs-dev-env/services/ir/az.json wallet_path: ../neofs-dev-env/services/ir/az.json
local_config_path: ./TemporaryDir/password-other.yml
local_wallet_path: ../neofs-dev-env/services/ir/az.json
wallet_password: "one" wallet_password: "one"
- name: morph-chain01 - name: morph-chain01
attributes: attributes:
container_name: morph_chain container_name: morph_chain
config_path: ../neofs-dev-env/services/morph_chain/protocol.privnet.yml config_path: ../neofs-dev-env/services/morph_chain/protocol.privnet.yml
wallet_path: ../neofs-dev-env/services/morph_chain/node-wallet.json wallet_path: ../neofs-dev-env/services/morph_chain/node-wallet.json
local_config_path: ./TemporaryDir/password-other.yml
local_wallet_path: ../neofs-dev-env/services/morph_chain/node-wallet.json
wallet_password: "one" wallet_password: "one"
endpoint: http://morph-chain.neofs.devenv:30333 endpoint: http://morph-chain.neofs.devenv:30333
- name: main-chain01 - name: main-chain01
@ -74,6 +90,8 @@ hosts:
container_name: main_chain container_name: main_chain
config_path: ../neofs-dev-env/services/chain/protocol.privnet.yml config_path: ../neofs-dev-env/services/chain/protocol.privnet.yml
wallet_path: ../neofs-dev-env/services/chain/node-wallet.json wallet_path: ../neofs-dev-env/services/chain/node-wallet.json
local_config_path: ./TemporaryDir/password-other.yml
local_wallet_path: ../neofs-dev-env/services/chain/node-wallet.json
wallet_password: "one" wallet_password: "one"
endpoint: http://main-chain.neofs.devenv:30333 endpoint: http://main-chain.neofs.devenv:30333
- name: coredns01 - name: coredns01

View file

@ -4,6 +4,7 @@ from dataclasses import dataclass
from typing import Any from typing import Any
import data_formatters import data_formatters
import yaml
from neofs_testlib.blockchain import RPCClient from neofs_testlib.blockchain import RPCClient
from neofs_testlib.hosting import Host, Hosting from neofs_testlib.hosting import Host, Hosting
from neofs_testlib.hosting.config import ServiceConfig from neofs_testlib.hosting.config import ServiceConfig
@ -237,6 +238,25 @@ class Cluster:
def hosting(self) -> Hosting: def hosting(self) -> Hosting:
return self._hosting return self._hosting
def _create_wallet_config(self, service: ServiceConfig) -> None:
wallet_path = service.attributes[_ConfigAttributes.LOCAL_WALLET_CONFIG]
wallet_password = service.attributes[_ConfigAttributes.WALLET_PASSWORD]
with open(wallet_path, "w") as file:
yaml.dump({"password": wallet_password}, file)
def create_wallet_configs(self, hosting: Hosting) -> None:
configs = hosting.find_service_configs(".*")
for config in configs:
if _ConfigAttributes.LOCAL_WALLET_CONFIG in config.attributes:
self._create_wallet_config(config)
def is_local_devevn(self) -> bool:
if len(self.hosting.hosts) == 1:
host = self.hosting.hosts[0]
if host.config.address == "localhost" and host.config.plugin_name == "docker":
return True
return False
@property @property
def storage_nodes(self) -> list[StorageNode]: def storage_nodes(self) -> list[StorageNode]:
""" """

View file

@ -115,8 +115,11 @@ def wallet_factory(temp_directory: str, client_shell: Shell, cluster: Cluster) -
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def cluster(hosting: Hosting) -> Cluster: def cluster(temp_directory: str, hosting: Hosting) -> Cluster:
yield Cluster(hosting) cluster = Cluster(hosting)
if cluster.is_local_devevn():
cluster.create_wallet_configs(hosting)
yield cluster
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)