Skip to content

Commit f452b40

Browse files
authored
fix 2.11 gantt (#2091)
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
1 parent e3b9d78 commit f452b40

1 file changed

Lines changed: 32 additions & 26 deletions

File tree

cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,44 @@ const Y_LABEL = 'A unique label for Y-axis';
1818
const X_LABEL = 'A unique label for X-axis';
1919
const DEFAULT_SIZE = 10;
2020

21+
const INDEX = 'jaeger';
22+
2123
describe('Dump test data', () => {
2224
it('Indexes test data for gantt chart', () => {
23-
const dumpDataSet = (ndjson, index) =>
24-
cy.request({
25-
method: 'POST',
26-
form: false,
27-
url: 'api/console/proxy',
28-
headers: {
29-
'content-type': 'application/json;charset=UTF-8',
30-
'osd-xsrf': true,
31-
},
32-
qs: {
33-
path: `${index}/_bulk`,
34-
method: 'POST',
35-
},
36-
body: ndjson,
37-
});
3825
cy.fixture('plugins/gantt-chart-dashboards/jaeger-sample.txt').then(
39-
(ndjson) => {
40-
dumpDataSet(ndjson, 'jaeger');
41-
}
26+
(ndjson) =>
27+
cy.request({
28+
method: 'POST',
29+
url: 'api/console/proxy',
30+
headers: {
31+
'content-type': 'application/json;charset=UTF-8',
32+
'osd-xsrf': true,
33+
},
34+
// refresh=wait_for makes the bulk-indexed docs immediately searchable
35+
qs: { path: `${INDEX}/_bulk?refresh=wait_for`, method: 'POST' },
36+
body: ndjson,
37+
})
4238
);
4339

40+
// Create the index pattern with its field list for editor to read the stored `fields` attribute
4441
cy.request({
45-
method: 'POST',
46-
failOnStatusCode: false,
47-
url: 'api/saved_objects/index-pattern/jaeger',
48-
headers: {
49-
'content-type': 'application/json',
50-
'osd-xsrf': true,
51-
},
52-
body: JSON.stringify({ attributes: { title: 'jaeger' } }),
42+
method: 'GET',
43+
url: 'api/index_patterns/_fields_for_wildcard',
44+
qs: { pattern: INDEX },
45+
headers: { 'osd-xsrf': true },
46+
}).then((resp) => {
47+
cy.request({
48+
method: 'POST',
49+
failOnStatusCode: false,
50+
url: `api/saved_objects/index-pattern/${INDEX}`,
51+
headers: { 'content-type': 'application/json', 'osd-xsrf': true },
52+
body: JSON.stringify({
53+
attributes: {
54+
title: INDEX,
55+
fields: JSON.stringify(resp.body.fields),
56+
},
57+
}),
58+
});
5359
});
5460
});
5561
});

0 commit comments

Comments
 (0)