Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the FTR test for inference endpoint #183769

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export default function ({ getService }: FtrProviderContext) {
const taskType = 'sparse_embedding';
const service = 'elser';

// FLAKY: https://github.com/elastic/kibana/issues/185216
describe.skip('Inference endpoints', function () {
// test adds new trained model '.elser_model_2_linux-x86_64', but does not clean it. Follow up tests are affected
this.tags(['failsOnMKI']);
describe('Inference endpoints', function () {
let modelsBeforeTest: any[] = [];
before(async () => {
log.debug(`Creating inference endpoint`);
try {
const modelsInfo = await ml.api.getTrainedModelsES();
modelsBeforeTest = modelsInfo.trained_model_configs.map((model: any) => model.model_id);
await ml.api.createInferenceEndpoint(inferenceId, taskType, {
service,
service_settings: {
Expand All @@ -43,6 +43,14 @@ export default function ({ getService }: FtrProviderContext) {
try {
log.debug(`Deleting inference endpoint`);
await ml.api.deleteInferenceEndpoint(inferenceId, taskType);

const modelsInfo = await ml.api.getTrainedModelsES();
let modelsAfterTest = modelsInfo.trained_model_configs.map((model: any) => model.model_id);

modelsAfterTest = modelsAfterTest.filter((model: any) => !modelsBeforeTest.includes(model));
for (const modelId of modelsAfterTest) {
await ml.api.deleteTrainedModelES(modelId);
}
} catch (err) {
log.debug('[Cleanup error] Error deleting inference endpoint');
throw err;
Expand Down