From db9662ffed0047fee591d7214355160701c90512 Mon Sep 17 00:00:00 2001 From: f1ames Date: Fri, 25 Aug 2023 11:22:56 +0200 Subject: [PATCH] test: restore K8S plugin 'noapiversion' test logic --- .../__tests__/MonokleValidator.kubernetes-schema.test.ts | 6 ++++++ .../src/__tests__/resources/no-apiversion/resources.yaml | 1 + 2 files changed, 7 insertions(+) diff --git a/packages/validation/src/__tests__/MonokleValidator.kubernetes-schema.test.ts b/packages/validation/src/__tests__/MonokleValidator.kubernetes-schema.test.ts index ec370432f..f6a32681a 100644 --- a/packages/validation/src/__tests__/MonokleValidator.kubernetes-schema.test.ts +++ b/packages/validation/src/__tests__/MonokleValidator.kubernetes-schema.test.ts @@ -98,6 +98,12 @@ async function processResourcesInFolder(path: string, schemaVersion?: string) { const files = await readDirectory(path); const resources = extractK8sResources(files); + resources.forEach(r => { + if (r.apiVersion === 'test-remove') { + (r as any).apiVersion = undefined; + } + }); + const parser = new ResourceParser(); const validator = createDefaultMonokleValidator(parser); diff --git a/packages/validation/src/__tests__/resources/no-apiversion/resources.yaml b/packages/validation/src/__tests__/resources/no-apiversion/resources.yaml index 82b02a497..bc70daa52 100644 --- a/packages/validation/src/__tests__/resources/no-apiversion/resources.yaml +++ b/packages/validation/src/__tests__/resources/no-apiversion/resources.yaml @@ -39,6 +39,7 @@ spec: group: name: "system:unauthenticated" --- +apiVersion: 'test-remove' kind: Pod metadata: name: pod-warning