From 4ba095853b7cbe4d1bbdde7d9a25db6f35a77573 Mon Sep 17 00:00:00 2001 From: Jellyfrog Date: Tue, 26 Jan 2021 06:19:31 +0100 Subject: [PATCH] Add test to check if os parameter matches filename (#12442) --- includes/definitions/arubaos-cx.yaml | 2 +- includes/definitions/eatonupsm2.yaml | 2 +- includes/definitions/ts-bspdu.yaml | 2 +- tests/YamlSchemaTest.php | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/definitions/arubaos-cx.yaml b/includes/definitions/arubaos-cx.yaml index 2d7e283d7d..b1f1bf9b03 100644 --- a/includes/definitions/arubaos-cx.yaml +++ b/includes/definitions/arubaos-cx.yaml @@ -1,4 +1,4 @@ -os: arubaos-CX +os: arubaos-cx text: 'ArubaOS-CX' type: network icon: aruba diff --git a/includes/definitions/eatonupsm2.yaml b/includes/definitions/eatonupsm2.yaml index 0726c617c0..a49b502145 100644 --- a/includes/definitions/eatonupsm2.yaml +++ b/includes/definitions/eatonupsm2.yaml @@ -1,4 +1,4 @@ -os: eatonups +os: eatonupsm2 text: 'Eaton UPS' group: ups type: power diff --git a/includes/definitions/ts-bspdu.yaml b/includes/definitions/ts-bspdu.yaml index 958f41b085..99d49c8ba2 100644 --- a/includes/definitions/ts-bspdu.yaml +++ b/includes/definitions/ts-bspdu.yaml @@ -1,4 +1,4 @@ -os: bladeshelterpdu +os: ts-bspdu text: 'BladeShelter PDU by PowerTek' type: power icon: bladeshelterpdu diff --git a/tests/YamlSchemaTest.php b/tests/YamlSchemaTest.php index c5cc308656..85190a9de9 100644 --- a/tests/YamlSchemaTest.php +++ b/tests/YamlSchemaTest.php @@ -53,6 +53,20 @@ class YamlSchemaTest extends TestCase $this->validateYamlFilesAgainstSchema('/includes/definitions', '/misc/os_schema.json'); } + /** + * @group os + */ + public function testOSMatchFilename() + { + foreach ($this->listFiles('/includes/definitions/*.yaml') as $filename => $file) { + $this->assertEquals( + Yaml::parseFile($file)['os'], + substr($filename, 0, -5), + "Parameter 'os' doesn't match the filename $filename" + ); + } + } + /** * @group os */