Skip to content

Commit

Permalink
Add create-index blocked solution and switch to npm ci (#465)
Browse files Browse the repository at this point in the history
* Add create-index blocked solution and switch to npm ci

Signed-off-by: Andy Wick <[email protected]>

* Updated CHANGELOG

Signed-off-by: Andy Wick <[email protected]>

* add TOC and replace `npm install` with `npm ci`

Signed-off-by: Andy Wick <[email protected]>

---------

Signed-off-by: Andy Wick <[email protected]>
  • Loading branch information
awick committed Aug 5, 2024
1 parent c0d4a85 commit 21bd106
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/analyze-pr-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
-e OPENSEARCH_INITIAL_ADMIN_PASSWORD="$OPENSEARCH_PASSWORD" \
opensearch-with-api-plugin
npm install
npm ci
npm run dump-cluster-spec -- --opensearch-insecure --output $CLUSTER_SPEC
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Build BEFORE Spec
shell: bash -eo pipefail {0}
run: |
npm install
npm ci
npm run merge -- --source ./spec --output $BEFORE_SPEC
- name: Checkout AFTER Spec
Expand All @@ -82,7 +82,7 @@ jobs:
- name: Build AFTER Spec
shell: bash -eo pipefail {0}
run: |
npm install
npm ci
npm run merge -- --source ./spec --output $AFTER_SPEC
- name: Calculate Coverage
Expand Down Expand Up @@ -216,4 +216,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pr-comment
path: pr-comment.json
path: pr-comment.json
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
node-version: '20'

- name: Build
run: npm install && npm run merge
run: npm ci && npm run merge

- name: Extract Branch Name
id: branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: '20'

- name: Install Dependencies
run: npm install
run: npm ci

- name: Lint
run: npm run lint
2 changes: 1 addition & 1 deletion .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
node-version: '20'

- name: Install Dependencies
run: npm install
run: npm ci

- name: Run OpenSearch Cluster
working-directory: .github/opensearch-cluster
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-tools-integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
node-version: '20'

- name: Install Dependencies
run: npm install
run: npm ci

- name: Tests
run: |
Expand All @@ -52,4 +52,4 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/test-tools-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
node-version: '20'

- name: Install Dependencies
run: npm install
run: npm ci

- name: Tests
run: |
Expand All @@ -42,4 +42,4 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/validate-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: '20'

- name: Install Dependencies
run: npm install
run: npm ci

- name: Lint Spec
run: npm run lint:spec
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added support for request headers in tests [#461](https://github.com/opensearch-project/opensearch-api-specification/pull/461)
- Added metadata additionalProperties to `ErrorCause` ([#462](https://github.com/opensearch-project/opensearch-api-specification/pull/462))
- 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))

### Changed

Expand Down
4 changes: 2 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ A number of [tools](tools) have been authored using TypeScript to aid in the dev

To be able to use or develop the tools, some setup is required:
1. Install [Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).
2. Run `npm install` from the repository's root.
2. Run `npm ci` from the repository's root.

### [Spec Merger](tools/src/merger)

Expand Down Expand Up @@ -360,4 +360,4 @@ This workflow runs on PRs to invoke the [tools' integration tests](tools/tests)

### [Validate Spec](.github/workflows/validate-spec.yml)

This workflow runs on PRs to invoke the [spec linter](#spec-linter) and ensure the multi-file spec is correct and follows the design guidelines.
This workflow runs on PRs to invoke the [spec linter](#spec-linter) and ensure the multi-file spec is correct and follows the design guidelines.
26 changes: 25 additions & 1 deletion TESTING_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<!-- 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)
- [Writing Spec Tests](#writing-spec-tests)
- [Simple Test Story](#simple-test-story)
- [Using Output from Previous Chapters](#using-output-from-previous-chapters)
Expand Down Expand Up @@ -41,7 +44,28 @@ Verbose output:
npm run test:spec -- --opensearch-insecure --verbose
```
Note: Remember to set the `OPENSEARCH_PASSWORD` environment variable everytime you start a new shell to run the tests. Failing to do so will result in 401 Unauthorized errors.
### Common Errors
#### 401 Unauthorized
Remember to set the `OPENSEARCH_PASSWORD` environment variable everytime you start a new shell to run the tests.
#### FORBIDDEN/10/cluster create-index blocked (api)
The cluster is most likely hitting a disk watermark threshold. This example sets the disk watermark thresholds to 1500MB low, 100MB high, and 500MB flood stage, allowing the cluster to create indices even if the disk is almost full.
```bash
curl -k -X PUT --user "admin:${OPENSEARCH_PASSWORD}" https://localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d'
{
"persistent": {
"cluster.routing.allocation.disk.watermark.low": "1500mb",
"cluster.routing.allocation.disk.watermark.high": "1000mb",
"cluster.routing.allocation.disk.watermark.flood_stage": "500mb",
"cluster.blocks.create_index" : null
}
}
'
```
## Writing Spec Tests
Expand Down

0 comments on commit 21bd106

Please sign in to comment.