Merge lp://staging/~adeuring/charmworld/fixed-interfaces-mapping into lp://staging/~juju-jitsu/charmworld/trunk

Proposed by Abel Deuring
Status: Merged
Approved by: Abel Deuring
Approved revision: 383
Merged at revision: 393
Proposed branch: lp://staging/~adeuring/charmworld/fixed-interfaces-mapping
Merge into: lp://staging/~juju-jitsu/charmworld/trunk
Diff against target: 229 lines (+89/-42)
4 files modified
charmworld/migrations/versions/019_fixed_mapping_for_interfaces.py (+10/-0)
charmworld/migrations/versions/tests/test_migrations.py (+44/-0)
charmworld/search.py (+30/-20)
charmworld/tests/test_search.py (+5/-22)
To merge this branch: bzr merge lp://staging/~adeuring/charmworld/fixed-interfaces-mapping
Reviewer Review Type Date Requested Status
Abel Deuring (community) Approve
Benji York (community) Approve
Review via email: mp+184805@code.staging.launchpad.net

Commit message

use a static mapping for the charm index.

Description of the change

his branch removes the last remainig dynamic part of the mapping used
by the ElasticSearch index for charms.

The properties "requires" and "provides" of a charm are dictionaries
of the form

    {'relation_name': {'interface': 'http', ...}, ...}

which means that each relation name must appear as a property in the mapping.

The ES server gets charm data in the form

    {'_id': ...,
     'data': real_charm_data
     }

ElasticSearchClient._wrap_charm() now adds two entries "requires" and
"provides" that are lists of the relation data from charm["provides"]
and charm["requires"], respectively. The relation name is added to
the list entries.

This allows to define a static mapping for the relation data.

test_mapping_changes_during_indexing() requires an obvious change.
The test itself is now a bit flaky -- it might succeed accidentally:
As the comment for the old version notes, the result of the call of
get_mapping() does not necessarily incorporate possible mapping
changes after data has been added to the index. Hence it might make
sense to add a sleep(0.5) call to the test.

The change of the mapping and the related change of
ElasticSearchClient._get_text_query() require to reindex all charms.
This is done in an exodus.

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good to me.

review: Approve
Revision history for this message
Charmworld Lander (charmworld-lander) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/charmworld-merger-trunk/453/console reported an error when processing this lp:~adeuring/charmworld/fixed-interfaces-mapping branch.
Not merging it.

383. By Abel Deuring

test failure fixed.

Revision history for this message
Abel Deuring (adeuring) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches