Skip to content
This repository was archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
add v4 index, add test to ensure both indexed stay in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Nov 6, 2018
1 parent ff71839 commit afde9f7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
23 changes: 23 additions & 0 deletions index-v4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
# ROS index file
# see REP 153: http://ros.org/reps/rep-0153.html
---
distributions:
# r2b2:
# distribution: [r2b2/distribution.yaml]
# distribution_cache: http://repo.ros2.org/rosdistro_cache/r2b2-cache.yaml.gz
# r2b3:
# distribution: [r2b3/distribution.yaml]
# distribution_cache: http://repo.ros2.org/rosdistro_cache/r2b3-cache.yaml.gz
ardent:
distribution: [ardent/distribution.yaml]
distribution_cache: http://repo.ros2.org/rosdistro_cache/ardent-cache.yaml.gz
distribution_status: active
distribution_type: ros2
bouncy:
distribution: [bouncy/distribution.yaml]
distribution_cache: http://repo.ros2.org/rosdistro_cache/bouncy-cache.yaml.gz
distribution_status: active
distribution_type: ros2
type: index
version: 4
35 changes: 35 additions & 0 deletions test/test_indexes_equal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os

from rosdistro import get_index

from .fold_block import Fold

INDEX_V3_YAML = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', 'index.yaml'))
INDEX_V4_YAML = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', 'index-v4.yaml'))


def test_build_caches():
with Fold():
print('Checking that the index.yaml and index-v4.yaml files contain '
'the same information expect additional metadata in the v4.')
index_v3 = get_index('file://' + os.path.abspath(INDEX_V3_YAML))
index_v4 = get_index('file://' + os.path.abspath(INDEX_V4_YAML))

dist_names_v3 = list(sorted(index_v3.distributions.keys()))
dist_names_v4 = list(sorted(index_v4.distributions.keys()))
assert dist_names_v3 == dist_names_v4, \
'Different set of distribution names'

for dist_name in dist_names_v3:
dist_v3_data = index_v3.distributions[dist_name]
dist_v4_data = index_v4.distributions[dist_name]

for key, value in dist_v3_data.items():
assert key in dist_v4_data, \
"For distribution '%s' index.yaml contains the key '%s' " \
"but v4 doesn't contain it" % (dist_name, key)
assert dist_v4_data[key] == value, \
"For distribution '%s' both yaml files contains the key " \
"'%s' but with different values" % (dist_name, key)

0 comments on commit afde9f7

Please sign in to comment.