Skip to content

Commit ccf98d1

Browse files
[Backport 8.7] Integration test cleanup (#1841 (#1844)Co-authored-by: Josh Mock <[email protected]>
* Fix bad sysctl command in README * Add --suite and --test flags to integration tests So we can run a single suite or a single test without having to edit any code. * Drop several skipped integration tests Many of these skips are no longer necessary. Didn't do an exhaustive check of all skipped tests, so this is just a start. * Simplify cleanup make target Co-authored-by: Josh Mock <[email protected]>
1 parent 49eaea0 commit ccf98d1

File tree

3 files changed

+14
-43
lines changed

3 files changed

+14
-43
lines changed

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ integration-setup: integration-cleanup
44

55
.PHONY: integration-cleanup
66
integration-cleanup:
7-
docker stop instance || true
8-
docker volume rm instance-rest-test-data || true
7+
docker container rm --force --volumes instance || true
98

109
.PHONY: integration
1110
integration: integration-setup

test/integration/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ make integration
3737

3838
If Elasticsearch doesn't come up, run `make integration-cleanup` and then `DETACH=false .ci/run-elasticsearch.sh` manually to read the startup logs.
3939

40-
If you get an error about `vm.max_map_count` being too low, run `sudo sysctl -w vm.max_map_count=262144` to update the setting until the next reboot, or `sudo sysctl -w vm.max_map_count=262144 | sudo tee -a /etc/sysctl.conf` to update the setting permanently.
40+
If you get an error about `vm.max_map_count` being too low, run `sudo sysctl -w vm.max_map_count=262144` to update the setting until the next reboot, or `sudo sysctl -w vm.max_map_count=262144; echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.conf` to update the setting permanently.
4141

4242
### Exit on the first failure
4343

test/integration/index.js

+12-40
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const yaml = require('js-yaml')
3030
const minimist = require('minimist')
3131
const ms = require('ms')
3232
const { Client } = require('../../index')
33-
const { kProductCheck } = require('@elastic/transport/lib/symbols')
3433
const build = require('./test-runner')
3534
const { sleep } = require('./helper')
3635
const createJunitReporter = require('./reporter')
@@ -44,7 +43,8 @@ const MAX_FILE_TIME = 1000 * 30
4443
const MAX_TEST_TIME = 1000 * 3
4544

4645
const options = minimist(process.argv.slice(2), {
47-
boolean: ['bail']
46+
boolean: ['bail'],
47+
string: ['suite', 'test'],
4848
})
4949

5050
const freeSkips = {
@@ -56,10 +56,6 @@ const freeSkips = {
5656
'/free/cluster.desired_nodes/20_dry_run.yml': ['*'],
5757
'/free/cluster.prevalidate_node_removal/10_basic.yml': ['*'],
5858

59-
'/free/health/30_feature.yml': ['*'],
60-
'/free/health/40_useractions.yml': ['*'],
61-
'/free/health/40_diagnosis.yml': ['Diagnosis'],
62-
6359
// the v8 client never sends the scroll_id in querystring,
6460
// the way the test is structured causes a security exception
6561
'free/scroll/10_basic.yml': ['Body params override query string'],
@@ -70,9 +66,6 @@ const freeSkips = {
7066
'free/cat.allocation/10_basic.yml': ['*'],
7167
'free/cat.snapshots/10_basic.yml': ['Test cat snapshots output'],
7268

73-
// TODO: remove this once 'arbitrary_key' is implemented
74-
// https://github.com/elastic/elasticsearch/pull/41492
75-
'indices.split/30_copy_settings.yml': ['*'],
7669
'indices.stats/50_disk_usage.yml': ['Disk usage stats'],
7770
'indices.stats/60_field_usage.yml': ['Field usage stats'],
7871

@@ -99,35 +92,13 @@ const platinumDenyList = {
9992
'api_key/11_invalidation.yml': ['Test invalidate api key by realm name'],
10093
'analytics/histogram.yml': ['Histogram requires values in increasing order'],
10194

102-
// this two test cases are broken, we should
103-
// return on those in the future.
104-
'analytics/top_metrics.yml': [
105-
'sort by keyword field fails',
106-
'sort by string script fails'
107-
],
108-
109-
'cat.aliases/10_basic.yml': ['Empty cluster'],
110-
'index/10_with_id.yml': ['Index with ID'],
111-
'indices.get_alias/10_basic.yml': ['Get alias against closed indices'],
112-
'indices.get_alias/20_empty.yml': ['Check empty aliases when getting all aliases via /_alias'],
113-
'text_structure/find_structure.yml': ['*'],
114-
115-
// https://github.com/elastic/elasticsearch/pull/39400
116-
'ml/jobs_crud.yml': ['Test put job with id that is already taken'],
117-
11895
// object keys must me strings, and `0.0.toString()` is `0`
11996
'ml/evaluate_data_frame.yml': [
12097
'Test binary_soft_classifition precision',
12198
'Test binary_soft_classifition recall',
12299
'Test binary_soft_classifition confusion_matrix'
123100
],
124101

125-
// it gets random failures on CI, must investigate
126-
'ml/set_upgrade_mode.yml': [
127-
'Attempt to open job when upgrade_mode is enabled',
128-
'Setting upgrade mode to disabled from enabled'
129-
],
130-
131102
// The cleanup fails with a index not found when retrieving the jobs
132103
'ml/get_datafeed_stats.yml': ['Test get datafeed stats when total_search_time_ms mapping is missing'],
133104
'ml/bucket_correlation_agg.yml': ['Test correlation bucket agg simple'],
@@ -209,13 +180,6 @@ const platinumDenyList = {
209180

210181
// start should be a string in the yaml test
211182
'platinum/ml/start_stop_datafeed.yml': ['*'],
212-
213-
// health API not yet supported
214-
'/platinum/health/10_usage.yml': ['*'],
215-
216-
// ML update_trained_model_deployment not supported yet
217-
'/platinum/ml/3rd_party_deployment.yml': ['Test update deployment'],
218-
'/platinum/ml/update_trained_model_deployment.yml': ['Test with unknown model id']
219183
}
220184

221185
function runner (opts = {}) {
@@ -227,8 +191,6 @@ function runner (opts = {}) {
227191
}
228192
}
229193
const client = new Client(options)
230-
// TODO: remove the following line once https://github.com/elastic/elasticsearch/issues/82358 is fixed
231-
client.transport[kProductCheck] = null
232194
log('Loading yaml suite')
233195
start({ client, isXPack: opts.isXPack })
234196
.catch(err => {
@@ -333,13 +295,21 @@ async function start ({ client, isXPack }) {
333295
}
334296

335297
const cleanPath = file.slice(file.lastIndexOf(apiName))
298+
299+
// skip if --suite CLI arg doesn't match
300+
if (options.suite && !cleanPath.endsWith(options.suite)) continue
301+
336302
log(' ' + cleanPath)
337303
const junitTestSuite = junitTestSuites.testsuite(apiName.slice(1) + ' - ' + cleanPath)
338304

339305
for (const test of tests) {
340306
const testTime = now()
341307
const name = Object.keys(test)[0]
308+
309+
// skip setups, teardowns and anything that doesn't match --test flag when present
342310
if (name === 'setup' || name === 'teardown') continue
311+
if (options.test && !name.endsWith(options.test)) continue
312+
343313
const junitTestCase = junitTestSuite.testcase(name)
344314

345315
stats.total += 1
@@ -439,6 +409,8 @@ if (require.main === module) {
439409
}
440410

441411
const shouldSkip = (isXPack, file, name) => {
412+
if (options.suite || options.test) return false
413+
442414
let list = Object.keys(freeSkips)
443415
for (let i = 0; i < list.length; i++) {
444416
const freeTest = freeSkips[list[i]]

0 commit comments

Comments
 (0)