From bd3a80ff23f710dc9b31335fcf16728228874316 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Wed, 4 Dec 2024 17:20:40 -0600 Subject: [PATCH] ci: add test for validation failures --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba7c9dfea..703c69ede 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,21 @@ jobs: with: rdme: openapi:validate "oas-examples-repo/3.1/json/petstore.json" + - name: Run `openapi:validate` on an invalid file + uses: ./rdme-repo/ + id: openapi-validate-fail + continue-on-error: true + with: + rdme: openapi:validate rdme-repo/__tests__/__fixtures__/invalid-oas.json + + - name: Assert that previous validation step failed + if: ${{ steps.openapi-validate-fail.outcome == 'failure' }} + run: echo "The validation in the previous step failed as expected." + + - name: Throw error if previous validation step did not fail + if: ${{ steps.openapi-validate-fail.outcome == 'success' }} + run: echo "::error::Expected validation in previous step to fail" && exit 1 + # Docs: https://rdme-test.readme.io - name: Run `openapi` command uses: ./rdme-repo/