mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-02 13:13:08 +00:00
fix: add reusable extract_config for node
This commit is contained in:
parent
c90974118e
commit
fce8af0deb
@ -1,4 +1,6 @@
|
||||
import io
|
||||
import os
|
||||
import tarfile
|
||||
|
||||
from src.data_storage import DS
|
||||
from src.libs.common import generate_log_prefix
|
||||
@ -157,6 +159,21 @@ class NomosNode:
|
||||
else:
|
||||
logger.debug("No keyword matches found in the logs.")
|
||||
|
||||
def extract_config(self, target_file):
|
||||
# Copy the config file from first node
|
||||
stream, _stat = self.get_archive("/config.yaml")
|
||||
|
||||
# Join stream into bytes and load into a memory buffer
|
||||
tar_bytes = io.BytesIO(b"".join(stream))
|
||||
|
||||
# Extract and write only the actual config file
|
||||
with tarfile.open(fileobj=tar_bytes) as tar:
|
||||
member = tar.getmembers()[0]
|
||||
file_obj = tar.extractfile(member)
|
||||
if file_obj:
|
||||
with open(f"{target_file}", "wb") as f:
|
||||
f.write(file_obj.read())
|
||||
|
||||
def send_dispersal_request(self, data):
|
||||
return self._api.da_disperse_data(data)
|
||||
|
||||
|
||||
@ -57,20 +57,7 @@ class TestDataConfidentiality(StepsDataAvailability):
|
||||
|
||||
assert DATA_TO_DISPERSE[1] == decoded_data, "Retrieved data are not same with original data"
|
||||
|
||||
# Copy the config file from first node
|
||||
stream, _stat = self.node2.get_archive("/config.yaml")
|
||||
|
||||
# Join stream into bytes and load into a memory buffer
|
||||
tar_bytes = io.BytesIO(b"".join(stream))
|
||||
|
||||
# Extract and write only the actual text file
|
||||
with tarfile.open(fileobj=tar_bytes) as tar:
|
||||
member = tar.getmembers()[0]
|
||||
file_obj = tar.extractfile(member)
|
||||
if file_obj:
|
||||
with open("./cluster_config/config.yaml", "wb") as f:
|
||||
f.write(file_obj.read())
|
||||
|
||||
self.node2.extract_config("./cluster_config/config.yaml")
|
||||
self.node2.stop()
|
||||
|
||||
# Change the private key -> PeerId of the nomos_node_0. This would create a stranger to existing membership list.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user