Commit 2f4c770
[LockManager] Ensure index template are created (elastic#218901)
Closes: elastic#218944
The index template for the Lock Manager was not created, causing index
mappings and settings to be incorrect.
Root cause: the function responsible for creating the index template
(`ensureTemplatesAndIndexCreated`) was never invoked - only during
automated testing 🤦
The mappings for the lock manager index (`.kibana_locks-000001`) should
match this:
```ts
{
mappings: {
dynamic: false,
properties: {
token: { type: 'keyword' },
metadata: { enabled: false },
createdAt: { type: 'date' },
expiresAt: { type: 'date' },
},
},
}
```
In this test we make sure that the LockManager library can recover and
fix the mappings if the existing index has invalid mappings
```
DELETE .kibana_locks-000001
DELETE _index_template/.kibana_locks-index-template
DELETE _component_template/.kibana_locks-component
```
correct mappings
```
PUT .kibana_locks-000001
```
(Restart Kibana)
```
GET .kibana_locks-000001/_mapping
```
In this test we make sure that out of the box, the LockManager library
creates an index with the correct mappings
```
DELETE .kibana_locks-000001
DELETE _index_template/.kibana_locks-index-template
DELETE _component_template/.kibana_locks-component
```
(Restart Kibana)
```
GET .kibana_locks-000001/_mapping
```
Related: elastic#216916
elastic#216397
---------
Co-authored-by: Viduni Wickramarachchi <[email protected]>
(cherry picked from commit f684ea4)1 parent 6e9b7cf commit 2f4c770
File tree
23 files changed
+1114
-829
lines changed- x-pack
- test
- api_integration/deployment_agnostic/apis/observability/ai_assistant
- complete/functions
- distributed_lock_manager
- knowledge_base
- utils
- plugin_api_integration/test_suites/task_manager
23 files changed
+1114
-829
lines changedLines changed: 14 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
146 | 138 | | |
147 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
148 | 144 | | |
149 | 145 | | |
150 | 146 | | |
| |||
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
103 | 117 | | |
104 | | - | |
| 118 | + | |
| 119 | + | |
105 | 120 | | |
106 | 121 | | |
107 | 122 | | |
| |||
320 | 335 | | |
321 | 336 | | |
322 | 337 | | |
| 338 | + | |
323 | 339 | | |
324 | 340 | | |
325 | 341 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 21 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 70 | + | |
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| |||
684 | 682 | | |
685 | 683 | | |
686 | 684 | | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
695 | 694 | | |
696 | 695 | | |
697 | 696 | | |
| |||
701 | 700 | | |
702 | 701 | | |
703 | 702 | | |
704 | | - | |
705 | | - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
706 | 706 | | |
707 | 707 | | |
708 | | - | |
709 | 708 | | |
710 | 709 | | |
711 | 710 | | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
712 | 718 | | |
713 | 719 | | |
714 | 720 | | |
| |||
0 commit comments