Remove Node.js v8 support (#1402)

This commit is contained in:
Tomas Della Vedova
2021-02-19 08:27:20 +01:00
committed by GitHub
parent 7801b2cc13
commit ab5d8997b8
44 changed files with 258 additions and 302 deletions

View File

@ -65,7 +65,7 @@ test('search helper', async t => {
}
})
var count = 0
let count = 0
for await (const search of scrollSearch) {
count += 1
for (const doc of search.documents) {
@ -87,7 +87,7 @@ test('clear a scroll search', async t => {
}
})
var count = 0
let count = 0
for await (const search of scrollSearch) {
count += 1
if (count === 2) {
@ -109,7 +109,7 @@ test('scroll documents', async t => {
}
})
var count = 0
let count = 0
for await (const doc of scrollSearch) {
count += 1
t.true(doc.title.toLowerCase().includes('javascript'))

View File

@ -179,8 +179,8 @@ async function start ({ client, isXPack }) {
// to provide a better test log output
.reduce((arr, file) => {
const path = file.slice(file.indexOf('/rest-api-spec/test'), file.lastIndexOf('/'))
var inserted = false
for (var i = 0; i < arr.length; i++) {
let inserted = false
for (let i = 0; i < arr.length; i++) {
if (arr[i][0].includes(path)) {
inserted = true
arr[i].push(file)
@ -223,8 +223,8 @@ async function start ({ client, isXPack }) {
.filter(Boolean)
// get setup and teardown if present
var setupTest = null
var teardownTest = null
let setupTest = null
let teardownTest = null
for (const test of tests) {
if (test.setup) setupTest = test.setup
if (test.teardown) teardownTest = test.teardown
@ -299,14 +299,15 @@ function log (text) {
}
function now () {
var ts = process.hrtime()
const ts = process.hrtime()
return (ts[0] * 1e3) + (ts[1] / 1e6)
}
function parse (data) {
const schema = yaml.Schema.create(yaml.CORE_SCHEMA, [])
let doc
try {
var doc = yaml.safeLoad(data, { schema })
doc = yaml.safeLoad(data, { schema })
} catch (err) {
console.error(err)
return
@ -329,8 +330,8 @@ function withSHA (sha) {
})
function _withSHA (callback) {
var fresh = false
var retry = 0
let fresh = false
let retry = 0
if (!pathExist(esFolder)) {
if (!createFolder(esFolder)) {
@ -427,10 +428,10 @@ if (require.main === module) {
}
const shouldSkip = (isXPack, file, name) => {
var list = Object.keys(freeSkips)
for (var i = 0; i < list.length; i++) {
let list = Object.keys(freeSkips)
for (let i = 0; i < list.length; i++) {
const freeTest = freeSkips[list[i]]
for (var j = 0; j < freeTest.length; j++) {
for (let j = 0; j < freeTest.length; j++) {
if (file.endsWith(list[i]) && (name === freeTest[j] || freeTest[j] === '*')) {
const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name
log(`Skipping test ${testName} because is blacklisted in the free test`)
@ -441,9 +442,9 @@ const shouldSkip = (isXPack, file, name) => {
if (file.includes('x-pack') || isXPack) {
list = Object.keys(platinumBlackList)
for (i = 0; i < list.length; i++) {
for (let i = 0; i < list.length; i++) {
const platTest = platinumBlackList[list[i]]
for (j = 0; j < platTest.length; j++) {
for (let j = 0; j < platTest.length; j++) {
if (file.endsWith(list[i]) && (name === platTest[j] || platTest[j] === '*')) {
const testName = file.slice(file.indexOf(`${sep}elasticsearch${sep}`)) + ' / ' + name
log(`Skipping test ${testName} because is blacklisted in the platinum test`)

View File

@ -320,7 +320,7 @@ function build (opts = {}) {
*/
function set (key, name) {
if (key.includes('_arbitrary_key_')) {
var currentVisit = null
let currentVisit = null
for (const path of key.split('.')) {
if (path === '_arbitrary_key_') {
const keys = Object.keys(currentVisit)
@ -361,8 +361,9 @@ function build (opts = {}) {
*/
async function doAction (action, stats) {
const cmd = parseDo(action)
let api
try {
var api = delve(client, cmd.method).bind(client)
api = delve(client, cmd.method).bind(client)
} catch (err) {
console.error(`\nError: Cannot find the method '${cmd.method}' in the client.\n`)
process.exit(1)
@ -373,8 +374,8 @@ function build (opts = {}) {
if (cmd.params.ignore) delete cmd.params.ignore
const [err, result] = await to(api(cmd.params, options))
var warnings = result ? result.warnings : null
var body = result ? result.body : null
let warnings = result ? result.warnings : null
const body = result ? result.body : null
if (action.warnings && warnings === null) {
assert.fail('We should get a warning header', action.warnings)
@ -719,7 +720,7 @@ function parseDo (action) {
for (const key in obj) {
const val = obj[key]
var newKey = key
let newKey = key
if (!~doNotCamelify.indexOf(key)) {
// if the key starts with `_` we should not camelify the first occurence
// eg: _source_include => _sourceInclude
@ -776,7 +777,7 @@ function parseDoError (err, spec) {
function getSkip (arr) {
if (!Array.isArray(arr)) return null
for (var i = 0; i < arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].skip) return arr[i].skip
}
return null
@ -822,7 +823,7 @@ function logSkip (action) {
* @returns {boolean}
*/
function shouldSkip (esVersion, action) {
var shouldSkip = false
let shouldSkip = false
// skip based on the version
if (action.version) {
if (action.version.trim() === 'all') return true