More integration test fixes (#1889)
This commit is contained in:
@ -29,3 +29,4 @@ steps:
|
||||
artifacts: "junit-output/junit-*.xml"
|
||||
job-uuid-file-pattern: 'junit-(.*).xml'
|
||||
fail-build-on-error: true
|
||||
failure-format: file
|
||||
|
||||
@ -33,7 +33,10 @@ master_node_name=${es_node_name}
|
||||
cluster_name=${moniker}${suffix}
|
||||
|
||||
# Set vm.max_map_count kernel setting to 262144
|
||||
sudo sysctl -w vm.max_map_count=262144
|
||||
if [ "$(sysctl vm.max_map_count)" != 'vm.max_map_count = 262144' ]; then
|
||||
echo "vm.max_map_count may be too low. resetting."
|
||||
sudo sysctl -w vm.max_map_count=262144
|
||||
fi
|
||||
|
||||
declare -a volumes
|
||||
environment=($(cat <<-END
|
||||
|
||||
@ -89,7 +89,7 @@ async function bump (args) {
|
||||
const pipeline = await readFile(join(import.meta.url, '..', '.buildkite', 'pipeline.yml'))
|
||||
await writeFile(
|
||||
join(import.meta.url, '..', '.buildkite', 'pipeline.yml'),
|
||||
pipeline.replace(/STACK_VERSION: [0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?/, `STACK_VERSION: - ${cleanVersion}-SNAPSHOT`), // eslint-disable-line
|
||||
pipeline.replace(/STACK_VERSION: [0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?/, `STACK_VERSION: ${cleanVersion}-SNAPSHOT`), // eslint-disable-line
|
||||
'utf8'
|
||||
)
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ scripts
|
||||
# ci configuration
|
||||
.ci
|
||||
.travis.yml
|
||||
.buildkite
|
||||
certs
|
||||
.github
|
||||
CODE_OF_CONDUCT.md
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# Elasticsearch Node.js client
|
||||
|
||||
[](http://standardjs.com/) [](https://clients-ci.elastic.co/view/JavaScript/job/elastic+elasticsearch-js+main/) [](https://github.com/elastic/elasticsearch-js/actions/workflows/nodejs.yml) [](https://codecov.io/gh/elastic/elasticsearch-js) [](https://www.npmjs.com/package/@elastic/elasticsearch)
|
||||
[](http://standardjs.com/) [](https://buildkite.com/elastic/elasticsearch-javascript-client-integration-tests/builds?branch=main) [](https://github.com/elastic/elasticsearch-js/actions/workflows/nodejs.yml) [](https://codecov.io/gh/elastic/elasticsearch-js) [](https://www.npmjs.com/package/@elastic/elasticsearch)
|
||||
|
||||
The official Node.js client for Elasticsearch.
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ spec:
|
||||
apiVersion: buildkite.elastic.dev/v1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: Elasticsearch JavaScript client integration tests
|
||||
name: elasticsearch-js - integration tests
|
||||
spec:
|
||||
repository: elastic/elasticsearch-js
|
||||
pipeline_file: .buildkite/pipeline.yml
|
||||
|
||||
@ -61,9 +61,9 @@
|
||||
"@types/split2": "^3.2.1",
|
||||
"@types/stoppable": "^1.1.1",
|
||||
"@types/tap": "^15.0.7",
|
||||
"chai": "^4.3.7",
|
||||
"cross-zip": "^4.0.0",
|
||||
"desm": "^1.2.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"into-stream": "^7.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"license-checker": "^25.0.1",
|
||||
@ -83,7 +83,7 @@
|
||||
"typescript": "^4.6.4",
|
||||
"workq": "^3.0.0",
|
||||
"xmlbuilder2": "^3.0.2",
|
||||
"zx": "^6.1.0"
|
||||
"zx": "^7.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/transport": "^8.3.1",
|
||||
|
||||
@ -48,6 +48,13 @@ const options = minimist(process.argv.slice(2), {
|
||||
})
|
||||
|
||||
const freeSkips = {
|
||||
// working on fixes for these
|
||||
'/free/aggregations/bucket_selector.yml': ['bad script'],
|
||||
'/free/aggregations/bucket_script.yml': ['bad script'],
|
||||
|
||||
// either the YAML test definition is wrong, or this fails because JSON.stringify is coercing "1.0" to "1"
|
||||
'/free/aggregations/percentiles_bucket.yml': ['*'],
|
||||
|
||||
// not supported yet
|
||||
'/free/cluster.desired_nodes/10_basic.yml': ['*'],
|
||||
|
||||
@ -186,7 +193,7 @@ function runner (opts = {}) {
|
||||
const options = { node: opts.node }
|
||||
if (opts.isXPack) {
|
||||
options.tls = {
|
||||
ca: readFileSync(join(__dirname, '..', '..', '.ci', 'certs', 'ca.crt'), 'utf8'),
|
||||
ca: readFileSync(join(__dirname, '..', '..', '.buildkite', 'certs', 'ca.crt'), 'utf8'),
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
}
|
||||
@ -310,7 +317,7 @@ async function start ({ client, isXPack }) {
|
||||
if (name === 'setup' || name === 'teardown') continue
|
||||
if (options.test && !name.endsWith(options.test)) continue
|
||||
|
||||
const junitTestCase = junitTestSuite.testcase(name)
|
||||
const junitTestCase = junitTestSuite.testcase(name, `node_${process.version}/${cleanPath}`)
|
||||
|
||||
stats.total += 1
|
||||
if (shouldSkip(isXPack, file, name)) {
|
||||
|
||||
@ -73,13 +73,14 @@ function createJunitReporter () {
|
||||
}
|
||||
|
||||
function createTestCase (testcaseList) {
|
||||
return function testcase (name) {
|
||||
return function testcase (name, file) {
|
||||
assert(name, 'The testcase name is required')
|
||||
const startTime = Date.now()
|
||||
const tcase = {
|
||||
'@id': new Date().toISOString(),
|
||||
'@name': name
|
||||
}
|
||||
if (file) tcase['@file'] = file
|
||||
testcaseList.push(tcase)
|
||||
return {
|
||||
failure (error) {
|
||||
|
||||
@ -21,14 +21,17 @@
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
|
||||
const assert = require('assert')
|
||||
const chai = require('chai')
|
||||
const semver = require('semver')
|
||||
const helper = require('./helper')
|
||||
const deepEqual = require('fast-deep-equal')
|
||||
const { join } = require('path')
|
||||
const { locations } = require('../../scripts/download-artifacts')
|
||||
const packageJson = require('../../package.json')
|
||||
|
||||
chai.config.showDiff = true
|
||||
chai.config.truncateThreshold = 0
|
||||
const { assert } = chai
|
||||
|
||||
const { delve, to, isXPackTemplate, sleep, updateParams } = helper
|
||||
|
||||
const supportedFeatures = [
|
||||
@ -485,7 +488,17 @@ function build (opts = {}) {
|
||||
cmd.params.body = JSON.parse(cmd.params.body)
|
||||
}
|
||||
|
||||
const [err, result] = await to(api(cmd.params, options))
|
||||
let err, result;
|
||||
try {
|
||||
[err, result] = await to(api(cmd.params, options))
|
||||
} catch (exc) {
|
||||
if (JSON.stringify(exc).includes('resource_already_exists_exception')) {
|
||||
console.warn(`Resource already exists: ${JSON.stringify(cmd.params)}`)
|
||||
// setup task was already done because cleanup didn't catch it? do nothing
|
||||
} else {
|
||||
throw exc
|
||||
}
|
||||
}
|
||||
let warnings = result ? result.warnings : null
|
||||
const body = result ? result.body : null
|
||||
|
||||
@ -522,7 +535,7 @@ function build (opts = {}) {
|
||||
}
|
||||
|
||||
stats.assertions += 1
|
||||
assert.ok(deepEqual(warnings, action.warnings))
|
||||
assert.deepEqual(warnings, action.warnings)
|
||||
}
|
||||
|
||||
if (action.catch) {
|
||||
@ -530,7 +543,7 @@ function build (opts = {}) {
|
||||
assert.ok(err, `Expecting an error, but instead got ${JSON.stringify(err)}, the response was ${JSON.stringify(result)}`)
|
||||
assert.ok(
|
||||
parseDoError(err, action.catch),
|
||||
`the error should be: ${action.catch}`
|
||||
`the error should match: ${action.catch}, found ${JSON.stringify(err.body)}`
|
||||
)
|
||||
try {
|
||||
response = JSON.parse(err.body)
|
||||
@ -691,7 +704,7 @@ function is_false (val, msg) {
|
||||
function match (val1, val2, action) {
|
||||
// both values are objects
|
||||
if (typeof val1 === 'object' && typeof val2 === 'object') {
|
||||
assert.ok(deepEqual(val1, val2), action)
|
||||
assert.deepEqual(val1, val2, typeof action === 'object' ? JSON.stringify(action) : action)
|
||||
// the first value is the body as string and the second a pattern string
|
||||
} else if (
|
||||
typeof val1 === 'string' && typeof val2 === 'string' &&
|
||||
@ -702,8 +715,7 @@ function match (val1, val2, action) {
|
||||
.replace(/(^|[^\\])\s+/g, '$1')
|
||||
.slice(1, -1)
|
||||
// 'm' adds the support for multiline regex
|
||||
assert.ok(new RegExp(regStr, 'm').test(val1), `should match pattern provided: ${val2}, but got: ${val1}`)
|
||||
// tap.match(val1, new RegExp(regStr, 'm'), `should match pattern provided: ${val2}, action: ${JSON.stringify(action)}`)
|
||||
assert.match(val1, new RegExp(regStr, 'm'), `should match pattern provided: ${val2}, but got: ${val1}`)
|
||||
// everything else
|
||||
} else {
|
||||
assert.equal(val1, val2, `should be equal: ${val1} - ${val2}, action: ${JSON.stringify(action)}`)
|
||||
|
||||
Reference in New Issue
Block a user