Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ def run_test(self):
raise Exception("Failed execution!")


if __name__ == "__main__":
def main():
Failure().main()
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ def assert_connection(self, connector, connectee_index, connection_type: Connect
raise ValueError("ConnectionType must be of type DNS or IP")


if __name__ == "__main__":
def main():
ConnectDag().main()
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def run_test(self):
p2p_block_store.wait_until(lambda: p2p_block_store.blocks[best_block] == 1)


if __name__ == "__main__":
def main():
GetdataTest().main()
20 changes: 19 additions & 1 deletion src/warnet/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,27 @@ def run(scenario_file: str, additional_args: tuple[str]):
# Create in-memory buffer to store python archive instead of writing to disk
archive_buffer = io.BytesIO()

# No need to copy the entire scenarios/ directory into the archive
def filter(path):
if any(
needle in str(path) for needle in [
".pyc",
".csv",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to categorically reject csv files? It's a common format, and I can imagine a user thinking they could use it.

".DS_Store"
]
):
return False
return any(
needle in str(path) for needle in [
"commander.py",
"test_framework",
scenario_name
]
)

# Compile python archive
zipapp.create_archive(
source=scenario_dir, target=archive_buffer, main=f"{scenario_name}:main", compressed=True
source=scenario_dir, target=archive_buffer, main=f"{scenario_name}:main", compressed=True, filter=filter
)

# Encode the binary data as Base64
Expand Down
2 changes: 1 addition & 1 deletion test/dag_connection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setup_network(self):

def run_connect_dag_scenario(self):
self.log.info("Running connect_dag scenario")
self.warnet("run test/data/scenario_connect_dag.py")
self.warnet("run resources/scenarios/test_connect_dag.py")
self.wait_for_all_scenarios()


Expand Down
4 changes: 2 additions & 2 deletions test/scenarios_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def run_and_check_miner_scenario_from_file(self):
self.stop_scenario()

def run_and_check_scenario_from_file(self):
scenario_file = "test/data/scenario_p2p_interface.py"
scenario_file = "resources/scenarios/test_p2p_interface.py"
self.log.info(f"Running scenario from: {scenario_file}")
self.warnet(f"run {scenario_file}")
self.wait_for_predicate(self.check_scenario_clean_exit)
Expand All @@ -94,7 +94,7 @@ def check_regtest_recon(self):
self.wait_for_predicate(self.check_scenario_clean_exit)

def check_active_count(self):
scenario_file = "test/data/scenario_buggy_failure.py"
scenario_file = "resources/scenarios/test_buggy_failure.py"
self.log.info(f"Running scenario from: {scenario_file}")
self.warnet(f"run {scenario_file}")

Expand Down