Skip to content

Commit

Permalink
Added testing to the generated OpenAPI.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed May 7, 2024
1 parent 909b02d commit 7973241
Show file tree
Hide file tree
Showing 4 changed files with 1,699 additions and 30 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test

on: [push, pull_request]

env:
OPENSEARCH_INITIAL_ADMIN_PASSWORD: BobgG7YrtsdKf9M

jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Build
working-directory: ./tools
run: |-
mkdir -p ../build
npm install
npm run merge -- ../spec ../build/opensearch-openapi.yaml
- name: Build and Run Docker Container
run: |
docker build coverage --tag opensearch-with-api-plugin
docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e OPENSEARCH_INITIAL_ADMIN_PASSWORD="$OPENSEARCH_INITIAL_ADMIN_PASSWORD" opensearch-with-api-plugin
sleep 15
- name: Display OpenSearch Info
run: |
curl -ks -u "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" https://localhost:9200/ | jq
- name: Test
working-directory: ./tools
run: |-
npm run dredd --user "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" ../build/opensearch-openapi.yaml https://localhost:9200 --hookfiles dredd/all.js
6 changes: 6 additions & 0 deletions tools/dredd/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let hooks = require('hooks')

Check failure on line 1 in tools/dredd/all.js

View workflow job for this annotation

GitHub Actions / tools-tests

'hooks' is never reassigned. Use 'const' instead

Check failure on line 1 in tools/dredd/all.js

View workflow job for this annotation

GitHub Actions / tools-tests

Require statement not part of import statement

hooks.beforeAll(function (transactions) {
// disable TLS verification, https://github.com/apiaryio/dredd/issues/913#issuecomment-381419699
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
});

Check failure on line 6 in tools/dredd/all.js

View workflow job for this annotation

GitHub Actions / tools-tests

Extra semicolon
Loading

0 comments on commit 7973241

Please sign in to comment.