diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_details.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_details.ts new file mode 100644 index 0000000000000..aab50a5e8afbb --- /dev/null +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_details.ts @@ -0,0 +1,130 @@ +/* + * 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 { LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; +import expect from '@kbn/expect'; +import { log, timerange } from '@kbn/apm-synthtrace-client'; + +import { SupertestWithRoleScopeType } from '../../../services'; +import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { + const roleScopedSupertest = getService('roleScopedSupertest'); + const synthtrace = getService('synthtrace'); + const start = '2023-12-11T18:00:00.000Z'; + const end = '2023-12-11T18:01:00.000Z'; + const type = 'logs'; + const dataset = 'nginx.access'; + const namespace = 'default'; + const serviceName = 'my-service'; + const hostName = 'synth-host'; + + async function callApiAs( + roleScopedSupertestWithCookieCredentials: SupertestWithRoleScopeType, + dataStream: string + ) { + return roleScopedSupertestWithCookieCredentials + .get(`/internal/dataset_quality/data_streams/${dataStream}/details`) + .query({ + start, + end, + }); + } + + describe('DataStream Details', function () { + let synthtraceLogsEsClient: LogsSynthtraceEsClient; + + before(async () => { + synthtraceLogsEsClient = await synthtrace.createLogsSynthtraceEsClient(); + + await synthtraceLogsEsClient.index([ + timerange(start, end) + .interval('1m') + .rate(1) + .generator((timestamp) => + log + .create() + .message('This is a log message') + .timestamp(timestamp) + .dataset(dataset) + .namespace(namespace) + .defaults({ + 'log.file.path': '/my-service.log', + 'service.name': serviceName, + 'host.name': hostName, + }) + ), + ]); + }); + + after(async () => { + await synthtraceLogsEsClient.clean(); + }); + + describe('Viewer User', function () { + let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType; + + before(async () => { + supertestViewerWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope( + 'viewer', + { + useCookieHeader: true, + withInternalHeaders: true, + } + ); + }); + + it('returns lastActivity as undefined when user does not have access to the data stream', async () => { + const resp = await callApiAs( + supertestViewerWithCookieCredentials, + `${type}-${dataset}-${namespace}` + ); + expect(resp.body.lastActivity).to.be(undefined); + + // userPrivileges.canMonitor should be false for readUser + expect(resp.body.userPrivileges?.canMonitor).to.be(false); + }); + }); + + describe('Editor User', function () { + let supertestEditorWithCookieCredentials: SupertestWithRoleScopeType; + + before(async () => { + supertestEditorWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope( + 'editor', + { + useCookieHeader: true, + withInternalHeaders: true, + } + ); + }); + + it('returns error when dataStream param is not provided', async () => { + const expectedMessage = 'Data Stream name cannot be empty'; + const resp = await callApiAs(supertestEditorWithCookieCredentials, encodeURIComponent(' ')); + expect(resp.status).to.be(400); + expect(resp.body.message.indexOf(expectedMessage)).to.greaterThan(-1); + }); + + it('returns {} if matching data stream is not available', async () => { + const nonExistentDataSet = 'Non-existent'; + const nonExistentDataStream = `${type}-${nonExistentDataSet}-${namespace}`; + const resp = await callApiAs(supertestEditorWithCookieCredentials, nonExistentDataStream); + expect(resp.body).empty(); + }); + + it('returns service.name and host.name correctly', async () => { + const resp = await callApiAs( + supertestEditorWithCookieCredentials, + `${type}-${dataset}-${namespace}` + ); + expect(resp.body.services).to.eql({ ['service.name']: [serviceName] }); + expect(resp.body.hosts?.['host.name']).to.eql([hostName]); + }); + }); + }); +} diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_settings.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_settings.ts index 8d6b219457dbd..4a8ed68401cc7 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_settings.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/data_stream_settings.ts @@ -13,7 +13,7 @@ import { createBackingIndexNameWithoutVersion, getDataStreamSettingsOfEarliestIndex, rolloverDataStream, -} from './utils/es_utils'; +} from './utils'; import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; import { RoleCredentials, SupertestWithRoleScopeType } from '../../../services'; diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_docs.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_docs.ts new file mode 100644 index 0000000000000..422d14eb5667a --- /dev/null +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_docs.ts @@ -0,0 +1,212 @@ +/* + * 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 { LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; +import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import { log, timerange } from '@kbn/apm-synthtrace-client'; +import { DataStreamDocsStat } from '@kbn/dataset-quality-plugin/common/api_types'; +import { SupertestWithRoleScopeType } from '../../../services'; +import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { + const roleScopedSupertest = getService('roleScopedSupertest'); + const synthtrace = getService('synthtrace'); + const start = '2023-12-11T18:00:00.000Z'; + const end = '2023-12-11T18:01:00.000Z'; + + async function callApiAs(roleScopedSupertestWithCookieCredentials: SupertestWithRoleScopeType) { + return roleScopedSupertestWithCookieCredentials + .get(`/internal/dataset_quality/data_streams/degraded_docs`) + .query({ + types: rison.encodeArray(['logs']), + start, + end, + }); + } + + describe('Degraded docs', function () { + describe('Querying', function () { + let synthtraceLogsEsClient: LogsSynthtraceEsClient; + let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType; + + before(async () => { + synthtraceLogsEsClient = await synthtrace.createLogsSynthtraceEsClient(); + supertestViewerWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope( + 'viewer', + { + useCookieHeader: true, + withInternalHeaders: true, + } + ); + }); + + describe('and there are log documents', () => { + before(async () => { + await synthtraceLogsEsClient.index([ + timerange(start, end) + .interval('1m') + .rate(1) + .generator((timestamp) => + log + .create() + .message('This is a log message') + .timestamp(timestamp) + .dataset('synth.1') + .defaults({ + 'log.file.path': '/my-service.log', + }) + ), + timerange(start, end) + .interval('1m') + .rate(1) + .generator((timestamp) => + log + .create() + .message('This is a log message') + .timestamp(timestamp) + .dataset('synth.2') + .logLevel(MORE_THAN_1024_CHARS) + .defaults({ + 'log.file.path': '/my-service.log', + }) + ), + ]); + }); + + it('returns stats correctly', async () => { + const stats = await callApiAs(supertestViewerWithCookieCredentials); + expect(stats.body.degradedDocs.length).to.be(1); + + const degradedDocsStats = stats.body.degradedDocs.reduce( + (acc: Record, curr: DataStreamDocsStat) => ({ + ...acc, + [curr.dataset]: { + count: curr.count, + }, + }), + {} + ); + + expect(degradedDocsStats['logs-synth.2-default']).to.eql({ + count: 1, + }); + }); + + after(async () => { + await synthtraceLogsEsClient.clean(); + }); + }); + + describe('and there are not log documents', () => { + it('returns stats correctly', async () => { + const stats = await callApiAs(supertestViewerWithCookieCredentials); + + expect(stats.body.degradedDocs.length).to.be(0); + }); + }); + + describe('when there are data streams of different spaces', () => { + const spaces = ['default', 'space1', 'space2']; + const datasetsWithNoDegradedDocs = ['nginx.access', 'apache.access', 'mysql.access']; + const datasetsWithDegradedDocs = ['nginx.error', 'apache.error', 'mysql.error']; + + before(async () => { + for (const space of spaces) { + for (const dataset of datasetsWithNoDegradedDocs) { + await synthtraceLogsEsClient.index([ + timerange(start, end) + .interval('1m') + .rate(1) + .generator((timestamp) => + log + .create() + .message('This is a log message') + .timestamp(timestamp) + .dataset(dataset) + .namespace(space) + ), + ]); + } + + for (const dataset of datasetsWithDegradedDocs) { + await synthtraceLogsEsClient.index([ + timerange(start, end) + .interval('1m') + .rate(2) + .generator((timestamp: number, index: number) => + log + .create() + .message('This is a log message') + .timestamp(timestamp) + .dataset(dataset) + .namespace(space) + .logLevel(index % 2 === 0 ? MORE_THAN_1024_CHARS : 'This is a log message') + ), + ]); + } + } + }); + + it('returns counts and list of datasets correctly', async () => { + const stats = await callApiAs(supertestViewerWithCookieCredentials); + expect(stats.body.degradedDocs.length).to.be(9); + + const expected = { + degradedDocs: [ + { + dataset: 'logs-apache.error-default', + count: 1, + }, + { + dataset: 'logs-apache.error-space1', + count: 1, + }, + { + dataset: 'logs-apache.error-space2', + count: 1, + }, + { + dataset: 'logs-mysql.error-default', + count: 1, + }, + { + dataset: 'logs-mysql.error-space1', + count: 1, + }, + { + dataset: 'logs-mysql.error-space2', + count: 1, + }, + { + dataset: 'logs-nginx.error-default', + count: 1, + }, + { + dataset: 'logs-nginx.error-space1', + count: 1, + }, + { + dataset: 'logs-nginx.error-space2', + count: 1, + }, + ], + }; + + expect(stats.body).to.eql(expected); + }); + + after(async () => { + await synthtraceLogsEsClient.clean(); + }); + }); + }); + }); +} + +const MORE_THAN_1024_CHARS = + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?'; diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_analyze.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_analyze.ts index 38ad6e04e2ef8..13a862d4847ea 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_analyze.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_analyze.ts @@ -10,7 +10,7 @@ import { log, timerange } from '@kbn/apm-synthtrace-client'; import { LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; import { SupertestWithRoleScopeType } from '../../../services'; import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; -import { createBackingIndexNameWithoutVersion, setDataStreamSettings } from './utils/es_utils'; +import { createBackingIndexNameWithoutVersion, setDataStreamSettings } from './utils'; import { logsSynthMappings } from './custom_mappings/custom_synth_mappings'; const MORE_THAN_1024_CHARS = diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/degraded_field_values.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_values.ts similarity index 69% rename from x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/degraded_field_values.ts rename to x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_values.ts index 397e191d450a8..b1c12dc793d15 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/degraded_field_values.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_field_values.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { log, timerange } from '@kbn/apm-synthtrace-client'; +import { LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; import expect from '@kbn/expect'; -import { DatasetQualityFtrContextProvider } from './common/services'; -import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; +import { log, timerange } from '@kbn/apm-synthtrace-client'; + +import { SupertestWithRoleScopeType } from '../../../services'; +import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; const MORE_THAN_1024_CHARS = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?'; @@ -16,11 +18,9 @@ const MORE_THAN_1024_CHARS = const ANOTHER_1024_CHARS = 'grape fig tangerine tangerine kiwi lemon papaya cherry nectarine papaya mango cherry nectarine fig cherry fig grape mango mango quince fig strawberry mango quince date kiwi quince raspberry apple kiwi banana quince fig papaya grape mango cherry banana mango cherry lemon cherry tangerine fig quince quince papaya tangerine grape strawberry banana kiwi grape mango papaya nectarine banana nectarine kiwi papaya lemon apple lemon orange fig cherry grape apple nectarine papaya orange fig papaya date mango papaya mango cherry tangerine papaya apple banana papaya cherry strawberry grape raspberry lemon date papaya mango kiwi cherry fig banana banana apple date strawberry mango tangerine date lemon kiwi quince date orange orange papaya date apple fig tangerine quince tangerine date papaya banana banana orange raspberry papaya apple nectarine lemon raspberry raspberry mango cherry kiwi cherry cherry nectarine cherry date strawberry banana orange mango mango tangerine quince papaya papaya kiwi papaya strawberry date mango'; -export default function ApiTest({ getService }: DatasetQualityFtrContextProvider) { - const synthtrace = getService('logSynthtraceEsClient'); - const datasetQualityApiClient = getService('datasetQualityApiClient'); - const svlUserManager = getService('svlUserManager'); - const svlCommonApi = getService('svlCommonApi'); +export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { + const roleScopedSupertest = getService('roleScopedSupertest'); + const synthtrace = getService('synthtrace'); const start = '2024-08-28T08:00:00.000Z'; const end = '2024-08-28T08:02:00.000Z'; const degradedFieldDataset = 'nginx.error'; @@ -29,39 +29,31 @@ export default function ApiTest({ getService }: DatasetQualityFtrContextProvider const regularFieldName = 'service.name'; const serviceName = 'my-service'; - async function callApiAs({ - dataStream, - degradedField, - roleAuthc, - internalReqHeader, - }: { - dataStream: string; - degradedField: string; - roleAuthc: RoleCredentials; - internalReqHeader: InternalRequestHeader; - }) { - return await datasetQualityApiClient.slsUser({ - endpoint: - 'GET /internal/dataset_quality/data_streams/{dataStream}/degraded_field/{degradedField}/values', - params: { - path: { - dataStream, - degradedField, - }, - }, - roleAuthc, - internalReqHeader, - }); + async function callApiAs( + roleScopedSupertestWithCookieCredentials: SupertestWithRoleScopeType, + dataStream: string, + degradedField: string + ) { + return roleScopedSupertestWithCookieCredentials.get( + `/internal/dataset_quality/data_streams/${dataStream}/degraded_field/${degradedField}/values` + ); } describe('Degraded Fields Values per field', () => { - let roleAuthc: RoleCredentials; - let internalReqHeader: InternalRequestHeader; + let synthtraceLogsEsClient: LogsSynthtraceEsClient; + let supertestEditorWithCookieCredentials: SupertestWithRoleScopeType; before(async () => { - roleAuthc = await svlUserManager.createM2mApiKeyWithRoleScope('admin'); - internalReqHeader = svlCommonApi.getInternalRequestHeader(); - await synthtrace.index([ + synthtraceLogsEsClient = await synthtrace.createLogsSynthtraceEsClient(); + supertestEditorWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope( + 'editor', + { + useCookieHeader: true, + withInternalHeaders: true, + } + ); + + await synthtraceLogsEsClient.index([ timerange(start, end) .interval('1m') .rate(1) @@ -83,27 +75,24 @@ export default function ApiTest({ getService }: DatasetQualityFtrContextProvider }); after(async () => { - await synthtrace.clean(); - await svlUserManager.invalidateM2mApiKeyWithRoleScope(roleAuthc); + await synthtraceLogsEsClient.clean(); }); it('returns no values when provided field has no degraded values', async () => { - const resp = await callApiAs({ - dataStream: degradedFieldsDatastream, - degradedField: regularFieldName, - roleAuthc, - internalReqHeader, - }); + const resp = await callApiAs( + supertestEditorWithCookieCredentials, + degradedFieldsDatastream, + regularFieldName + ); expect(resp.body.values.length).to.be(0); }); it('returns values when provided field has degraded values', async () => { - const resp = await callApiAs({ - dataStream: degradedFieldsDatastream, - degradedField: degradedFieldName, - roleAuthc, - internalReqHeader, - }); + const resp = await callApiAs( + supertestEditorWithCookieCredentials, + degradedFieldsDatastream, + degradedFieldName + ); expect(resp.body.values.length).to.be(2); }); }); diff --git a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_fields.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_fields.ts similarity index 77% rename from x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_fields.spec.ts rename to x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_fields.ts index 100783e26e0ee..ef0798ef2beb7 100644 --- a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_fields.spec.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/degraded_fields.ts @@ -5,21 +5,20 @@ * 2.0. */ +import { LogsSynthtraceEsClient } from '@kbn/apm-synthtrace'; import { log, timerange } from '@kbn/apm-synthtrace-client'; import expect from '@kbn/expect'; import { DegradedField } from '@kbn/dataset-quality-plugin/common/api_types'; -import { DatasetQualityApiClientKey } from '../../common/config'; -import { FtrProviderContext } from '../../common/ftr_provider_context'; -import { rolloverDataStream } from '../../utils'; -import { createBackingIndexNameWithoutVersion } from './es_utils'; +import { DeploymentAgnosticFtrProviderContext } from '../../../ftr_provider_context'; +import { SupertestWithRoleScopeType } from '../../../services'; +import { rolloverDataStream, createBackingIndexNameWithoutVersion } from './utils'; const MORE_THAN_1024_CHARS = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?'; -export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); - const synthtrace = getService('logSynthtraceEsClient'); - const datasetQualityApiClient = getService('datasetQualityApiClient'); +export default function ({ getService }: DeploymentAgnosticFtrProviderContext) { + const roleScopedSupertest = getService('roleScopedSupertest'); + const synthtrace = getService('synthtrace'); const esClient = getService('es'); const start = '2024-05-22T08:00:00.000Z'; const end = '2024-05-23T08:02:00.000Z'; @@ -30,25 +29,36 @@ export default function ApiTest({ getService }: FtrProviderContext) { const serviceName = 'my-service'; const hostName = 'synth-host'; - async function callApiAs(user: DatasetQualityApiClientKey, dataStream: string) { - return await datasetQualityApiClient[user]({ - endpoint: 'GET /internal/dataset_quality/data_streams/{dataStream}/degraded_fields', - params: { - path: { - dataStream, - }, - query: { - start, - end, - }, - }, - }); + async function callApiAs( + roleScopedSupertestWithCookieCredentials: SupertestWithRoleScopeType, + dataStream: string + ) { + return roleScopedSupertestWithCookieCredentials + .get(`/internal/dataset_quality/data_streams/${dataStream}/degraded_fields`) + .query({ + start, + end, + }); } - registry.when('Degraded Fields per DataStream', { config: 'basic' }, () => { + describe('Degraded Fields per DataStream', function () { + let synthtraceLogsEsClient: LogsSynthtraceEsClient; + let supertestEditorWithCookieCredentials: SupertestWithRoleScopeType; + + before(async () => { + synthtraceLogsEsClient = await synthtrace.createLogsSynthtraceEsClient(); + supertestEditorWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope( + 'editor', + { + useCookieHeader: true, + withInternalHeaders: true, + } + ); + }); + describe('gets the degraded fields per data stream', () => { before(async () => { - await synthtrace.index([ + await synthtraceLogsEsClient.index([ timerange(start, end) .interval('1m') .rate(1) @@ -86,12 +96,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); after(async () => { - await synthtrace.clean(); + await synthtraceLogsEsClient.clean(); }); it('returns no results when dataStream does not have any degraded fields', async () => { const resp = await callApiAs( - 'datasetQualityMonitorUser', + supertestEditorWithCookieCredentials, `${type}-${dataset}-${namespace}` ); expect(resp.body.degradedFields.length).to.be(0); @@ -100,7 +110,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns results when dataStream do have degraded fields', async () => { const expectedDegradedFields = ['log.level', 'trace.id']; const resp = await callApiAs( - 'datasetQualityMonitorUser', + supertestEditorWithCookieCredentials, `${type}-${degradedFieldDataset}-${namespace}` ); const degradedFields = resp.body.degradedFields.map((field: DegradedField) => field.name); @@ -123,12 +133,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { ]; const resp = await callApiAs( - 'datasetQualityMonitorUser', + supertestEditorWithCookieCredentials, `${type}-${degradedFieldDataset}-${namespace}` ); const logLevelTimeSeries = resp.body.degradedFields.find( - (dFields) => dFields.name === 'log.level' + (dFields: DegradedField) => dFields.name === 'log.level' )?.timeSeries; expect(logLevelTimeSeries).to.eql(logsTimeSeriesData); @@ -136,7 +146,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('should return the backing index where the ignored field was last seen', async () => { await rolloverDataStream(esClient, `${type}-${degradedFieldDataset}-${namespace}`); - await synthtrace.index([ + await synthtraceLogsEsClient.index([ timerange(start, end) .interval('1m') .rate(1) @@ -156,16 +166,16 @@ export default function ApiTest({ getService }: FtrProviderContext) { ]); const resp = await callApiAs( - 'datasetQualityMonitorUser', + supertestEditorWithCookieCredentials, `${type}-${degradedFieldDataset}-${namespace}` ); const logLevelLastBackingIndex = resp.body.degradedFields.find( - (dFields) => dFields.name === 'log.level' + (dFields: DegradedField) => dFields.name === 'log.level' )?.indexFieldWasLastPresentIn; const traceIdLastBackingIndex = resp.body.degradedFields.find( - (dFields) => dFields.name === 'trace.id' + (dFields: DegradedField) => dFields.name === 'trace.id' )?.indexFieldWasLastPresentIn; expect(logLevelLastBackingIndex).to.be( diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/index.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/index.ts index 28133d6c8e613..0481e882aee6e 100644 --- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/index.ts +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/index.ts @@ -15,5 +15,9 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) loadTestFile(require.resolve('./data_stream_rollover')); loadTestFile(require.resolve('./update_field_limit')); loadTestFile(require.resolve('./data_stream_total_docs')); + loadTestFile(require.resolve('./degraded_docs')); + loadTestFile(require.resolve('./degraded_fields')); + loadTestFile(require.resolve('./data_stream_details')); + loadTestFile(require.resolve('./degraded_field_values')); }); } diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/utils/index.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/utils/index.ts new file mode 100644 index 0000000000000..5e02d4f42da3a --- /dev/null +++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/dataset_quality/utils/index.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ + +export * from './es_utils'; diff --git a/x-pack/test/dataset_quality_api_integration/tests/data_streams/data_stream_details.spec.ts b/x-pack/test/dataset_quality_api_integration/tests/data_streams/data_stream_details.spec.ts index 44e1dc08689b2..0c9297ab0d426 100644 --- a/x-pack/test/dataset_quality_api_integration/tests/data_streams/data_stream_details.spec.ts +++ b/x-pack/test/dataset_quality_api_integration/tests/data_streams/data_stream_details.spec.ts @@ -8,9 +8,7 @@ import { log, timerange } from '@kbn/apm-synthtrace-client'; import expect from '@kbn/expect'; import { DatasetQualityApiClientKey } from '../../common/config'; -import { DatasetQualityApiError } from '../../common/dataset_quality_api_supertest'; import { FtrProviderContext } from '../../common/ftr_provider_context'; -import { expectToReject } from '../../utils'; export default function ApiTest({ getService }: FtrProviderContext) { const registry = getService('registry'); @@ -62,30 +60,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { ]); }); - it('returns lastActivity as undefined when user does not have access to the data stream', async () => { - const resp = await callApiAs('viewerUser', `${type}-${dataset}-${namespace}`); - expect(resp.body.lastActivity).to.be(undefined); - - // userPrivileges.canMonitor should be false for readUser - expect(resp.body.userPrivileges?.canMonitor).to.be(false); - }); - - it('returns error when dataStream param is not provided', async () => { - const expectedMessage = 'Data Stream name cannot be empty'; - const err = await expectToReject(() => - callApiAs('datasetQualityMonitorUser', encodeURIComponent(' ')) - ); - expect(err.res.status).to.be(400); - expect(err.res.body.message.indexOf(expectedMessage)).to.greaterThan(-1); - }); - - it('returns {} if matching data stream is not available', async () => { - const nonExistentDataSet = 'Non-existent'; - const nonExistentDataStream = `${type}-${nonExistentDataSet}-${namespace}`; - const resp = await callApiAs('datasetQualityMonitorUser', nonExistentDataStream); - expect(resp.body).empty(); - }); - it('returns "sizeBytes" correctly', async () => { const resp = await callApiAs( 'datasetQualityMonitorUser', @@ -95,15 +69,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(resp.body.sizeBytes).to.be.greaterThan(0); }); - it('returns service.name and host.name correctly', async () => { - const resp = await callApiAs( - 'datasetQualityMonitorUser', - `${type}-${dataset}-${namespace}` - ); - expect(resp.body.services).to.eql({ ['service.name']: [serviceName] }); - expect(resp.body.hosts?.['host.name']).to.eql([hostName]); - }); - after(async () => { await synthtrace.clean(); }); diff --git a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_docs.spec.ts b/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_docs.spec.ts deleted file mode 100644 index 60aeef1af9c93..0000000000000 --- a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_docs.spec.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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 { log, timerange } from '@kbn/apm-synthtrace-client'; -import expect from '@kbn/expect'; -import rison from '@kbn/rison'; -import { DatasetQualityApiClientKey } from '../../common/config'; -import { FtrProviderContext } from '../../common/ftr_provider_context'; - -export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); - const synthtrace = getService('logSynthtraceEsClient'); - const datasetQualityApiClient = getService('datasetQualityApiClient'); - const start = '2023-12-11T18:00:00.000Z'; - const end = '2023-12-11T18:01:00.000Z'; - - async function callApiAs(user: DatasetQualityApiClientKey) { - return await datasetQualityApiClient[user]({ - endpoint: 'GET /internal/dataset_quality/data_streams/degraded_docs', - params: { - query: { - types: rison.encodeArray(['logs']), - start, - end, - }, - }, - }); - } - - registry.when('Degraded docs', { config: 'basic' }, () => { - describe('and there are log documents', () => { - before(async () => { - await synthtrace.index([ - timerange(start, end) - .interval('1m') - .rate(1) - .generator((timestamp) => - log - .create() - .message('This is a log message') - .timestamp(timestamp) - .dataset('synth.1') - .defaults({ - 'log.file.path': '/my-service.log', - }) - ), - timerange(start, end) - .interval('1m') - .rate(1) - .generator((timestamp) => - log - .create() - .message('This is a log message') - .timestamp(timestamp) - .dataset('synth.2') - .logLevel(MORE_THAN_1024_CHARS) - .defaults({ - 'log.file.path': '/my-service.log', - }) - ), - ]); - }); - - it('returns stats correctly', async () => { - const stats = await callApiAs('datasetQualityMonitorUser'); - expect(stats.body.degradedDocs.length).to.be(1); - - const degradedDocsStats = stats.body.degradedDocs.reduce( - (acc, curr) => ({ - ...acc, - [curr.dataset]: { - count: curr.count, - }, - }), - {} as Record - ); - - expect(degradedDocsStats['logs-synth.2-default']).to.eql({ - count: 1, - }); - }); - - after(async () => { - await synthtrace.clean(); - }); - }); - - describe('and there are not log documents', () => { - it('returns stats correctly', async () => { - const stats = await callApiAs('datasetQualityMonitorUser'); - - expect(stats.body.degradedDocs.length).to.be(0); - }); - }); - - describe('when there are data streams of different spaces', () => { - const spaces = ['default', 'space1', 'space2']; - const datasetsWithNoDegradedDocs = ['nginx.access', 'apache.access', 'mysql.access']; - const datasetsWithDegradedDocs = ['nginx.error', 'apache.error', 'mysql.error']; - - before(async () => { - for (const space of spaces) { - for (const dataset of datasetsWithNoDegradedDocs) { - await synthtrace.index([ - timerange(start, end) - .interval('1m') - .rate(1) - .generator((timestamp) => - log - .create() - .message('This is a log message') - .timestamp(timestamp) - .dataset(dataset) - .namespace(space) - ), - ]); - } - - for (const dataset of datasetsWithDegradedDocs) { - await synthtrace.index([ - timerange(start, end) - .interval('1m') - .rate(2) - .generator((timestamp: number, index: number) => - log - .create() - .message('This is a log message') - .timestamp(timestamp) - .dataset(dataset) - .namespace(space) - .logLevel(index % 2 === 0 ? MORE_THAN_1024_CHARS : 'This is a log message') - ), - ]); - } - } - }); - - it('returns counts and list of datasets correctly', async () => { - const stats = await callApiAs('datasetQualityMonitorUser'); - expect(stats.body.degradedDocs.length).to.be(9); - - const expected = { - degradedDocs: [ - { - dataset: 'logs-apache.error-default', - count: 1, - }, - { - dataset: 'logs-apache.error-space1', - count: 1, - }, - { - dataset: 'logs-apache.error-space2', - count: 1, - }, - { - dataset: 'logs-mysql.error-default', - count: 1, - }, - { - dataset: 'logs-mysql.error-space1', - count: 1, - }, - { - dataset: 'logs-mysql.error-space2', - count: 1, - }, - { - dataset: 'logs-nginx.error-default', - count: 1, - }, - { - dataset: 'logs-nginx.error-space1', - count: 1, - }, - { - dataset: 'logs-nginx.error-space2', - count: 1, - }, - ], - }; - - expect(stats.body).to.eql(expected); - }); - - after(async () => { - await synthtrace.clean(); - }); - }); - }); -} - -const MORE_THAN_1024_CHARS = - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?'; diff --git a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_field_values.spec.ts b/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_field_values.spec.ts deleted file mode 100644 index 6eae916116e5c..0000000000000 --- a/x-pack/test/dataset_quality_api_integration/tests/data_streams/degraded_field_values.spec.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 { log, timerange } from '@kbn/apm-synthtrace-client'; -import expect from '@kbn/expect'; -import { DatasetQualityApiClientKey } from '../../common/config'; -import { FtrProviderContext } from '../../common/ftr_provider_context'; - -const MORE_THAN_1024_CHARS = - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?'; - -const ANOTHER_1024_CHARS = - 'grape fig tangerine tangerine kiwi lemon papaya cherry nectarine papaya mango cherry nectarine fig cherry fig grape mango mango quince fig strawberry mango quince date kiwi quince raspberry apple kiwi banana quince fig papaya grape mango cherry banana mango cherry lemon cherry tangerine fig quince quince papaya tangerine grape strawberry banana kiwi grape mango papaya nectarine banana nectarine kiwi papaya lemon apple lemon orange fig cherry grape apple nectarine papaya orange fig papaya date mango papaya mango cherry tangerine papaya apple banana papaya cherry strawberry grape raspberry lemon date papaya mango kiwi cherry fig banana banana apple date strawberry mango tangerine date lemon kiwi quince date orange orange papaya date apple fig tangerine quince tangerine date papaya banana banana orange raspberry papaya apple nectarine lemon raspberry raspberry mango cherry kiwi cherry cherry nectarine cherry date strawberry banana orange mango mango tangerine quince papaya papaya kiwi papaya strawberry date mango'; - -export default function ApiTest({ getService }: FtrProviderContext) { - const registry = getService('registry'); - const synthtrace = getService('logSynthtraceEsClient'); - const datasetQualityApiClient = getService('datasetQualityApiClient'); - const start = '2024-08-28T08:00:00.000Z'; - const end = '2024-08-28T08:02:00.000Z'; - const degradedFieldDataset = 'nginx.error'; - const degradedFieldsDatastream = 'logs-nginx.error-default'; - const degradedFieldName = 'test_field'; - const regularFieldName = 'service.name'; - const serviceName = 'my-service'; - - async function callApiAs({ - user, - dataStream, - degradedField, - }: { - user: DatasetQualityApiClientKey; - dataStream: string; - degradedField: string; - }) { - return await datasetQualityApiClient[user]({ - endpoint: - 'GET /internal/dataset_quality/data_streams/{dataStream}/degraded_field/{degradedField}/values', - params: { - path: { - dataStream, - degradedField, - }, - }, - }); - } - - registry.when('Degraded Fields Values per field', { config: 'basic' }, () => { - describe('gets the degraded fields values for a given field', () => { - before(async () => { - await synthtrace.index([ - timerange(start, end) - .interval('1m') - .rate(1) - .generator((timestamp) => - log - .create() - .message('This is a error message') - .logLevel(MORE_THAN_1024_CHARS) - .timestamp(timestamp) - .dataset(degradedFieldDataset) - .defaults({ - 'log.file.path': '/error.log', - 'service.name': serviceName + 1, - 'trace.id': MORE_THAN_1024_CHARS, - test_field: [ANOTHER_1024_CHARS, 'hello world', MORE_THAN_1024_CHARS], - }) - ), - ]); - }); - - after(async () => { - await synthtrace.clean(); - }); - - it('returns no values when provided field has no degraded values', async () => { - const resp = await callApiAs({ - user: 'datasetQualityMonitorUser', - dataStream: degradedFieldsDatastream, - degradedField: regularFieldName, - }); - expect(resp.body.values.length).to.be(0); - }); - - it('returns values when provided field has degraded values', async () => { - const resp = await callApiAs({ - user: 'datasetQualityMonitorUser', - dataStream: degradedFieldsDatastream, - degradedField: degradedFieldName, - }); - expect(resp.body.values.length).to.be(2); - }); - }); - }); -} diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/common/services.ts b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/common/services.ts index 3c15e7fffae04..8e1b727f378d7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/common/services.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/common/services.ts @@ -21,13 +21,13 @@ export type DatasetQualityServices = InheritedServices & { datasetQualityApiClient: ( context: InheritedFtrProviderContext ) => Promise; - logSynthtraceEsClient: (context: InheritedFtrProviderContext) => Promise; + logsSynthtraceEsClient: (context: InheritedFtrProviderContext) => Promise; }; export const services: DatasetQualityServices = { ...inheritedServices, datasetQualityApiClient: getDatasetQualityApiClientService, - logSynthtraceEsClient: async (context: InheritedFtrProviderContext) => + logsSynthtraceEsClient: async (context: InheritedFtrProviderContext) => new LogsSynthtraceEsClient({ client: context.getService('es'), logger: createLogger(LogLevel.info), diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/data_stream_details.ts b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/data_stream_details.ts index f6028c11f734a..27ee47d3e4110 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/data_stream_details.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/data_stream_details.ts @@ -8,16 +8,12 @@ import { log, timerange } from '@kbn/apm-synthtrace-client'; import expect from '@kbn/expect'; import type { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; -import { expectToReject } from './utils'; -import { - DatasetQualityApiClient, - DatasetQualityApiError, -} from './common/dataset_quality_api_supertest'; +import { DatasetQualityApiClient } from './common/dataset_quality_api_supertest'; import { DatasetQualityFtrContextProvider } from './common/services'; export default function ({ getService }: DatasetQualityFtrContextProvider) { const datasetQualityApiClient: DatasetQualityApiClient = getService('datasetQualityApiClient'); - const synthtrace = getService('logSynthtraceEsClient'); + const synthtrace = getService('logsSynthtraceEsClient'); const svlUserManager = getService('svlUserManager'); const svlCommonApi = getService('svlCommonApi'); const retry = getService('retry'); @@ -82,22 +78,6 @@ export default function ({ getService }: DatasetQualityFtrContextProvider) { await svlUserManager.invalidateM2mApiKeyWithRoleScope(roleAuthc); }); - it('returns error when dataStream param is not provided', async () => { - const expectedMessage = 'Data Stream name cannot be empty'; - const err = await expectToReject(() => - callApi(encodeURIComponent(' '), roleAuthc, internalReqHeader) - ); - expect(err.res.status).to.be(400); - expect(err.res.body.message.indexOf(expectedMessage)).to.greaterThan(-1); - }); - - it('returns {} if matching data stream is not available', async () => { - const nonExistentDataSet = 'Non-existent'; - const nonExistentDataStream = `${type}-${nonExistentDataSet}-${namespace}`; - const resp = await callApi(nonExistentDataStream, roleAuthc, internalReqHeader); - expect(resp.body).empty(); - }); - it('returns "sizeBytes" correctly', async () => { // Metering stats api is cached and refreshed every 30 seconds await retry.waitForWithTimeout('Metering stats cache is refreshed', 45000, async () => { @@ -117,11 +97,5 @@ export default function ({ getService }: DatasetQualityFtrContextProvider) { expect(isNaN(resp.body.sizeBytes as number)).to.be(false); expect(resp.body.sizeBytes).to.be.greaterThan(0); }); - - it('returns service.name and host.name correctly', async () => { - const resp = await callApi(`${type}-${dataset}-${namespace}`, roleAuthc, internalReqHeader); - expect(resp.body.services).to.eql({ ['service.name']: [serviceName] }); - expect(resp.body.hosts?.['host.name']).to.eql([hostName]); - }); }); } diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/index.ts b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/index.ts index 39b6a3cb476c1..680bb76432b3a 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/index.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/dataset_quality_api_integration/index.ts @@ -9,6 +9,5 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Dataset Quality', function () { loadTestFile(require.resolve('./data_stream_details')); - loadTestFile(require.resolve('./degraded_field_values')); }); }