kibana/x-pack/test/api_integration/config.ts
Søren Louv-Jansen df67a09afa
[Obs AI Assistant] Add KB re-indexing when encountering semantic_text bug (#210386)
Closes https://github.com/elastic/kibana/issues/210204

This will automatically re-index the knowledge base if upon adding a KB
entry there is this error:

> The [sparse_vector] field type is not supported on indices created on
versions 8.0 to 8.10

That error means that semantic_text is not supported in the given index,
and it should therefore be re-indexed.

**How to test this PR:**

**8.10**
- `git checkout -B 8.10 origin/8.10`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`

**8.19**
- `git checkout -B 8.19 origin/8.x`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`
- Install Knowledge base
- Try adding an item to KB (it should fail ️)

**9.1.0**
- `gh pr checkout 210386`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`
- Try adding an item to KB (it should succeed ️)

**TODO:**

- Add an upgrade test that covers this flow

---------

Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
2025-02-17 18:20:50 +01:00

49 lines
1.8 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
export async function getApiIntegrationConfig({ readConfigFile }: FtrConfigProviderContext) {
const xPackFunctionalTestsConfig = await readConfigFile(
require.resolve('../functional/config.base.js')
);
return {
services,
testConfigCategory: ScoutTestRunConfigCategory.API_TEST,
servers: xPackFunctionalTestsConfig.get('servers'),
security: xPackFunctionalTestsConfig.get('security'),
junit: {
reportName: 'X-Pack API Integration Tests',
},
kbnTestServer: {
...xPackFunctionalTestsConfig.get('kbnTestServer'),
serverArgs: [
...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'),
'--xpack.security.session.idleTimeout=3600000', // 1 hour
'--telemetry.optIn=true',
'--xpack.fleet.agents.pollingRequestTimeout=5000', // 5 seconds
'--xpack.ruleRegistry.write.enabled=true',
'--xpack.ruleRegistry.write.enabled=true',
'--xpack.ruleRegistry.write.cache.enabled=false',
'--monitoring_collection.opentelemetry.metrics.prometheus.enabled=true',
],
},
esTestCluster: {
...xPackFunctionalTestsConfig.get('esTestCluster'),
serverArgs: [
...xPackFunctionalTestsConfig.get('esTestCluster.serverArgs'),
'node.attr.name=apiIntegrationTestNode',
`path.repo=/tmp/repo,/tmp/repo_1,/tmp/repo_2,/tmp/cloud-snapshots/`,
],
},
};
}
export default getApiIntegrationConfig;