From 51176a0c599d1e78707a228e124955259eb4c641 Mon Sep 17 00:00:00 2001 From: Adam Korczynski Date: Wed, 7 Aug 2024 11:55:14 +0100 Subject: [PATCH] experimental: run a single test Signed-off-by: Adam Korczynski --- .../test_updater_delegation_graphs.py | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tuf_conformance/test_updater_delegation_graphs.py b/tuf_conformance/test_updater_delegation_graphs.py index dabb7a5..fb66136 100644 --- a/tuf_conformance/test_updater_delegation_graphs.py +++ b/tuf_conformance/test_updater_delegation_graphs.py @@ -45,7 +45,7 @@ class DelegationsTestCase: visited_order: List[str] = field(default_factory=list) -graphs: DataSet = { +graphs2: DataSet = { "basic-delegation": DelegationsTestCase( delegations=[TestDelegation("targets", "A")], visited_order=["A"], @@ -161,6 +161,20 @@ class DelegationsTestCase: ), } +graphs: DataSet = { + "max-number-of-delegations": DelegationsTestCase( + delegations=[ + TestDelegation("targets", "A"), + TestDelegation("targets", "B"), + TestDelegation("targets", "C"), + TestDelegation("C", "D"), + TestDelegation("C", "E"), + ], + # "E" is skipped, max_delegations is 4 + visited_order=["A", "B", "C", "D"], + ), +} + graph_ids = graphs.keys() graph_cases = graphs.values() @@ -191,9 +205,11 @@ def test_graph_traversal( ## exp_files = [*TOP_LEVEL_ROLE_NAMES, *graphs.visited_order] exp_calls = [(role, 1) for role in graphs.visited_order] + print("client.test_name: ", client.test_name) init_data, repo = server.new_test(client.test_name) assert client.init_client(init_data) == 0 + print("initting repo:") init_repo(repo, graphs) # restrict the max number of delegations to simplify the test client.max_delegations = 4 @@ -202,12 +218,15 @@ def test_graph_traversal( client.refresh(init_data) repo.fetch_tracker.metadata.clear() assert client._files_exist(TOP_LEVEL_ROLE_NAMES) + print("self.md_delegates: ", repo.md_delegates) + print("getting target info") targetfile = client.get_targetinfo(init_data, "missingpath") print("targetfile: ", targetfile) assert targetfile == None print("repo.fetch_tracker.metadata: ", repo.fetch_tracker.metadata) + print("exp_files: ", exp_files) print("repo targets: ", repo.md_delegates) # For some reason "('root', 2), ('timestamp', None)" gets prepended # in every case, so we compare from the 3rd item in the list. - assert repo.fetch_tracker.metadata[2:-2] == exp_calls - assert client._files_exist(exp_files) + assert repo.fetch_tracker.metadata[2:] == exp_calls + assert client._files_exist(exp_files) \ No newline at end of file