Skip to content

Commit

Permalink
fixing tests for sql namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh committed Jul 21, 2024
1 parent cb81586 commit 7ae06fb
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
Empty file added .env
Empty file.
28 changes: 20 additions & 8 deletions tests/sql/close.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,42 @@ prologues:
- path: /{index}
method: PUT
parameters:
index: books
index: books1
request_body:
payload: {}
epilogues:
- path: /books
- path: /books1
method: DELETE
status: [200, 404]
chapters:
- synopsis: Get SQL query
- synopsis: Create a document.
path: /{index}/_doc
method: POST
parameters:
index: books
request_body:
payload:
title: Beauty and the Beast
year: 1991
response:
status: 201
- synopsis: Get SQL query.
id: query_sql
path: /_plugins/_sql
method: POST
request_body:
payload:
query: SELECT * FROM books
fetch_size: 1
query: SELECT * FROM books
response:
status: 200
output:
cursor: "payload.cursor"
status: [200]
- synopsis: Close cursor
path: /_plugins/_sql/close
method: POST
request_body:
payload:
cursor:
- ${query_sql.cursor}
status: [200]
cursor: ${query_sql.cursor}
response:
status: 200
9 changes: 4 additions & 5 deletions tests/sql/explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ $schema: ../../json_schemas/test_story.schema.yaml
description: Test how a query is executed against OpenSearch.

prologues:
- path: /{index}
- path: /books
method: PUT
parameters:
index: books
request_body:
payload: {}
epilogues:
Expand All @@ -15,9 +13,10 @@ epilogues:
status: [200, 404]
chapters:
- synopsis: Get explain of SQL Query
path: /_plugins/_sql/explain
path: /_plugins/_sql/_explain
method: POST
request_body:
payload:
query: SELECT * FROM books
status: [200]
response:
status: 200
7 changes: 4 additions & 3 deletions tests/sql/query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ epilogues:
status: [200, 404]
chapters:
- synopsis: Get SQL query
path: /_plugins/_sql/
path: /_plugins/_sql
method: POST
request_body:
payload:
query: SELECT * FROM books
status: [200]
query: "SELECT * FROM books"
response:
status: 200
20 changes: 3 additions & 17 deletions tests/sql/stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,9 @@ $schema: ../../json_schemas/test_story.schema.yaml

description: Test get SQL Queries stats.

prologues:
- path: /{index}
method: PUT
parameters:
index: books
request_body:
payload: {}
epilogues:
- path: /books
method: DELETE
status: [200, 404]

chapters:
- synopsis: Get stats from SQL Query
- synopsis: Get stats from SQL Query.
path: /_plugins/_sql/stats
method: POST
request_body:
payload:
query: SELECT * FROM books
status: [200]
response:
status: 200
2 changes: 1 addition & 1 deletion tools/src/OpenSearchHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse,
import * as https from 'node:https'
import { sleep } from './helpers'

const DEFAULT_URL = 'https://localhost:9200'
const DEFAULT_URL = 'http://localhost:9200'
const DEFAULT_USER = 'admin'
const DEFAULT_INSECURE = false

Expand Down

0 comments on commit 7ae06fb

Please sign in to comment.