Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-e2e-agent-check-in-timeout' …
Browse files Browse the repository at this point in the history
…into fix-e2e-agent-check-in-timeout
  • Loading branch information
szwarckonrad committed Oct 10, 2023
2 parents ddca65a + 33099cc commit 1904836
Show file tree
Hide file tree
Showing 26 changed files with 242 additions and 60 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ enabled:
- test/functional/apps/discover/group1/config.ts
- test/functional/apps/discover/group2/config.ts
- test/functional/apps/discover/group3/config.ts
- test/functional/apps/discover/group4/config.ts
- test/functional/apps/getting_started/config.ts
- test/functional/apps/home/config.ts
- test/functional/apps/kibana_overview/config.ts
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-unified-data-table/src/components/data_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export const UnifiedDataTable = ({
fieldFormats: services.fieldFormats,
maxEntries: maxDocFieldsDisplayed,
externalCustomRenderers,
isPlainRecord,
}),
[
dataView,
Expand All @@ -547,6 +548,7 @@ export const UnifiedDataTable = ({
maxDocFieldsDisplayed,
services.fieldFormats,
externalCustomRenderers,
isPlainRecord,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ const rowsSource: EsHitRecord[] = [
},
];

const rowsSourceWithEmptyValues: EsHitRecord[] = [
{
_id: '1',
_index: 'test',
_score: 1,
_source: { bytes: 100, extension: null },
highlight: {
extension: ['@kibana-highlighted-field.gz@/kibana-highlighted-field'],
},
},
];

const rowsFields: EsHitRecord[] = [
{
_id: '1',
Expand Down Expand Up @@ -344,6 +356,77 @@ describe('Unified data table cell rendering', function () {
`);
});

it('renders _source column correctly if on text based mode and have nulls', () => {
const DataTableCellValue = getRenderCellValueFn({
dataView: dataViewMock,
rows: rowsSourceWithEmptyValues.map(build),
useNewFieldsApi: false,
shouldShowFieldHandler: (fieldName) => ['extension', 'bytes'].includes(fieldName),
closePopover: jest.fn(),
fieldFormats: mockServices.fieldFormats as unknown as FieldFormatsStart,
maxEntries: 100,
isPlainRecord: true,
});
const component = shallow(
<DataTableCellValue
rowIndex={0}
colIndex={0}
columnId="_source"
isDetails={false}
isExpanded={false}
isExpandable={true}
setCellProps={jest.fn()}
/>
);
expect(component).toMatchInlineSnapshot(`
<EuiDescriptionList
className="unifiedDataTable__descriptionList unifiedDataTable__cellValue"
compressed={true}
type="inline"
>
<EuiDescriptionListTitle
className="unifiedDataTable__descriptionListTitle"
>
bytesDisplayName
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
className="unifiedDataTable__descriptionListDescription"
dangerouslySetInnerHTML={
Object {
"__html": 100,
}
}
/>
<EuiDescriptionListTitle
className="unifiedDataTable__descriptionListTitle"
>
_index
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
className="unifiedDataTable__descriptionListDescription"
dangerouslySetInnerHTML={
Object {
"__html": "test",
}
}
/>
<EuiDescriptionListTitle
className="unifiedDataTable__descriptionListTitle"
>
_score
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
className="unifiedDataTable__descriptionListDescription"
dangerouslySetInnerHTML={
Object {
"__html": 1,
}
}
/>
</EuiDescriptionList>
`);
});

it('renders fields-based column correctly', () => {
const DataTableCellValue = getRenderCellValueFn({
dataView: dataViewMock,
Expand Down
29 changes: 18 additions & 11 deletions packages/kbn-unified-data-table/src/utils/get_render_cell_value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const getRenderCellValueFn = ({
fieldFormats,
maxEntries,
externalCustomRenderers,
isPlainRecord,
}: {
dataView: DataView;
rows: DataTableRecord[] | undefined;
Expand All @@ -55,6 +56,7 @@ export const getRenderCellValueFn = ({
string,
(props: EuiDataGridCellValueElementProps) => React.ReactNode
>;
isPlainRecord?: boolean;
}) => {
return ({
rowIndex,
Expand Down Expand Up @@ -144,17 +146,22 @@ export const getRenderCellValueFn = ({
compressed
className={classnames('unifiedDataTable__descriptionList', CELL_CLASS)}
>
{pairs.map(([fieldDisplayName, value]) => (
<Fragment key={fieldDisplayName}>
<EuiDescriptionListTitle className="unifiedDataTable__descriptionListTitle">
{fieldDisplayName}
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
className="unifiedDataTable__descriptionListDescription"
dangerouslySetInnerHTML={{ __html: value }}
/>
</Fragment>
))}
{pairs.map(([fieldDisplayName, value, fieldName]) => {
// temporary solution for text based mode. As there are a lot of unsupported fields we want to
// hide the empty one from the Document view
if (isPlainRecord && fieldName && row.flattened[fieldName] === null) return null;
return (
<Fragment key={fieldDisplayName}>
<EuiDescriptionListTitle className="unifiedDataTable__descriptionListTitle">
{fieldDisplayName}
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
className="unifiedDataTable__descriptionListDescription"
dangerouslySetInnerHTML={{ __html: value }}
/>
</Fragment>
);
})}
</EuiDescriptionList>
);
}
Expand Down
34 changes: 22 additions & 12 deletions test/functional/apps/discover/group2/_data_grid_field_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import expect from '@kbn/expect';
import { WebElementWrapper } from '../../../services/lib/web_element_wrapper';
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
Expand All @@ -21,6 +20,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'header',
]);
const esArchiver = getService('esArchiver');
const log = getService('log');
const retry = getService('retry');
const dashboardAddPanel = getService('dashboardAddPanel');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
Expand All @@ -31,26 +32,35 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

async function findFirstColumnTokens() {
const header = await testSubjects.find('euiDataGridBody > dataGridHeader');
return await findFirstFieldIcons(header);
return await findFirstFieldIcons('euiDataGridBody > dataGridHeader');
}

async function findFirstDocViewerTokens() {
await dataGrid.clickRowToggle({ rowIndex: 0 });
const docViewer = await testSubjects.find('docTableDetailsFlyout');
return await findFirstFieldIcons(docViewer);
return await findFirstFieldIcons('docTableDetailsFlyout');
}

async function findFirstFieldIcons(element: WebElementWrapper) {
const fieldIcons = await element.findAllByCssSelector('.kbnFieldIcon svg');
async function findFirstFieldIcons(elementSelector: string) {
let firstFieldIcons: string[] | undefined;

return await Promise.all(
fieldIcons.map((fieldIcon) => fieldIcon.getAttribute('aria-label')).slice(0, 10)
);
await retry.waitFor('field tokens', async () => {
const element = await testSubjects.find(elementSelector);
const fieldIcons = await element.findAllByCssSelector('.kbnFieldIcon svg');

firstFieldIcons = await Promise.all(
fieldIcons.slice(0, 10).map((fieldIcon) => fieldIcon.getAttribute('aria-label'))
).catch((error) => {
log.debug(`error in findFirstFieldIcons: ${error.message}`);
return undefined;
});

return typeof firstFieldIcons !== 'undefined';
});

return firstFieldIcons;
}

// Failing: See https://github.com/elastic/kibana/issues/168115
describe.skip('discover data grid field tokens', function () {
describe('discover data grid field tokens', function () {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
Expand Down
13 changes: 0 additions & 13 deletions test/functional/apps/discover/group2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_indexpattern_without_timefield'));
loadTestFile(require.resolve('./_discover_fields_api'));
loadTestFile(require.resolve('./_data_grid'));
loadTestFile(require.resolve('./_data_grid_context'));
loadTestFile(require.resolve('./_data_grid_field_data'));
Expand All @@ -33,16 +31,5 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./_data_grid_pagination'));
loadTestFile(require.resolve('./_data_grid_footer'));
loadTestFile(require.resolve('./_data_grid_field_tokens'));
loadTestFile(require.resolve('./_adhoc_data_views'));
loadTestFile(require.resolve('./_esql_view'));
loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields'));
loadTestFile(require.resolve('./_runtime_fields_editor'));
loadTestFile(require.resolve('./_huge_fields'));
loadTestFile(require.resolve('./_date_nested'));
loadTestFile(require.resolve('./_search_on_page_load'));
loadTestFile(require.resolve('./_chart_hidden'));
loadTestFile(require.resolve('./_context_encoded_url_params'));
loadTestFile(require.resolve('./_hide_announcements'));
loadTestFile(require.resolve('./_data_view_edit'));
});
}
18 changes: 18 additions & 0 deletions test/functional/apps/discover/group4/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js'));

return {
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
};
}
37 changes: 37 additions & 0 deletions test/functional/apps/discover/group4/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');

describe('discover/group4', function () {
before(async function () {
await browser.setWindowSize(1600, 1200);
});

after(async function unloadMakelogs() {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_indexpattern_without_timefield'));
loadTestFile(require.resolve('./_discover_fields_api'));
loadTestFile(require.resolve('./_adhoc_data_views'));
loadTestFile(require.resolve('./_esql_view'));
loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields'));
loadTestFile(require.resolve('./_runtime_fields_editor'));
loadTestFile(require.resolve('./_huge_fields'));
loadTestFile(require.resolve('./_date_nested'));
loadTestFile(require.resolve('./_search_on_page_load'));
loadTestFile(require.resolve('./_chart_hidden'));
loadTestFile(require.resolve('./_context_encoded_url_params'));
loadTestFile(require.resolve('./_hide_announcements'));
loadTestFile(require.resolve('./_data_view_edit'));
});
}
2 changes: 2 additions & 0 deletions test/functional/firefox/discover.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('../apps/discover/classic'),
require.resolve('../apps/discover/group1'),
require.resolve('../apps/discover/group2'),
require.resolve('../apps/discover/group3'),
require.resolve('../apps/discover/group4'),
],

junit: {
Expand Down
20 changes: 0 additions & 20 deletions x-pack/plugins/observability_ai_assistant/server/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export class ObservabilityAIAssistantService {
conversations: getResourceName('index-template-conversations'),
kb: getResourceName('index-template-kb'),
},
ilmPolicy: {
conversations: getResourceName('ilm-policy-conversations'),
},
pipelines: {
kb: getResourceName('kb-ingest-pipeline'),
},
Expand Down Expand Up @@ -112,23 +109,6 @@ export class ObservabilityAIAssistantService {
template: conversationComponentTemplate,
});

await esClient.ilm.putLifecycle({
name: this.resourceNames.ilmPolicy.conversations,
policy: {
phases: {
hot: {
min_age: '0s',
actions: {
rollover: {
max_age: '90d',
max_primary_shard_size: '50gb',
},
},
},
},
},
});

await esClient.indices.putIndexTemplate({
name: this.resourceNames.indexTemplate.conversations,
composed_of: [this.resourceNames.componentTemplate.conversations],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export interface ObservabilityAIAssistantResourceNames {
conversations: string;
kb: string;
};
ilmPolicy: {
conversations: string;
};
aliases: {
conversations: string;
kb: string;
Expand Down
Loading

0 comments on commit 1904836

Please sign in to comment.