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 <dblock@amazon.com>
  • Loading branch information
dblock committed May 7, 2024
1 parent 909b02d commit 4ce3af7
Show file tree
Hide file tree
Showing 5 changed files with 1,702 additions and 31 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 Spec

on: [push, pull_request]

env:
OPENSEARCH_INITIAL_ADMIN_PASSWORD: BobgG7YrtsdKf9M

jobs:
integ-tests:
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
6 changes: 6 additions & 0 deletions tools/dredd/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const hooks = require('hooks')

hooks.beforeAll(function (transactions) {
// disable TLS verification, https://github.com/apiaryio/dredd/issues/913#issuecomment-381419699
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
})
1 change: 1 addition & 0 deletions tools/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default [
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false
}
],
'@typescript-eslint/no-var-requires': 'off',
'array-callback-return': 'off',
'new-cap': 'off',
'no-return-assign': 'error',
Expand Down
Loading

0 comments on commit 4ce3af7

Please sign in to comment.