Add functional test for validating single source multi dest substitution
This patchset fixes a schema bug to allow for single source multi dest substitution to work (it is currently rendering successfully but failing on validation as the base Deckhand validation schema was not updated). This adds a functional test to avoid regression. Also fixes failed_when condition for functional-tests and integration-tests roles to check if 'commands failed' appears in stdout which only happens when pytest runner fails. Change-Id: I9bb0c51b3374bbaf9fd34d5f93f1a1777bb3b1e8
This commit is contained in:
parent
807990a099
commit
108ac7c216
@ -35,6 +35,16 @@ data:
|
||||
actions:
|
||||
required:
|
||||
- parentSelector
|
||||
substitution_dest:
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
pattern:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
required:
|
||||
- path
|
||||
|
||||
properties:
|
||||
schema:
|
||||
@ -92,15 +102,12 @@ data:
|
||||
type: object
|
||||
properties:
|
||||
dest:
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
pattern:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
required:
|
||||
- path
|
||||
anyOf:
|
||||
- $ref: "#/definitions/substitution_dest"
|
||||
- type: array
|
||||
minItems: 1
|
||||
items:
|
||||
$ref: "#/definitions/substitution_dest"
|
||||
src:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -0,0 +1,82 @@
|
||||
# Tests success path for substitutions involving a single substitution source
|
||||
# feeding multiple destionation paths.
|
||||
#
|
||||
# 1. Purges existing data to ensure test isolation
|
||||
# 2. Creates necessary substitution documents.
|
||||
# 3. Validates that the destination document has the expected data across all
|
||||
# expected destination paths.
|
||||
|
||||
defaults:
|
||||
request_headers:
|
||||
content-type: application/x-yaml
|
||||
response_headers:
|
||||
content-type: application/x-yaml
|
||||
verbose: true
|
||||
|
||||
tests:
|
||||
- name: purge
|
||||
desc: Begin testing from known state.
|
||||
DELETE: /api/v1.0/revisions
|
||||
status: 204
|
||||
response_headers: null
|
||||
|
||||
- name: add_substitution_source_with_single_source_multi_dest
|
||||
desc: |-
|
||||
Create documents to test a single substitution source document feeding
|
||||
multiple destination paths.
|
||||
PUT: /api/v1.0/buckets/a/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
schema: deckhand/LayeringPolicy/v1
|
||||
metadata:
|
||||
schema: metadata/Control/v1
|
||||
name: layering-policy
|
||||
data:
|
||||
layerOrder:
|
||||
- site
|
||||
---
|
||||
schema: deckhand/Certificate/v1
|
||||
metadata:
|
||||
name: example-cert
|
||||
schema: metadata/Document/v1
|
||||
layeringDefinition:
|
||||
layer: site
|
||||
storagePolicy: cleartext
|
||||
data: |
|
||||
CERTIFICATE DATA
|
||||
---
|
||||
schema: armada/Chart/v1
|
||||
metadata:
|
||||
name: example-chart-01
|
||||
schema: metadata/Document/v1
|
||||
layeringDefinition:
|
||||
layer: site
|
||||
substitutions:
|
||||
- dest:
|
||||
- path: .chart.values.tls.certificate
|
||||
- path: .chart.values.tls.duplicate_certificate
|
||||
src:
|
||||
schema: deckhand/Certificate/v1
|
||||
name: example-cert
|
||||
path: .
|
||||
data: {}
|
||||
...
|
||||
|
||||
- name: verify_substitutions
|
||||
desc: Check for expected substitutions
|
||||
GET: /api/v1.0/revisions/$RESPONSE['$.[0].status.revision']/rendered-documents
|
||||
query_parameters:
|
||||
schema: armada/Chart/v1
|
||||
status: 200
|
||||
response_multidoc_jsonpaths:
|
||||
$.`len`: 1
|
||||
$.[*].metadata.name: example-chart-01
|
||||
$.[*].data:
|
||||
chart:
|
||||
values:
|
||||
tls:
|
||||
certificate: |
|
||||
CERTIFICATE DATA
|
||||
duplicate_certificate: |
|
||||
CERTIFICATE DATA
|
@ -22,4 +22,4 @@
|
||||
DECKHAND_TEST_URL: "127.0.0.1:9000"
|
||||
DECKHAND_TEST_DIR: "{{ airship_deckhand_path.stdout }}/deckhand/tests/functional/gabbits"
|
||||
register: result
|
||||
failed_when: "'Done SUCCESS' not in result.stdout and 'PASSED' not in result.stdout"
|
||||
failed_when: "'commands failed' in result.stdout"
|
||||
|
@ -27,4 +27,4 @@
|
||||
DECKHAND_TEST_URL: "127.0.0.1:9000"
|
||||
DECKHAND_TEST_DIR: "{{ airship_deckhand_path.stdout }}/deckhand/tests/integration/gabbits"
|
||||
register: result
|
||||
failed_when: "'Done SUCCESS' not in result.stdout and 'PASSED' not in result.stdout"
|
||||
failed_when: "'commands failed' in result.stdout"
|
||||
|
Loading…
Reference in New Issue
Block a user