Skip to content

Commit e4e110e

Browse files
authored
Merge branch 'main' into generates_main_code
2 parents 2d591ce + 445b36f commit e4e110e

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

.buildkite/create-serverless.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export EC_PROJECT_NAME="$EC_PROJECT_PREFIX-$BUILDKITE_JOB_ID"
1010

1111
# fetch cloud creds used by qaf
1212
CLOUD_ACCESS_KEY=$(vault read -field="$EC_ENV" "$CLOUD_CREDENTIALS_PATH")
13-
echo "{\"api_key\":{\"$EC_ENV\":\"$CLOUD_ACCESS_KEY\"}}" > "$(pwd)/cloud.json"
13+
echo "{\"api_key\":{\"$EC_ENV\":\"$CLOUD_ACCESS_KEY\"}}" >"$(pwd)/cloud.json"
1414

1515
run_qaf() {
1616
cmd=$1

.buildkite/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ steps:
99
nodejs:
1010
- "18"
1111
- "20"
12+
- "22"
1213
env:
1314
NODE_VERSION: "{{ matrix.nodejs }}"
1415
EC_PROJECT_PREFIX: "elasticsearch-serverless-js-node{{ matrix.nodejs }}"

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Detect files changed
99
runs-on: ubuntu-latest
1010
outputs:
11-
src-only: '${{ steps.changes.outputs.src-only }}'
11+
src-only: "${{ steps.changes.outputs.src-only }}"
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: dorny/paths-filter/@v2.11.1
@@ -28,7 +28,7 @@ jobs:
2828

2929
strategy:
3030
matrix:
31-
node-version: [18.x, 20.x]
31+
node-version: [18.x, 20.x, 22.x]
3232
os: [ubuntu-latest, windows-latest, macOS-latest]
3333

3434
steps:
@@ -57,7 +57,7 @@ jobs:
5757

5858
strategy:
5959
matrix:
60-
node-version: [20.x]
60+
node-version: [22.x]
6161

6262
steps:
6363
- uses: actions/checkout@v4

test/integration/index.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ const skips = {
5858
// TODO: expects {"outlier_detection.auc_roc.value":0.99995}, gets {"outlier_detection.auc_roc.value":0.5}
5959
// remove if/when https://github.com/elastic/elasticsearch-clients-tests/issues/37 is resolved
6060
'machine_learning/data_frame_evaluate.yml': ['*'],
61+
// TODO: wait_for_active_shards and rollover with conditions are not supported on serverless
62+
// see https://github.com/elastic/elasticsearch-clients-tests/issues/55
63+
'indices/rollover.yml': ['*'],
64+
// TODO: test runner needs to support ignoring 410 errors
65+
'indices/data_lifecycle.yml': ['*'],
66+
// TODO: test runner needs to support ignoring 410 errors
67+
'enrich/10_basic.yml': ['*'],
68+
6169
}
6270

6371
const shouldSkip = (file, name) => {
@@ -132,9 +140,9 @@ async function start ({ client }) {
132140
const fileTime = now()
133141
const data = readFileSync(file, 'utf8')
134142

135-
// get the test yaml (as object), some file has multiple yaml documents inside,
136-
// every document is separated by '---', so we split on the separator
137-
// and then we remove the empty strings, finally we parse them
143+
// get the test yaml as an object. files have multiple YAML documents inside,
144+
// separated by '---', so we split on the separator and remove the empty strings
145+
// before parsing them
138146
const tests = data
139147
.split('\n---\n')
140148
.map(s => s.trim())
@@ -144,27 +152,32 @@ async function start ({ client }) {
144152
// null values
145153
.filter(Boolean)
146154

147-
// get setup and teardown if present
155+
// get setup, teardown and requires rules if present
148156
let setupTest = null
149157
let teardownTest = null
158+
let requires = null
150159
for (const test of tests) {
151160
if (test.setup) setupTest = test.setup
152161
if (test.teardown) teardownTest = test.teardown
162+
if (test.requires) requires = test.requires
153163
}
154164

155165
const cleanPath = file.slice(file.lastIndexOf(apiName))
156166

157167
// skip if --suite CLI arg doesn't match
158168
if (options.suite && !cleanPath.endsWith(options.suite)) continue
159169

170+
// skip if `requires.serverless` is not true
171+
if (typeof requires === 'object' && requires.serverless != true) continue
172+
160173
const junitTestSuite = junitTestSuites.testsuite(apiName.slice(1) + ' - ' + cleanPath)
161174

162175
for (const test of tests) {
163176
const testTime = now()
164177
const name = Object.keys(test)[0]
165178

166179
// skip setups, teardowns and anything that doesn't match --test flag when present
167-
if (name === 'setup' || name === 'teardown') continue
180+
if (name === 'setup' || name === 'teardown' || name === 'requires') continue
168181
if (options.test && !name.endsWith(options.test)) continue
169182

170183
const junitTestCase = junitTestSuite.testcase(name, `node_${process.version}: ${cleanPath}`)

test/integration/test-runner.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,14 @@ function build (opts = {}) {
308308
if (JSON.stringify(exc).includes('resource_already_exists_exception')) {
309309
console.warn(`Resource already exists: ${JSON.stringify(cmd.params)}`)
310310
// setup task was already done because cleanup didn't catch it? do nothing
311+
} else if (JSON.stringify(exc).includes('api_not_available_exception')) {
312+
// 410 api_not_available_exception should be ignored
313+
console.warn(`API not available on serverless: ${cmd.method}`)
311314
} else {
312315
throw exc
313316
}
314317
}
318+
315319
let warnings = result ? result.warnings : null
316320
const body = result ? result.body : null
317321

@@ -881,6 +885,7 @@ async function deleteIndices(client) {
881885
.trim()
882886
.split('\n')
883887
.map(row => row.split(' ')[2])
888+
.filter(Boolean)
884889
.filter(name => !name.startsWith('.'))
885890
if (indexNames.length > 0) {
886891
await client.indices.delete({

0 commit comments

Comments
 (0)