Skip to content

Commit c632227

Browse files
dianpopaandreeaflorescu
authored andcommitted
CI: check the format of the swagger spec...
file as part of the test_style integration test. Signed-off-by: Diana Popa <[email protected]>
1 parent 6131da7 commit c632227

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

api_server/swagger/firecracker.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ definitions:
308308
description:
309309
Boot source descriptor.
310310
properties:
311-
kernel_image_path:
312-
type: string
313-
description: Host level path to the kernel image used to boot the guest
311+
kernel_image_path:
312+
type: string
313+
description: Host level path to the kernel image used to boot the guest
314314
boot_args:
315315
type: string
316316
description: Kernel boot arguments

tests/integration_tests/build/test_style.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
from subprocess import run, PIPE
44

5+
import os
6+
57
import pytest
8+
import yaml
69

710

811
SUCCESS_CODE = 0
@@ -76,3 +79,16 @@ def test_python_style():
7679
shell=True,
7780
check=True
7881
)
82+
83+
84+
def test_yaml_style():
85+
"""Fail if our swagger specification is malformed."""
86+
yaml_spec = os.path.normpath(
87+
os.path.join(os.getcwd(), '../api_server/swagger/firecracker.yaml')
88+
)
89+
with open(yaml_spec, 'r') as file_stream:
90+
try:
91+
yaml.safe_load(file_stream)
92+
# pylint: disable=broad-except
93+
except Exception as exception:
94+
print(str(exception))

tests/testrun.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ declare -ra PYTHON_DEPS=( \
5050
retry \
5151
nsenter \
5252
pylint pycodestyle pydocstyle \
53+
pyyaml \
5354
)
5455

5556
declare -r RUSTUP_URL=https://sh.rustup.rs

0 commit comments

Comments
 (0)