* Fix for diffing issue after rollback in
conjunction with created and deleted buckets.
* Changed rollback function to check against the full set of documents
for a revision instead of just the documents at that particular revision
* Created a document_delete function to encapsulate document deletion
* Added additional test case to check that a rollback to
something other than 0 deletes the created buckets in between
Co-Authored-By: Michael Beaver <michaelbeaver64@gmail.com>
Change-Id: I0d57e67d68def1f15255a8c89290e8c70deedc03
Adds a unit test to validate following scenario:
1) create revision 1 with document
2) create revision 2 with no documents
3) rollback to revision 1 (creating revision 3)
Validate that diffing works for rolled-back revision.
All cases above use same bucket.
Also refactors some test logic for neatness.
Change-Id: I71bf7d34e8aae3ad5abb3c53b05cb96a7038ddc2
This patch set allows revision rollback functionality to work
with revision 0 in order to allow Deckhand to create a blank
revision (without any documents), without having to delete every
revision in the database (which is currently done here: [1] for
example). This is less than ideal as revision history is lost.
Instead, Deckhand should just support rolling back to revision 0
which simulates a blank slate (though in reality the previous
revision history is retained).
[1] 18ed6674d2/src/bin/shipyard_airflow/shipyard_airflow/control/helpers/configdocs_helper.py (L159)
Change-Id: Ic94b25ca15f88ba492e08c907d4a330aeecca810
This PS removes some additional validations around not being
able to rollback to a target revision:
- if the target revision == current revision
- if the target revision is effectively equivalent to the current
revision (in terms of constituent documents)
Change-Id: I92f8f9557f96b6a27f0dcef4f3138d542e5aa915
This PS implements the sort filter, allowing (for now)
the GET /revisions and GET /revision/{revision_id}/documents
endpoints to be sorted as per the API documentation in
Deckhand [0].
An additional filter has also been added to the 2 aforementioned
endpoints as well -- order -- which determines the order in
which sorted results are returned: "asc" for ascending
order and "desc" for descending order.
[0] http://deckhand.readthedocs.io/en/latest/api_ref.html#get-revisions-revision-id-documents
Change-Id: Ifb9e15b8379b0a28889a14c331d81d9a4147f1d4
This commit implements the revision rollback API, allowing
users to rollback to a previous revision, whereby a new
revision is created.
An exception (400 Bad Request) is raised if the revision being
rolled back to is identical to the latest revision or if no
changes exist between the latest revision and the one being rolled
back to.
Included in this commit:
- API endpoint for revision rollback.
- Back-end logic for rolling back to a previous revision.
The associated documents are also re-recreated. The
revision_id assigned to each document depends on whether
it has changed between the latest revision and the one
being rolled back to: if changed, the new revision_id
is assigned, else the original one, to maintain the
correct revision history.
- Associated unit tests.
- Unskip all associated functional tests.
Change-Id: I5c120a92e106544f7f8a4266fc386fb60622d6b3