fix: use 4 node instead of 5 node cluster

- fix test_da_identify_retrieve_missing_columns
This commit is contained in:
Roman 2025-02-11 16:11:14 +08:00
parent c84f461b45
commit ca8eabfc35
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
4 changed files with 22 additions and 20 deletions

View File

@ -1,5 +1,5 @@
port: 4400
n_hosts: 5
n_hosts: 4
timeout: 30
# ConsensusConfig related parameters

View File

@ -85,7 +85,7 @@ class NomosCli:
self._container = None
logger.debug("Container killed.")
def run_reconstruct(self, input_values=None, decode_only=True):
def run_reconstruct(self, input_values=None, decode_only=False):
keywords = ["Reconstructed data"]
self.run(input_values)

View File

@ -52,16 +52,15 @@ class StepsCommon:
raise
@pytest.fixture(scope="function")
def setup_5_node_cluster(self, request):
def setup_4_node_cluster(self, request):
logger.debug(f"Running fixture setup: {inspect.currentframe().f_code.co_name}")
prepare_cluster_config(5)
prepare_cluster_config(4)
self.node1 = NomosNode(CFGSYNC, "cfgsync")
self.node2 = NomosNode(NOMOS, "nomos_node_0")
self.node3 = NomosNode(NOMOS, "nomos_node_1")
self.node4 = NomosNode(NOMOS, "nomos_node_2")
self.node5 = NomosNode(NOMOS, "nomos_node_3")
self.node6 = NomosNode(NOMOS_EXECUTOR, "nomos_node_4")
self.main_nodes.extend([self.node1, self.node2, self.node3, self.node4, self.node5, self.node6])
self.node5 = NomosNode(NOMOS_EXECUTOR, "nomos_node_3")
self.main_nodes.extend([self.node1, self.node2, self.node3, self.node4, self.node5])
start_nodes(self.main_nodes)
try:

View File

@ -1,4 +1,5 @@
import json
import random
import pytest
@ -14,27 +15,29 @@ logger = get_custom_logger(__name__)
class TestDataIntegrity(StepsDataAvailability):
main_nodes = []
@pytest.mark.skip(reason="Waiting for PR https://github.com/logos-co/nomos-node/pull/994")
@pytest.mark.usefixtures("setup_5_node_cluster")
@pytest.mark.usefixtures("setup_4_node_cluster")
def test_da_identify_retrieve_missing_columns(self):
delay(5)
self.disperse_data(DATA_TO_DISPERSE[0], [0] * 31 + [1], [0] * 8)
received_data = []
# Get data only from half of nodes
for node in self.main_nodes[2:4]:
received_data.append(self.get_data_range(node, [0] * 31 + [1], [0] * 8, [0] * 7 + [3]))
delay(20)
# Select one target node at random to get blob data for 1/2 columns
selected_node = self.main_nodes[random.randint(1, 3)]
rcv_data = self.get_data_range(selected_node, [0] * 31 + [1], [0] * 8, [0] * 7 + [5])
rcv_data_json = json.dumps(rcv_data)
# Use received blob data to reconstruct the original data
# nomos-cli reconstruct command required
reconstructed_data = []
assert DATA_TO_DISPERSE[0] == bytes(reconstructed_data).decode("utf-8")
cli = NomosCli(command="reconstruct")
reconstructed_data = cli.run_reconstruct(input_values=[rcv_data_json])
assert DATA_TO_DISPERSE[0] == reconstructed_data, "Reconstructed data are not same with original data"
@pytest.mark.usefixtures("setup_2_node_cluster")
def test_da_sampling_determines_data_presence(self):
self.disperse_data(DATA_TO_DISPERSE[0], [0] * 31 + [1], [0] * 8)
delay(5)
received_data = self.get_data_range(self.node2, [0] * 31 + [1], [0] * 8, [0] * 7 + [5])
rcv_data_json = json.dumps(received_data)
rcv_data = self.get_data_range(self.node2, [0] * 31 + [1], [0] * 8, [0] * 7 + [5])
rcv_data_json = json.dumps(rcv_data)
cli = NomosCli(command="reconstruct")
decoded_data = cli.run_reconstruct(input_values=[rcv_data_json])
decoded_data = cli.run_reconstruct(input_values=[rcv_data_json], decode_only=True)
assert DATA_TO_DISPERSE[0] == decoded_data, "Retrieved data are not same with original data"