From 3e336093ed8c62e5b78e1603e57b38a2ea8df7d3 Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Wed, 4 Dec 2024 09:00:19 -0800 Subject: [PATCH] adding test for new feature --- caveclient/tools/testing.py | 2 +- tests/test_chunkedgraph.py | 46 +++++++++++++++++++++++++++++++++++++ tests/test_framework.py | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/caveclient/tools/testing.py b/caveclient/tools/testing.py index a0ac271c..1890e685 100644 --- a/caveclient/tools/testing.py +++ b/caveclient/tools/testing.py @@ -16,7 +16,7 @@ warnings.warn("Must install responses to use CAVEclientMock for testing") imports_worked = False -DEFAULT_CHUNKEDGRAPH_SERVER_VERSION = "2.15.0" +DEFAULT_CHUNKEDGRAPH_SERVER_VERSION = "2.18.0" DEFAULT_MATERIALIZATION_SERVER_VERSON = "4.30.1" DEFAULT_SKELETON_SERVICE_SERVER_VERSION = "0.3.8" DEFAULT_JSON_SERVICE_SERVER_VERSION = "0.7.0" diff --git a/tests/test_chunkedgraph.py b/tests/test_chunkedgraph.py index 92a7bc8c..955f7bc0 100644 --- a/tests/test_chunkedgraph.py +++ b/tests/test_chunkedgraph.py @@ -137,6 +137,52 @@ def test_get_leaves_many(self, myclient): svids_ret = myclient.chunkedgraph.get_leaves_many(root_ids) for k, v in svids_ret.items(): assert np.all(v == sv_dict[str(k)]) + + @responses.activate + def test_minimal_covering_nodes(self, myclient): + endpoint_mapping = self._default_endpoint_map + l2ids = [151733086944494680, 151803455688671629, 151803524408148361, + 151803524408148371, 151873824432849265, 151873893152326692, + 151873961871802557, 151944261829395442, 151944261896503344, + 151944330615980096, 152014630573572920, 152014630573573159, + 152014699360157777, 152084999317750839, 152155368061928130, + 152225736806105726, 152296105550283453, 152296174269760177, + 152366543013938289, 152436911758115473, 152436980477592301, + 152507349221769815, 152577717965948027, 152577786685424795, + 152577786685424797, 152648155429602343, 152648155429602345, + 152648224149078995, 152718524173779595, 152718592893256250, + 152788961637433848, 152859330381611287, 152859399101088529, + 152929767845266045, 152929767845266047, 152929836564742225, + 153000136589443132, 153000205308919861, 153070574053098110, + 153140942797275294, 153141011516751998, 153141080236228767, + 153211311541453183, 153211380260929846, 153211448980406620, + 153211448980406624, 153211517699883483, 153281817724584437, + 153281886444061198, 153352186468762089, 153352255188238828, + 153422623932416499, 153422692651893340, 153492992676594177, + 153493061396070924, 153563430140248766, 153563498859725522, + 153633798884426257, 153633867603903006, 153704236348080465, + 153774605092258013, 153774673811734916, 153844973836435679, + 153845042555912428, 153915342580613364, 153915411300090031, + 153985711324791351, 154056080068969264, 154126448813146756, + 154126448813146804, 154126517532623397, 154196817557324412, + 154196886276800996, 154267186301502007, 154267255020978536, + 154337623765156171, 154337692484633043] + + covering_nodes = [226343819258366071, 298438259283864547, + 441652105523081273, 441652105523071767, + 441652105523184668, 441634513337085631, + 650770146159222932] + + url = chunkedgraph_endpoints_v1["minimal_covering_nodes"].format_map(endpoint_mapping) + query_d = {"as_array": True} + urlq = url + "?" + urlencode(query_d) + responses.add(responses.POST, + body=np.array(covering_nodes).tobytes(), + url=urlq, + match=[json_params_matcher({"node_ids": l2ids})]) + + node_ids = myclient.chunkedgraph.get_minimal_covering_nodes(l2ids) + assert np.all(node_ids == np.array(covering_nodes)) @responses.activate def test_get_root(self, myclient): diff --git a/tests/test_framework.py b/tests/test_framework.py index 0c5162eb..28f79045 100644 --- a/tests/test_framework.py +++ b/tests/test_framework.py @@ -91,7 +91,7 @@ def test_create_versioned_client(self): cg_version_url = endpoints.chunkedgraph_endpoints_common[ "get_version" ].format_map(endpoint_mapping) - responses.add(responses.GET, cg_version_url, json="2.15.0", status=200) + responses.add(responses.GET, cg_version_url, json="2.18.0", status=200) mat_version_url = endpoints.materialization_common["get_version"].format_map( endpoint_mapping