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

Failing test: Observability AI Assistant API Integration tests (enterprise).x-pack/test/observability_ai_assistant_api_integration/tests/knowledge_base/knowledge_base_user_instructions·spec·ts - Observability AI Assistant API tests knowledge_base/knowledge_base_user_instructions.spec.ts Knowledge base user instructions when creating private and public user instructions "editor" can retrieve their own private instructions and the public instruction #192222

Open
kibanamachine opened this issue Sep 5, 2024 · 9 comments · Fixed by #196026 or #200022
Assignees
Labels
failed-test A test failure on a tracked branch, potentially flaky-test Team:Obs AI Assistant Observability AI Assistant

Comments

@kibanamachine
Copy link
Contributor

kibanamachine commented Sep 5, 2024

A test failed on a tracked branch

Error: expected [ { doc_id: 'private-doc-from-editor',
    text: 'Private user instruction from "editor"',
    public: false },
  { doc_id: 'public-doc-from-editor',
    text: 'Public user instruction from "john"',
    public: true } ] to sort of equal [ { doc_id: 'private-doc-from-editor',
    public: false,
    text: 'Private user instruction from "editor"' },
  { doc_id: 'public-doc-from-editor',
    public: true,
    text: 'Public user instruction from "editor"' },
  { doc_id: 'public-doc-from-john',
    public: true,
    text: 'Public user instruction from "john"' } ]
    at Assertion.assert (expect.js:100:11)
    at Assertion.eql (expect.js:244:8)
    at Context.<anonymous> (knowledge_base_user_instructions.spec.ts:99:46)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.apply (wrap_function.js:73:16) {
  actual: '[\n' +
    '  {\n' +
    '    "doc_id": "private-doc-from-editor"\n' +
    '    "public": false\n' +
    '    "text": "Private user instruction from \\"editor\\""\n' +
    '  }\n' +
    '  {\n' +
    '    "doc_id": "public-doc-from-editor"\n' +
    '    "public": true\n' +
    '    "text": "Public user instruction from \\"john\\""\n' +
    '  }\n' +
    ']',
  expected: '[\n' +
    '  {\n' +
    '    "doc_id": "private-doc-from-editor"\n' +
    '    "public": false\n' +
    '    "text": "Private user instruction from \\"editor\\""\n' +
    '  }\n' +
    '  {\n' +
    '    "doc_id": "public-doc-from-editor"\n' +
    '    "public": true\n' +
    '    "text": "Public user instruction from \\"editor\\""\n' +
    '  }\n' +
    '  {\n' +
    '    "doc_id": "public-doc-from-john"\n' +
    '    "public": true\n' +
    '    "text": "Public user instruction from \\"john\\""\n' +
    '  }\n' +
    ']',
  showDiff: true
}

First failure: kibana-on-merge - main

@kibanamachine kibanamachine added the failed-test A test failure on a tracked branch, potentially flaky-test label Sep 5, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 5, 2024
@jughosta jughosta added the Team:Obs AI Assistant Observability AI Assistant label Sep 6, 2024
@botelastic botelastic bot removed the needs-team Issues missing a team label label Sep 6, 2024
@kibanamachine
Copy link
Contributor Author

New failure: kibana-on-merge - 8.x

@kibanamachine
Copy link
Contributor Author

New failure: kibana-on-merge - main

@kibanamachine
Copy link
Contributor Author

New failure: kibana-on-merge - main

@mistic
Copy link
Member

mistic commented Oct 8, 2024

Skipped.

main: 550015b

viduni94 added a commit to viduni94/kibana that referenced this issue Oct 31, 2024
viduni94 added a commit to viduni94/kibana that referenced this issue Oct 31, 2024
viduni94 added a commit that referenced this issue Oct 31, 2024
…ructions test (#196026)

Closes #192222

## Summary

### Problem
The "when creating private and public user instructions" test has been
marked as flaky and has been skipped.
Based on the error recorded in the ticket, 2 possible scenarios could be

- **Race Conditions**: When multiple instructions are created
asynchronously, the instructions might not be assigned to the right user
or role. Data could be overwritten.
- **Data Fetching Issues**: The API might return inconsistent data if
the knowledge base is not properly cleared between tests, or if the
instructions are not properly isolated per user.

### Solution
When running the test locally, the actual output and expected outcome
are the same, therefore the test passes. The flaky test runner didn't
output anything meaningful either.

However, in order to resolve any missing entries, the before hook was
updated to retry adding only the missing entries. Hopefully, this will
help resolve the flakiness.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Oct 31, 2024
…ructions test (elastic#196026)

Closes elastic#192222

## Summary

### Problem
The "when creating private and public user instructions" test has been
marked as flaky and has been skipped.
Based on the error recorded in the ticket, 2 possible scenarios could be

- **Race Conditions**: When multiple instructions are created
asynchronously, the instructions might not be assigned to the right user
or role. Data could be overwritten.
- **Data Fetching Issues**: The API might return inconsistent data if
the knowledge base is not properly cleared between tests, or if the
instructions are not properly isolated per user.

### Solution
When running the test locally, the actual output and expected outcome
are the same, therefore the test passes. The flaky test runner didn't
output anything meaningful either.

However, in order to resolve any missing entries, the before hook was
updated to retry adding only the missing entries. Hopefully, this will
help resolve the flakiness.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit a7a09f7)
nreese pushed a commit to nreese/kibana that referenced this issue Nov 1, 2024
…ructions test (elastic#196026)

Closes elastic#192222

## Summary

### Problem
The "when creating private and public user instructions" test has been
marked as flaky and has been skipped.
Based on the error recorded in the ticket, 2 possible scenarios could be

- **Race Conditions**: When multiple instructions are created
asynchronously, the instructions might not be assigned to the right user
or role. Data could be overwritten.
- **Data Fetching Issues**: The API might return inconsistent data if
the knowledge base is not properly cleared between tests, or if the
instructions are not properly isolated per user.

### Solution
When running the test locally, the actual output and expected outcome
are the same, therefore the test passes. The flaky test runner didn't
output anything meaningful either.

However, in order to resolve any missing entries, the before hook was
updated to retry adding only the missing entries. Hopefully, this will
help resolve the flakiness.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
@kibanamachine kibanamachine reopened this Nov 8, 2024
@kibanamachine
Copy link
Contributor Author

New failure: kibana-on-merge - 8.x

@emma-raffenne emma-raffenne reopened this Nov 9, 2024
@viduni94 viduni94 removed their assignment Nov 11, 2024
@viduni94
Copy link
Contributor

I've looked into this issue before, and haven't been able to reproduce this test failure/flakiness.
All tests succeeded locally and via the flaky test runner:

Via local tests:
Image

Via flaky test runner:

Hey @sorenlouv
Do you have an idea as to why this test would fail sometimes in the kibana-ci?

@sorenlouv
Copy link
Member

It's very weird to me how stable the flaky test runner is, and then it still fails the week after. I suggest adding the retry to the failing test around the request GET /internal/observability_ai_assistant/kb/user_instructions and ensure it returns 3 instructions.

@viduni94
Copy link
Contributor

It's very weird to me how stable the flaky test runner is, and then it still fails the week after. I suggest adding the retry to the failing test around the request GET /internal/observability_ai_assistant/kb/user_instructions and ensure it returns 3 instructions.

Thanks @sorenlouv
I've created a PR - #200022
Hope you could take a look.
Thank you

kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 14, 2024
…y tests (elastic#200022)

Closes elastic#192222

## Summary

### Problem
The test appears to be flaky, potentially because the entries are not
available at the time of retrieval. This cannot be reproduced locally or
via the flaky test runner. (more details
[here](elastic#196026 (comment)))

### Solution
Add a retry when fetching the instructions and check whether the number
of instructions returned by the API endpoint is the same number of
instructions expected.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit 53c05a3)
wayneseymour pushed a commit to wayneseymour/kibana that referenced this issue Nov 18, 2024
…y tests (elastic#200022)

Closes elastic#192222

## Summary

### Problem
The test appears to be flaky, potentially because the entries are not
available at the time of retrieval. This cannot be reproduced locally or
via the flaky test runner. (more details
[here](elastic#196026 (comment)))

### Solution
Add a retry when fetching the instructions and check whether the number
of instructions returned by the API endpoint is the same number of
instructions expected.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this issue Nov 18, 2024
…y tests (elastic#200022)

Closes elastic#192222

## Summary

### Problem
The test appears to be flaky, potentially because the entries are not
available at the time of retrieval. This cannot be reproduced locally or
via the flaky test runner. (more details
[here](elastic#196026 (comment)))

### Solution
Add a retry when fetching the instructions and check whether the number
of instructions returned by the API endpoint is the same number of
instructions expected.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this issue Nov 18, 2024
…y tests (elastic#200022)

Closes elastic#192222

## Summary

### Problem
The test appears to be flaky, potentially because the entries are not
available at the time of retrieval. This cannot be reproduced locally or
via the flaky test runner. (more details
[here](elastic#196026 (comment)))

### Solution
Add a retry when fetching the instructions and check whether the number
of instructions returned by the API endpoint is the same number of
instructions expected.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
@kibanamachine kibanamachine reopened this Dec 9, 2024
@kibanamachine
Copy link
Contributor Author

New failure: kibana-elasticsearch-snapshot-verify - 8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed-test A test failure on a tracked branch, potentially flaky-test Team:Obs AI Assistant Observability AI Assistant
Projects
None yet
7 participants