Skip to content

Commit

Permalink
Add malformed YAML test (#45)
Browse files Browse the repository at this point in the history
* Add malformed YAML test

* fix formatting
  • Loading branch information
m4wh6k committed Dec 15, 2022
1 parent 318c92d commit aefa389
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test/server-client/Boardwalkfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from typing import TYPE_CHECKING

from boardwalk import Job, Workflow, Workspace, WorkspaceConfig
from boardwalk import Job, path, Workflow, Workspace, WorkspaceConfig

if TYPE_CHECKING:
from boardwalk import AnsibleTasksType
Expand Down Expand Up @@ -39,6 +39,14 @@ def config(self):
)


class MalformedYAMLWorkspace(Workspace):
def config(self):
return WorkspaceConfig(
host_pattern="localhost",
workflow=MalformedYAMLWorkflow(),
)


class UITestVeryLongWorkflowNameWorkflow(Workflow):
def jobs(self):
return TestJob()
Expand All @@ -54,6 +62,14 @@ def jobs(self):
return FailTestJob()


class MalformedYAMLWorkflow(Workflow):
def jobs(self):
return MalformedYAMLJob()

def exit_jobs(self):
return TestJob()


class TestJob(Job):
def tasks(self) -> AnsibleTasksType:
return [{"debug": {"msg": "hello test"}}]
Expand All @@ -62,3 +78,12 @@ def tasks(self) -> AnsibleTasksType:
class FailTestJob(Job):
def tasks(self) -> AnsibleTasksType:
return [{"fail": {"msg": "failed successfully"}}]


class MalformedYAMLJob(Job):
"""
Tests a playbook that has malformed YAML
"""

def tasks(self) -> AnsibleTasksType:
return [{"import_tasks": path("malformed_playbook.yml")}]
3 changes: 3 additions & 0 deletions test/server-client/malformed_playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- debug:
msg: "Should" fail because yaml string values should be equally quoted on both ends

0 comments on commit aefa389

Please sign in to comment.