Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_cli.py
Show All 35 Lines | tools = [ | ||||
'tool_configuration': {}, | 'tool_configuration': {}, | ||||
} | } | ||||
for i in range(2) | for i in range(2) | ||||
] | ] | ||||
tools = idx_storage.indexer_configuration_add(tools) | tools = idx_storage.indexer_configuration_add(tools) | ||||
origin_metadata = [ | origin_metadata = [ | ||||
{ | { | ||||
'origin_id': origin_id, | 'id': origin_id, | ||||
'from_revision': hash_to_bytes('abcd{:0>4}'.format(origin_id)), | 'from_revision': hash_to_bytes('abcd{:0>4}'.format(origin_id)), | ||||
'indexer_configuration_id': tools[origin_id % 2]['id'], | 'indexer_configuration_id': tools[origin_id % 2]['id'], | ||||
'metadata': {'name': 'origin %d' % origin_id}, | 'metadata': {'name': 'origin %d' % origin_id}, | ||||
'mappings': ['mapping%d' % (origin_id % 10)] | 'mappings': ['mapping%d' % (origin_id % 10)] | ||||
} | } | ||||
for origin_id in range(nb_rows) | for origin_id in range(nb_rows) | ||||
] | ] | ||||
revision_metadata = [ | revision_metadata = [ | ||||
{ | { | ||||
'id': hash_to_bytes('abcd{:0>4}'.format(origin_id)), | 'id': hash_to_bytes('abcd{:0>4}'.format(origin_id)), | ||||
'indexer_configuration_id': tools[origin_id % 2]['id'], | 'indexer_configuration_id': tools[origin_id % 2]['id'], | ||||
'metadata': {'name': 'origin %d' % origin_id}, | 'metadata': {'name': 'origin %d' % origin_id}, | ||||
'mappings': ['mapping%d' % (origin_id % 10)] | 'mappings': ['mapping%d' % (origin_id % 10)] | ||||
} | } | ||||
for origin_id in range(nb_rows) | for origin_id in range(nb_rows) | ||||
] | ] | ||||
idx_storage.revision_metadata_add(revision_metadata) | idx_storage.revision_intrinsic_metadata_add(revision_metadata) | ||||
idx_storage.origin_intrinsic_metadata_add(origin_metadata) | idx_storage.origin_intrinsic_metadata_add(origin_metadata) | ||||
return [tool['id'] for tool in tools] | return [tool['id'] for tool in tools] | ||||
def _origins_in_task_args(tasks): | def _origins_in_task_args(tasks): | ||||
"""Returns the set of origins contained in the arguments of the | """Returns the set of origins contained in the arguments of the | ||||
provided tasks (assumed to be of type indexer_origin_metadata).""" | provided tasks (assumed to be of type indexer_origin_metadata).""" | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |