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

Commit

Permalink
env: log neofs binary versions to allure
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Mar 18, 2024
1 parent 42e10e0 commit f97a825
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/neofs_testlib/env/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ def log_env_details_to_file(self):
env_details += f"{self.http_gw}\n"

fp.write(env_details)

def log_versions_to_allure(self):
versions = ""
versions += NeoFSEnv._run_single_command(self.neofs_adm_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_cli_path, "--version")
versions += NeoFSEnv._run_single_command(self.neo_go_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_ir_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_node_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_s3_authmate_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_s3_gw_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_rest_gw_path, "--version")
versions += NeoFSEnv._run_single_command(self.neofs_http_gw_path, "--version")
allure.attach(versions, f"neofs env versions", allure.attachment_type.TEXT, ".txt")

@allure.step("Download binaries")
def download_binaries(self):
Expand Down Expand Up @@ -277,6 +290,7 @@ def load(cls, persisted_path: str) -> "NeoFSEnv":
return pickle.load(fp)

@classmethod
@allure.step("Deploy simple neofs env")
def simple(cls, neofs_env_config: dict = None) -> "NeoFSEnv":
if not neofs_env_config:
neofs_env_config = yaml.safe_load(
Expand All @@ -298,6 +312,7 @@ def simple(cls, neofs_env_config: dict = None) -> "NeoFSEnv":
neofs_env.deploy_http_gw()
neofs_env.deploy_rest_gw()
neofs_env.log_env_details_to_file()
neofs_env.log_versions_to_allure()
return neofs_env

@staticmethod
Expand All @@ -313,6 +328,15 @@ def generate_config_file(config_template: str, config_path: str, custom=False, *
rendered_config = jinja_template.render(**kwargs)
with open(config_path, mode="w") as fp:
fp.write(rendered_config)

@staticmethod
def _run_single_command(binary: str, command: str) -> str:
result = subprocess.run(
[binary, command],
capture_output = True,
text = True
)
return f"{result.stdout}\n{result.stderr}\n"

@classmethod
def get_available_port(cls) -> str:
Expand Down

0 comments on commit f97a825

Please sign in to comment.