Commit Graph

8 Commits

Author SHA1 Message Date
Felipe Monteiro 035841416b Validate bucket diffing works with revision rollback
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
2018-10-18 19:07:42 +01:00
Felipe Monteiro 89cc04165c Remove dead validation policy code.
This PS removes dead validation policy code from Deckhand. Most
of this code is just for testing and serves no purpose because
Deckhand currently doesn't offer support for validation policies.
Besides, these tests assume a wrong implementation of validation
policies and should be removed for that reason alone.

The actual documentation and rudimentary foundational logic
for implementing validation policies has been left undeleted.
(Some of this logic includes having a constant for validation
policies in deckhand.types and a schema for validating validation
policies).

Change-Id: Ie0d27dae84c82096e0a88bebcba9bb7ca9bee7c1
2018-01-07 21:59:23 -04:00
Felipe Monteiro 8aec0390f8 DECKHAND-80: Validations API Implementation
The Validations API has been introduced to Deckhand, allowing users
to register new validation results in Deckhand, as well as query
the API for validation results for a revision. The validation results
include a list of errors that occurred during document validation.

All functional tests related to the API are now passing.

The following endpoints have been implemented:

   * /api/v1.0/revisions/{revision_id}/validations
   * /api/v1.0/revisions/{revision_id}/validations/{validation_name}
   * /api/v1.0/revisions/{revision_id}/validations/{validation_name}/entries
   * /api/v1.0/revisions/{revision_id}/validations/{validation_name}/entries/{entry_id}

Some back-end refactoring was needed to implement this API. In
particular:

  - Added a new Validation sqlalchemy DB model
  - Introduced DataSchema handling to the engine.document_validation
    module so that registered schema validations can be used
  - Changed the way the result of the 'deckhand-schema-validation' internal
    validation is generated: it is now the amalgamation of all the
    internal and registered schema validations executed
  - Introduced rawquery generation so that raw SQL queries can be used to
    get results from DB

Fixed following bug:

  - UniqueConstraint is now used to correctly generate unique constraints
    for sqlalchemy models that are supposed to be combinations of columns

Change-Id: I53c79a6544f44ef8beab2600ddc8a3ea91ada903
2017-10-21 23:09:16 -04:00
Felipe Monteiro ef4f65037d Revision diffing API.
This commit implements revision diffing API and the
required back-end logic needed to realize it.

Included in this commit:

  - implementation of revision diffing
  - unskip all revision diff functional tests
  - add additional functional tests for revision diffing
  - relevant unit tests
  - document comparison is performed using hashing as opposed
    to more inefficient, direct comparisons

Change-Id: I0419ee9b8cf3fca6fe75818615d2338dc00b1003
2017-09-25 21:58:30 +01:00
Felipe Monteiro e32a5a9319 Bucket deletion implementation
This commit implements logic to realize bucket deletion. This
commit also adds logic for raising an exception when trying
to create the same (document.schema, document.metadata.name)
in a different bucket than the one it was originally created in.

Included in this commit:

  - Implementation of document deletion logic.
  - Documents are always saved, even if they have been deleted
    or remain unchanged between revisions. This makes it easier
    to compute the diff between revisions.
  - Associated unit tests.
  - Unskip all remaining functional tests for
    'document-crud-success-single-bucket.yaml`
  - Raise a 409 exception when trying to create the same
    (document.schema, document.metadata.name) in a different
    bucket.
  - Unskip functional tests for
    'document-crud-error-bucket-conflict.yaml'

Change-Id: I6693bbb918cb672de315a66bb087de547df302d1
2017-09-18 23:03:38 +01:00
Felipe Monteiro 6817b39911 Unskip all revision tag functional tests.
Unskip all revision tag functional tests added by
commit If0fc9cec1f2382ae5dcf7ff7ebb60d0779df55dd

Change-Id: If95aa4e208fb80cb0f2f66ad4930099b51e1d757
2017-09-08 10:39:27 -04:00
Felipe Monteiro c19309f347 Initial implementation of buckets
This commit adds endpoints for:

  * DELETE /revisions
  * PUT /bucket/{{bucket_name}}/revisions

Included in this commit:

  * Initial DB code for buckets
  * Initial API code for API buckets
  * Refactored unit tests to work with buckets
  * Passing *some* functional tests for:
    - revision-crud-success-single-bucket (*all*)
    - document-crud-success-single-bucket (*some*)
  * Corrected document view for list and corrected
    loads in MultidocJsonpaths for test_gabbi to not
    fix up the response body

Change-Id: Idf941591d24804b77441ab84259f8b7063c88a33
2017-08-24 20:58:26 +01:00
Felipe Monteiro d40e8810ee Add viewbuilder for document creation
This commit adds a ViewBuilder for document creation (the only
API endpoint for documents with an associated view). The view
returns the following body format:

  ---
  revision_id: <created_revision_id>
  documents:
    - <created_doc_id_1>
    - <created_doc_id_2>
    ...

This commit also includes unit tests.

Change-Id: Ic23124bebc861c55881ab1e0096d0418bdbe9bd5
2017-08-15 21:19:25 +01:00