wire-server icon indicating copy to clipboard operation
wire-server copied to clipboard

[WPB-10314] validate swagger: add swagger linter to integration tests (so it'll run in CI).

Open fisx opened this issue 1 year ago • 1 comments

$ make -C ~/src/wire-server ci-safe package=integration TEST_INCLUDE=testSwaggerLint
[...]
----- Swagger.testSwaggerLint FAIL (3.84 s) -----
exception:
(ExitFailure 1,"\n\ESC[95m\ESC[0m\n\ESC[95m\9608\9608\9559   \9608\9608\9559 \9608\9608\9608\9608\9608\9559  \9608\9608\9608\9608\9608\9608\9559\9608\9608\9559   \9608\9608\9559\9608\9608\9559   \9608\9608\9559\9608\9608\9608\9559   \9608\9608\9608\9559\ESC[0m\n\ESC[95m\9608\9608\9553   \9608\9608\9553\9608\9608\9556\9552\9552\9608\9608\9559\9608\9608\9556\9552\9552\9552\9552\9565\9608\9608\9553   \9608\9608\9553\9608\9608\9553   \9608\9608\9553\9608\9608\9608\9608\9559 \9608\9608\9608\9608\9553\ESC[0m\n\ESC[95m\9608\9608\9553   \9608\9608\9553\9608\9608\9608\9608\9608\9608\9608\9553\9608\9608\9553     \9608\9608\9553   \9608\9608\9553\9608\9608\9553   \9608\9608\9553\9608\9608\9556\9608\9608\9608\9608\9556\9608\9608\9553\ESC[0m\n\ESC[95m\9562\9608\9608\9559 \9608\9608\9556\9565\9608\9608\9556\9552\9552\9608\9608\9553\9608\9608\9553     \9608\9608\9553   \9608\9608\9553\9608\9608\9553   \9608\9608\9553\9608\9608\9553\9562\9608\9608\9556\9565\9608\9608\9553\ESC[0m\n\ESC[95m \9562\9608\9608\9608\9608\9556\9565 \9608\9608\9553  \9608\9608\9553\9562\9608\9608\9608\9608\9608\9608\9559\9562\9608\9608\9608\9608\9608\9608\9556\9565\9562\9608\9608\9608\9608\9608\9608\9556\9565\9608\9608\9553 \9562\9552\9565 \9608\9608\9553\ESC[0m\n\ESC[95m  \9562\9552\9552\9552\9565  \9562\9552\9565  \9562\9552\9565 \9562\9552\9552\9552\9552\9552\9565 \9562\9552\9552\9552\9552\9552\9565  \9562\9552\9552\9552\9552\9552\9565 \9562\9552\9565     \9562\9552\9565\ESC[0m\n\ESC[95m\ESC[0m\n\nversion: \ESC[92mv0.12.1\ESC[0m | compiled: \ESC[92mTue, 22 Oct 2024 17:49:58 CEST\ESC[0m\n\ESC[36m\128279 https://quobix.com/vacuum | https://github.com/daveshanley/vacuum\ESC[0m\n\n\n\ESC[30;46m\ESC[30;46m INFO \ESC[0m\ESC[0m \ESC[96m\ESC[96mLinting file 'swagger.json' against 44 rules: https://quobix.com/vacuum/rulesets/recommended\ESC[0m\ESC[0m\n\n\ESC[96m\ESC[96mCategory    \ESC[90m\ESC[90m | \ESC[0m\ESC[96m\ESC[0m\ESC[96m\ESC[91mErrors\ESC[0m\ESC[96m\ESC[90m\ESC[90m | \ESC[0m\ESC[96m\ESC[0m\ESC[96m\ESC[93mWarnings\ESC[0m\ESC[96m\ESC[90m\ESC[90m | \ESC[0m\ESC[96m\ESC[0m\ESC[96m\ESC[94mInfo\ESC[0m\ESC[96m\ESC[0m\n\ESC[96m\ESC[0m\ESC[0mOperations  \ESC[90m\ESC[90m | \ESC[0m\ESC[0m31    \ESC[90m\ESC[90m | \ESC[0m\ESC[0m20      \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0\nTags        \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m262     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0\nSchemas     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m13      \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0\nDescriptions\ESC[90m\ESC[90m | \ESC[0m\ESC[0m0     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m701     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m518\nExamples    \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0     \ESC[90m\ESC[90m | \ESC[0m\ESC[0m2,964   \ESC[90m\ESC[90m | \ESC[0m\ESC[0m0\n\n\ESC[41m\ESC[41m                                                                                \ESC[0m\ESC[0m\n\ESC[41m\ESC[41m\ESC[97;1m\ESC[97;1m          Linting file 'swagger.json' failed with 31 errors, 3,960 war          \ESC[0m\ESC[41m\ESC[0m\ESC[41m\ESC[0m\ESC[0m\n\ESC[41m\ESC[41m\ESC[97;1m\ESC[97;1m          nings and 518 informs                                                 \ESC[0m\ESC[41m\ESC[0m\ESC[41m\ESC[0m\ESC[0m\n\ESC[41m\ESC[41m                                                                                \ESC[0m\ESC[0m\n\n\ESC[30;46m\ESC[30;46m INFO \ESC[0m\ESC[0m \ESC[96m\ESC[96mTo see full details of linting report, use the '-d' flag.\ESC[0m\ESC[0m\n\nError: failed with 31 errors\n","  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r100  488k    0  488k    0     0  3083k      0 --:--:-- --:--:-- --:--:-- 3093k\n")
CallStack (from HasCallStack):
  error, called at test/Test/Swagger.hs:100:14 in integration-0.1.0-inplace:Test.Swagger
  testSwaggerLint, called at /home/mf/src/wire-server/dist-newstyle/build/x86_64-linux/ghc-9.6.6/integration-0.1.0/noopt/build/autogen/RunAllTests.hs:79:53 in integration-0.1.0-inplace:RunAllTests

----------
1 test run.

1 failed test: 
 - Swagger.testSwaggerLint
[...]

the colour rendering of stdout from vacuum doesn't work, but i don't think that's needed. this is mostly to prompt the PR owner to try this again locally, and also you can still find bits and pieces of useful information (grep for error).

Checklist

  • [ ] Add a new entry in an appropriate subdirectory of changelog.d
  • [ ] Read and follow the PR guidelines

fisx avatar Oct 22 '24 14:10 fisx

Didn't we say the plan was to write a tool that produces the swagger JSON at linting time? Adding this to integration tests feels wrong.

pcapriotti avatar Oct 23 '24 06:10 pcapriotti

This was actually still missing fixes for galley's internal API swagger. I wasn't expecting you to merge. It's fine, I'll make a new PR.

pcapriotti avatar Oct 28 '24 06:10 pcapriotti