Fix to DeploymentData generation

Reorganized DeploymentData to match spec, added Deckhand validation to
unit tests for Pegleg collect.

Change-Id: I9d8d5819bfd55b960ae7dd3c93f5a03b4ea364f1
This commit is contained in:
Lev Morgan 2019-05-21 09:45:46 -05:00
parent 673b6a9c52
commit aefa569cad
2 changed files with 13 additions and 10 deletions

View File

@ -164,12 +164,12 @@ def _get_deployment_data_doc():
"metadata": { "metadata": {
"schema": "metadata/Document/v1", "schema": "metadata/Document/v1",
"name": "deployment-version", "name": "deployment-version",
"layeringDefinition": {
"abstract": False,
"layer": "global"
},
"storagePolicy": "cleartext",
}, },
"layeringDefinition": {
"abstract": "false",
"layer": "global"
},
"storagePolicy": "cleartext",
"data": { "data": {
"documents": stanzas "documents": stanzas
} }

View File

@ -19,13 +19,8 @@ import yaml
import click import click
from pegleg import cli
from pegleg import config
from pegleg.engine import errorcodes
from pegleg.engine import lint
from pegleg.engine import site from pegleg.engine import site
from pegleg.engine.util import deckhand from pegleg.engine.util import deckhand
from pegleg.engine.util import files
from tests.unit.fixtures import create_tmp_deployment_files from tests.unit.fixtures import create_tmp_deployment_files
@ -79,6 +74,14 @@ def _test_site_collect_to_file(tmpdir, site_name, collection_path):
assert sorted(_expected_document_names(site_name)) == sorted( assert sorted(_expected_document_names(site_name)) == sorted(
[x['metadata']['name'] for x in deployment_documents]) [x['metadata']['name'] for x in deployment_documents])
assert "pegleg/DeploymentData/v1" in lines assert "pegleg/DeploymentData/v1" in lines
# Make sure our generated YAMLs are valid
deckhand.deckhand_render(
documents=deployment_documents,
fail_on_missing_sub_src=False,
validate=True,
)
finally: finally:
if os.path.exists(collection_str_path): if os.path.exists(collection_str_path):
shutil.rmtree(collection_str_path, ignore_errors=True) shutil.rmtree(collection_str_path, ignore_errors=True)