A configuration management service with support for secrets.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
7.2KB

  1. # Test success path for rollback with a single bucket.
  2. #
  3. # 1. Purges existing data to ensure test isolation
  4. # 2. Creates a v2 DataSchema
  5. # 3. Checks that schema validation for the DataSchema passes
  6. # 4. Puts a valid document (and LayeringPolicy)
  7. # 5. Checks that the document passes schema pre-validation
  8. # 6. Checks that the document passes schema post-validation
  9. # 7. Puts an invalid document
  10. # 8. Checks that the document fails schema pre-validation
  11. # 9. Checks that the document fails schema post-validation by raising expected
  12. # exception
  13. # 10. Checks that the document entry details adhere to expected validation
  14. # format
  15. # 11. Re-puts the same invalid document with substitutions
  16. # 12. Verify that the substitutions were sanitized in the validation output
  17. defaults:
  18. request_headers:
  19. content-type: application/x-yaml
  20. response_headers:
  21. content-type: application/x-yaml
  22. verbose: true
  23. tests:
  24. - name: purge
  25. desc: Begin testing from known state.
  26. DELETE: /api/v1.0/revisions
  27. status: 204
  28. response_headers: null
  29. - name: create_schema
  30. desc: Add example schema
  31. PUT: /api/v1.0/buckets/mop/documents
  32. status: 200
  33. data: <@resources/sample-schema-v2.yaml
  34. - name: verify_schema_is_valid
  35. desc: Check schema validation of the added schema
  36. GET: /api/v1.0/revisions/$HISTORY['create_schema'].$RESPONSE['$.[0].status.revision']/validations/deckhand-schema-validation
  37. status: 200
  38. response_multidoc_jsonpaths:
  39. $.`len`: 1
  40. $.[0].count: 1
  41. $.[0].results[0].id: 0
  42. $.[0].results[0].status: success
  43. - name: verify_schema_validation_in_list_view
  44. desc: Check schema validation success shows in list view
  45. GET: /api/v1.0/revisions/$HISTORY['create_schema'].$RESPONSE['$.[0].status.revision']/validations
  46. status: 200
  47. response_multidoc_jsonpaths:
  48. $.`len`: 1
  49. $.[0].count: 1
  50. $.[0].results[0].name: deckhand-schema-validation
  51. $.[0].results[0].status: success
  52. - name: add_valid_document
  53. desc: Add a document that follows the schema
  54. PUT: /api/v1.0/buckets/good/documents
  55. status: 200
  56. data: |-
  57. ---
  58. schema: deckhand/LayeringPolicy/v1
  59. metadata:
  60. schema: metadata/Control/v1
  61. name: layering-policy
  62. data:
  63. layerOrder:
  64. - site
  65. ---
  66. schema: example/Doc/v2
  67. metadata:
  68. schema: metadata/Document/v1
  69. name: good
  70. storagePolicy: cleartext
  71. layeringDefinition:
  72. abstract: false
  73. layer: site
  74. data:
  75. a: this-one-is-required
  76. b: 77
  77. - name: verify_document_is_valid_pre_validation
  78. desc: Check schema pre-validation of the added document
  79. GET: /api/v1.0/revisions/$HISTORY['add_valid_document'].$RESPONSE['$.[0].status.revision']/validations/deckhand-schema-validation
  80. status: 200
  81. response_multidoc_jsonpaths:
  82. $.`len`: 1
  83. $.[0].count: 2
  84. $.[0].results[0].id: 0
  85. $.[0].results[0].status: success
  86. - name: verify_document_pre_validation_success_in_list_view
  87. desc: Check document pre-validation success shows in list view
  88. GET: /api/v1.0/revisions/$HISTORY['add_valid_document'].$RESPONSE['$.[0].status.revision']/validations
  89. status: 200
  90. response_multidoc_jsonpaths:
  91. $.`len`: 1
  92. $.[0].count: 1
  93. $.[0].results[*].name: deckhand-schema-validation
  94. $.[0].results[*].status: success
  95. - name: verify_document_is_valid_post_validation
  96. desc: Check that the document passes post-validation
  97. GET: /api/v1.0/revisions/$HISTORY['add_valid_document'].$RESPONSE['$.[0].status.revision']/rendered-documents
  98. status: 200
  99. - name: add_invalid_document
  100. desc: Add a document that does not follow the schema
  101. PUT: /api/v1.0/buckets/bad/documents
  102. status: 200
  103. data: |-
  104. schema: example/Doc/v2
  105. metadata:
  106. schema: metadata/Document/v1
  107. name: bad
  108. storagePolicy: cleartext
  109. layeringDefinition:
  110. abstract: false
  111. layer: site
  112. data:
  113. a: this-one-is-required-and-can-be-different
  114. b: 177
  115. - name: verify_invalid_document_is_valid_pre_validation
  116. desc: Check success of schema pre-validation of the added document
  117. GET: /api/v1.0/revisions/$HISTORY['add_invalid_document'].$RESPONSE['$.[0].status.revision']/validations/deckhand-schema-validation
  118. status: 200
  119. response_multidoc_jsonpaths:
  120. $.`len`: 1
  121. $.[0].count: 1
  122. $.[0].results[*].status: success
  123. - name: verify_document_pre_validation_failure_in_list_view
  124. desc: Check document pre-validation success shows in list view
  125. GET: /api/v1.0/revisions/$HISTORY['add_invalid_document'].$RESPONSE['$.[0].status.revision']/validations
  126. status: 200
  127. response_multidoc_jsonpaths:
  128. $.`len`: 1
  129. $.[0].count: 1
  130. $.[0].results[0].name: deckhand-schema-validation
  131. $.[0].results[0].status: success
  132. - name: verify_document_is_invalid_post_validation
  133. desc: Check that the document fails post-validation
  134. GET: /api/v1.0/revisions/$HISTORY['add_invalid_document'].$RESPONSE['$.[0].status.revision']/rendered-documents
  135. status: 400
  136. response_multidoc_jsonpaths:
  137. $.`len`: 1
  138. $.[0].apiVersion: v1.0
  139. $.[0].code: 400 Bad Request
  140. $.[0].details.errorCount: 1
  141. $.[0].details.errorType: InvalidDocumentFormat
  142. $.[0].details.messageList[0].documents:
  143. - layer: site
  144. name: bad
  145. schema: example/Doc/v2
  146. $.[0].details.messageList[0].error: true
  147. $.[0].details.messageList[0].kind: ValidationMessage
  148. $.[0].details.messageList[0].level: Error
  149. $.[0].details.messageList[0].name: D002
  150. $.[0].kind: Status
  151. $.[0].message: The provided documents failed schema validation
  152. $.[0].reason: Validation
  153. $.[0].status: Failure
  154. - name: add_invalid_document_with_substitutions
  155. desc: Add a document that does not follow the schema
  156. PUT: /api/v1.0/buckets/bad/documents
  157. status: 200
  158. data: |-
  159. ---
  160. schema: example/Doc/v2
  161. metadata:
  162. schema: metadata/Document/v1
  163. name: bad
  164. storagePolicy: cleartext
  165. layeringDefinition:
  166. abstract: false
  167. layer: site
  168. substitutions:
  169. - src:
  170. schema: deckhand/Certificate/v1
  171. name: test-certificate
  172. path: .
  173. dest:
  174. path: .a
  175. data:
  176. a: this-one-is-required-and-can-be-different
  177. b: 177
  178. ---
  179. schema: deckhand/Certificate/v1
  180. metadata:
  181. name: test-certificate
  182. schema: metadata/Document/v1
  183. storagePolicy: cleartext
  184. layeringDefinition:
  185. layer: site
  186. storagePolicy: cleartext
  187. data: this-should-definitely-be-sanitized
  188. - name: verify_document_post_validation_failure_entry_details_hides_secrets
  189. desc: Check document validation failure hides secrets
  190. GET: /api/v1.0/revisions/$HISTORY['add_invalid_document_with_substitutions'].$RESPONSE['$.[0].status.revision']/rendered-documents
  191. status: 400
  192. response_multidoc_jsonpaths:
  193. $.`len`: 1
  194. $.[0].code: 400 Bad Request
  195. $.[0].details.errorCount: 1
  196. $.[0].details.errorType: InvalidDocumentFormat
  197. $.[0].details.messageList[0].diagnostic.error_section:
  198. a: 'Sanitized to avoid exposing secret.'
  199. b: 177