Skip to content

Commit

Permalink
Actively wait for cluster to come up and display version.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Jul 11, 2024
1 parent 07950a8 commit cdcbab8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ nysiis
opendistro
opensearch
opensearchproject
opensearchstaging
ords
oversample
performanceanalyzer
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
strategy:
matrix:
entry:
- { version: 2.15.0, hub: 'opensearchproject' }
- { version: 2.16.0, hub: 'opensearchstaging' }
- {version: 2.15.0, hub: 'opensearchproject'}
- {version: 2.16.0, hub: 'opensearchstaging'}
name: test-opensearch-spec (version=${{ matrix.entry.version }}, hub=${{ matrix.entry.hub }})
runs-on: ubuntu-latest
env:
Expand All @@ -43,7 +43,7 @@ jobs:

- name: Run OpenSearch Cluster
working-directory: .github/opensearch-cluster
run: docker-compose up -d && sleep 60
run: docker-compose up -d

- name: Run Tests
run: npm run test:spec -- --opensearch-insecure
2 changes: 1 addition & 1 deletion tools/src/OpenSearchHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class OpenSearchHttpClient {
attempt += 1
try {
const info = await this.get('/')
return info.data
return JSON.parse(info.data as string)
} catch (e) {
if (attempt >= max_attempts) {
throw e
Expand Down
16 changes: 10 additions & 6 deletions tools/src/tester/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as process from 'node:process'
import SupplementalChapterEvaluator from './SupplementalChapterEvaluator'
import MergedOpenApiSpec from './MergedOpenApiSpec'
import StoryValidator from "./StoryValidator";
import * as ansi from './Ansi'

const command = new Command()
.description('Run test stories against the OpenSearch spec.')
Expand Down Expand Up @@ -60,9 +61,12 @@ const story_evaluator = new StoryEvaluator(chapter_evaluator, supplemental_chapt
const result_logger = new ConsoleResultLogger(opts.tabWidth, opts.verbose)
const runner = new TestRunner(story_validator, story_evaluator, result_logger)

runner.run(opts.testsPath, opts.dryRun)
.then(
({ failed }) => {
if (failed) process.exit(1)
},
err => { throw err })
http_client.wait_until_available().then((info) => {
console.log(`OpenSearch ${ansi.green(info.version.number)}\n`)
runner.run(opts.testsPath, opts.dryRun)
.then(
({ failed }) => {
if (failed) process.exit(1)
},
err => { throw err })
}, err => { throw err })

0 comments on commit cdcbab8

Please sign in to comment.