mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Observability Onboarding] Integration tests for auto-detect happy path (#189335)
Resolves #186652 - Integration tests for auto-detect happy path - Adds docker metrics detection
This commit is contained in:
parent
e523debb2c
commit
ffa3843464
7 changed files with 121 additions and 2 deletions
|
@ -113,6 +113,7 @@ export const AutoDetectPanel: FunctionComponent = () => {
|
|||
{ defaultMessage: 'Your data is ready to explore!' }
|
||||
)}
|
||||
isLoading={false}
|
||||
data-test-subj="observabilityOnboardingAutoDetectPanelDataReceivedProgressIndicator"
|
||||
/>
|
||||
) : status === 'awaitingData' ? (
|
||||
<ProgressIndicator
|
||||
|
@ -120,6 +121,7 @@ export const AutoDetectPanel: FunctionComponent = () => {
|
|||
'xpack.observability_onboarding.autoDetectPanel.installingElasticAgentFlexItemLabel',
|
||||
{ defaultMessage: 'Waiting for data to arrive...' }
|
||||
)}
|
||||
data-test-subj="observabilityOnboardingAutoDetectPanelAwaitingDataProgressIndicator"
|
||||
/>
|
||||
) : status === 'inProgress' ? (
|
||||
<ProgressIndicator
|
||||
|
@ -127,6 +129,7 @@ export const AutoDetectPanel: FunctionComponent = () => {
|
|||
'xpack.observability_onboarding.autoDetectPanel.lookingForLogFilesFlexItemLabel',
|
||||
{ defaultMessage: 'Waiting for installation to complete...' }
|
||||
)}
|
||||
data-test-subj="observabilityOnboardingAutoDetectPanelInProgressProgressIndicator"
|
||||
/>
|
||||
) : null}
|
||||
{(status === 'awaitingData' || status === 'dataReceived') &&
|
||||
|
|
|
@ -62,7 +62,7 @@ export function GetStartedPanel({
|
|||
<EuiFlexItem>
|
||||
<EuiFlexGroup direction="column" gutterSize="s">
|
||||
{dashboardLinks.map(({ id, label, title }) => (
|
||||
<EuiFlexItem>
|
||||
<EuiFlexItem key={id}>
|
||||
<EuiFlexGroup direction="column" gutterSize="xs" alignItems="flexStart">
|
||||
<EuiText key={id} size="s">
|
||||
<p>{title}</p>
|
||||
|
|
|
@ -348,7 +348,9 @@ detect_known_integrations() {
|
|||
fi
|
||||
done
|
||||
|
||||
if compgen -G "/var/lib/docker/containers/*/*-json.log" > /dev/null; then
|
||||
if [ -S /var/run/docker.sock ]; then
|
||||
known_integrations_list_string+="docker"$'\n'
|
||||
elif compgen -G "/var/lib/docker/containers/*/*-json.log" > /dev/null; then
|
||||
known_integrations_list_string+="docker"$'\n'
|
||||
fi
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ export function createTestConfig(options: CreateTestConfigOptions) {
|
|||
observabilityLogsExplorer: {
|
||||
pathname: '/app/observability-logs-explorer',
|
||||
},
|
||||
observabilityOnboarding: {
|
||||
pathname: '/app/observabilityOnboarding',
|
||||
},
|
||||
management: {
|
||||
pathname: '/app/management',
|
||||
},
|
||||
|
|
|
@ -15,6 +15,7 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./navigation'));
|
||||
loadTestFile(require.resolve('./observability_logs_explorer'));
|
||||
loadTestFile(require.resolve('./dataset_quality'));
|
||||
loadTestFile(require.resolve('./onboarding'));
|
||||
loadTestFile(require.resolve('./rules/rules_list'));
|
||||
loadTestFile(require.resolve('./cases'));
|
||||
loadTestFile(require.resolve('./advanced_settings'));
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import expect from 'expect';
|
||||
import { generateLongId, log, timerange } from '@kbn/apm-synthtrace-client';
|
||||
import moment from 'moment';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const PageObjects = getPageObjects([
|
||||
'datasetQuality',
|
||||
'observabilityLogsExplorer',
|
||||
'common',
|
||||
'svlCommonNavigation',
|
||||
'svlCommonPage',
|
||||
]);
|
||||
|
||||
const browser = getService('browser');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const supertest = getService('supertest');
|
||||
const synthtrace = getService('svlLogsSynthtraceClient');
|
||||
|
||||
describe('Onboarding Auto-Detect', () => {
|
||||
before(async () => {
|
||||
await PageObjects.svlCommonPage.loginAsAdmin(); // Onboarding requires admin role
|
||||
await PageObjects.common.navigateToUrlWithBrowserHistory(
|
||||
'observabilityOnboarding',
|
||||
'/auto-detect/',
|
||||
'?category=logs',
|
||||
{
|
||||
ensureCurrentUrl: false, // the check sometimes is too slow for the page so it misses the point in time before the app rewrites the URL
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await synthtrace.clean();
|
||||
});
|
||||
|
||||
it('guides user through data onboarding', async () => {
|
||||
await testSubjects.clickWhenNotDisabled('observabilityOnboardingCopyToClipboardButton');
|
||||
const copiedCommand = await browser.getClipboardValue();
|
||||
|
||||
const commandRegex =
|
||||
/sudo bash auto_detect\.sh --id=(\S+) --kibana-url=(\S+) --install-key=(\S+) --ingest-key=(\S+) --ea-version=(\S+)/;
|
||||
|
||||
expect(copiedCommand).toMatch(commandRegex);
|
||||
|
||||
const [, onboardingId, _kibanaUrl, installKey, _ingestKey, _eaVersion] =
|
||||
copiedCommand.match(commandRegex)!;
|
||||
|
||||
// Simulate bash script installing detected integrations
|
||||
await supertest
|
||||
.post(`/internal/observability_onboarding/flow/${onboardingId}/integrations/install`)
|
||||
.set('Authorization', `ApiKey ${installKey}`)
|
||||
.set('Content-Type', 'text/tab-separated-values')
|
||||
.set('x-elastic-internal-origin', 'Kibana')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.send('system\tregistry\n')
|
||||
.expect(200);
|
||||
|
||||
// Simulate bash script installing Elastic Agent
|
||||
const agentId = generateLongId();
|
||||
await supertest
|
||||
.post(`/internal/observability_onboarding/flow/${onboardingId}/step/ea-status`)
|
||||
.set('Authorization', `ApiKey ${installKey}`)
|
||||
.set('x-elastic-internal-origin', 'Kibana')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.send({ status: 'complete', message: '', payload: { agentId } })
|
||||
.expect(200);
|
||||
|
||||
// Simulate Elastic Agent ingesting log files
|
||||
const to = new Date().toISOString();
|
||||
const count = 1;
|
||||
await synthtrace.index(
|
||||
timerange(moment(to).subtract(count, 'minute'), moment(to))
|
||||
.interval('1m')
|
||||
.rate(1)
|
||||
.generator((timestamp) => {
|
||||
return log.create().dataset('system.syslog').timestamp(timestamp).defaults({
|
||||
'agent.id': agentId,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
// Wait for logs to be ingested
|
||||
await testSubjects.existOrFail(
|
||||
'observabilityOnboardingAutoDetectPanelDataReceivedProgressIndicator'
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ loadTestFile }: FtrProviderContext) {
|
||||
describe('Onboarding', function () {
|
||||
loadTestFile(require.resolve('./auto_detect'));
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue