Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into security-tests
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Aug 8, 2024
2 parents 44160ab + ecf3921 commit aa3f2f3
Show file tree
Hide file tree
Showing 21 changed files with 2,438 additions and 122 deletions.
5 changes: 3 additions & 2 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ aarch
actiongroup
actiongroups
aggregatable
aoss
APIV
argjson
asciifolding
Expand Down Expand Up @@ -129,6 +130,7 @@ readingform
rebalance
Rebalance
recoverysource
Refn
reindex
Reindex
relo
Expand Down Expand Up @@ -184,5 +186,4 @@ urldecode
vectory
whoamiprotected
wordnet
Yrtsd
Refn
Yrtsd
12 changes: 6 additions & 6 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ jobs:
admin_password: admin
- version: 2.0.0
admin_password: admin
- version: 2.15.0
- version: 2.15.0
- version: 2.16.0
- version: 2.16.0
tests: plugins/index_state_management
- version: 2.15.0
tests: snapshot
- version: 2.16.0
tests: snapshot
- version: 2.17.0
hub: opensearchstaging
ref: '@sha256:bcd7f5d5d30231f24f266064248cc8d3306574948190f7bf93016dff29acf17e'
ref: '@sha256:6398c27d7560626ed6b0ba28b3d6b20b7f00c6d94abf45ad3a820f8eeb3d61a3'
- version: 3.0.0
hub: opensearchstaging
ref: '@sha256:db1918b2b8f7ef6c22dd6ff54a0640877c3d395a392a53864745024933981e3b'
ref: '@sha256:101681eea630393f8caf5987dd023a975a9656b63090a07bfdfe6ad2f73f0640'

name: test-opensearch-spec (version=${{ matrix.entry.version }}, hub=${{ matrix.entry.hub || 'opensearchproject' }}, tests=${{ matrix.entry.tests || 'default' }})
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-tools-integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
test:
runs-on: ubuntu-latest
env:
OPENSEARCH_VERSION: 2.15.0
OPENSEARCH_VERSION: 2.16.0
OPENSEARCH_PASSWORD: myStrongPassword123!
OPENSEARCH_URL: https://localhost:9200
steps:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `creation_date` field to `DanglingIndex` ([#462](https://github.com/opensearch-project/opensearch-api-specification/pull/462))
- Added doc on `cluster create-index blocked` workaround ([#465](https://github.com/opensearch-project/opensearch-api-specification/pull/465))
- Added support for reusing output variables as keys in payload expectations ([#471](https://github.com/opensearch-project/opensearch-api-specification/pull/471))
- Added support for running tests against Amazon OpenSearch ([#476](https://github.com/opensearch-project/opensearch-api-specification/pull/476))
- Added tests for security APIs ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))

### Changed
Expand Down Expand Up @@ -107,7 +108,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `/_mapping` with `index` in query ([#385](https://github.com/opensearch-project/opensearch-api-specification/pull/385))
- Fixed duplicate `/_nodes/{node_id}` path ([#416](https://github.com/opensearch-project/opensearch-api-specification/pull/416))
- Fixed `_source` accepting an array of fields in `/_search` ([#430](https://github.com/opensearch-project/opensearch-api-specification/pull/430))
- Fixed `_update_by_query` with a simple term ([451](https://github.com/opensearch-project/opensearch-api-specification/pull/451))
- Fixed `_update_by_query` with a simple term ([#451](https://github.com/opensearch-project/opensearch-api-specification/pull/451))
- Fixed `Duration` to allow for non-integers ([#479](https://github.com/opensearch-project/opensearch-api-specification/pull/479))

### Security

Expand Down
30 changes: 24 additions & 6 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<!-- TOC -->
- [Spec Testing Guide](#spec-testing-guide)
- [Running Spec Tests Locally](#running-spec-tests-locally)
- [Common Errors](#common-errors)
- [401 Unauthorized](#401-unauthorized)
- [FORBIDDEN/10/cluster create-index blocked (api)](#forbidden10cluster-create-index-blocked-api)
- [Running Spec Tests](#running-spec-tests)
- [Running Spec Tests Locally](#running-spec-tests-locally)
- [Running Spec Tests with Amazon OpenSearch](#running-spec-tests-with-amazon-opensearch)
- [Common Errors](#common-errors)
- [401 Unauthorized](#401-unauthorized)
- [FORBIDDEN/10/cluster create-index blocked (api)](#forbidden10cluster-create-index-blocked-api)
- [Writing Spec Tests](#writing-spec-tests)
- [Simple Test Story](#simple-test-story)
- [Using Output from Previous Chapters](#using-output-from-previous-chapters)
Expand All @@ -18,7 +20,9 @@

We have devised our own test framework to test the spec against an OpenSearch cluster. We're still adding more features to the framework as the needs arise, and this document will be updated accordingly. This test framework has also been integrated into the repo's CI/CD pipeline. Checkout the [test-spec](.github/workflows/test-spec.yml) workflow for more details.

## Running Spec Tests Locally
## Running Spec Tests

### Running Spec Tests Locally

Set up an OpenSearch cluster with Docker:

Expand All @@ -44,11 +48,25 @@ Verbose output:
npm run test:spec -- --opensearch-insecure --verbose
```
### Running Spec Tests with Amazon OpenSearch
Use an Amazon OpenSearch service instance.
```bash
export AWS_ACCESS_KEY_ID=<<your AWS access key ID>>
export AWS_SECRET_ACCESS_KEY=<<your AWS secret access key>>
export AWS_SESSION_TOKEN=<<optional AWS session token>>
export AWS_REGION=us-west-2
export OPENSEARCH_URL=https://....us-west-2.es.amazonaws.com
npm run test:spec
```
### Common Errors
#### 401 Unauthorized
Remember to set the `OPENSEARCH_PASSWORD` environment variable everytime you start a new shell to run the tests.
Remember to set the `OPENSEARCH_PASSWORD` or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables every time you start a new shell to run the tests.
#### FORBIDDEN/10/cluster create-index blocked (api)
Expand Down
6 changes: 5 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import pluginTs from '@typescript-eslint/eslint-plugin'
import pluginYml from 'eslint-plugin-yml'
import pluginCspell from '@cspell/eslint-plugin'
import pluginStylistic from '@stylistic/eslint-plugin'
import pluginJest from 'eslint-plugin-jest'

export default [
pluginJs.configs.recommended,
Expand All @@ -28,7 +29,8 @@ export default [
'license-header': pluginLicenseHeader,
'eslint-comments': pluginComments,
'@cspell': pluginCspell,
'@stylistic': pluginStylistic
'@stylistic': pluginStylistic,
'jest': pluginJest
},
rules: {
...pluginJs.configs.recommended.rules,
Expand Down Expand Up @@ -78,6 +80,8 @@ export default [
],
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
'array-callback-return': 'off',
'indent': ['error', 2, { 'SwitchCase': 1 }],
'new-cap': 'off',
Expand Down
Loading

0 comments on commit aa3f2f3

Please sign in to comment.