mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* move test files to integration_tests * cleanup * fix2 * [Reporting] Fix skipped integrations test # Conflicts: # x-pack/plugins/reporting/server/routes/diagnostic/integration_tests/browser.test.ts # x-pack/plugins/reporting/server/routes/generate/integration_tests/generation_from_jobparams.test.ts # x-pack/plugins/reporting/server/routes/management/integration_tests/jobs.test.ts
This commit is contained in:
parent
51a931f21e
commit
0327f0e14c
7 changed files with 52 additions and 51 deletions
|
@ -8,14 +8,14 @@ import { errors } from '@elastic/elasticsearch';
|
|||
import { SecurityHasPrivilegesIndexPrivilegesCheck } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import {
|
||||
API_MIGRATE_ILM_POLICY_URL,
|
||||
API_GET_ILM_POLICY_STATUS,
|
||||
API_MIGRATE_ILM_POLICY_URL,
|
||||
ILM_POLICY_NAME,
|
||||
} from '../../common/constants';
|
||||
import { IlmPolicyStatusResponse } from '../../common/types';
|
||||
import { deprecations } from '../lib/deprecations';
|
||||
import { ReportingCore } from '../core';
|
||||
import { IlmPolicyManager, LevelLogger as Logger } from '../lib';
|
||||
} from '../../../common/constants';
|
||||
import { IlmPolicyStatusResponse } from '../../../common/types';
|
||||
import { ReportingCore } from '../../core';
|
||||
import { IlmPolicyManager, LevelLogger as Logger } from '../../lib';
|
||||
import { deprecations } from '../../lib/deprecations';
|
||||
|
||||
export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Logger) => {
|
||||
const { router } = reporting.getPluginSetupDeps();
|
||||
|
@ -69,7 +69,7 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log
|
|||
elasticsearch: { client: scopedClient },
|
||||
},
|
||||
},
|
||||
req,
|
||||
_req,
|
||||
res
|
||||
) => {
|
||||
const checkIlmMigrationStatus = () => {
|
||||
|
@ -97,7 +97,7 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log
|
|||
|
||||
router.put(
|
||||
{ path: API_MIGRATE_ILM_POLICY_URL, validate: false },
|
||||
authzWrapper(async ({ core: { elasticsearch } }, req, res) => {
|
||||
authzWrapper(async ({ core: { elasticsearch } }, _req, res) => {
|
||||
const store = await reporting.getStore();
|
||||
const {
|
||||
client: { asCurrentUser: client },
|
|
@ -8,24 +8,21 @@
|
|||
import { of } from 'rxjs';
|
||||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
import { API_GET_ILM_POLICY_STATUS } from '../../common/constants';
|
||||
import { securityMock } from '../../../security/server/mocks';
|
||||
|
||||
import supertest from 'supertest';
|
||||
|
||||
import { securityMock } from '../../../../../security/server/mocks';
|
||||
import { API_GET_ILM_POLICY_STATUS } from '../../../../common/constants';
|
||||
import {
|
||||
createMockConfigSchema,
|
||||
createMockLevelLogger,
|
||||
createMockPluginSetup,
|
||||
createMockReportingCore,
|
||||
createMockLevelLogger,
|
||||
} from '../test_helpers';
|
||||
|
||||
import { registerDeprecationsRoutes } from './deprecations';
|
||||
} from '../../../test_helpers';
|
||||
import { registerDeprecationsRoutes } from '../deprecations';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
||||
// https://github.com/elastic/kibana/issues/115881
|
||||
describe.skip(`GET ${API_GET_ILM_POLICY_STATUS}`, () => {
|
||||
describe(`GET ${API_GET_ILM_POLICY_STATUS}`, () => {
|
||||
jest.setTimeout(6000);
|
||||
const reportingSymbol = Symbol('reporting');
|
||||
let server: SetupServerReturn['server'];
|
||||
let httpSetup: SetupServerReturn['httpSetup'];
|
||||
|
@ -56,6 +53,11 @@ describe.skip(`GET ${API_GET_ILM_POLICY_STATUS}`, () => {
|
|||
({ server, httpSetup } = await setupServer(reportingSymbol));
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
jest.restoreAllMocks();
|
||||
await server.stop();
|
||||
});
|
||||
|
||||
it('correctly handles authz when security is unavailable', async () => {
|
||||
const core = await createReportingCore({});
|
||||
|
|
@ -6,19 +6,19 @@
|
|||
*/
|
||||
|
||||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import * as Rx from 'rxjs';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
import supertest from 'supertest';
|
||||
import * as Rx from 'rxjs';
|
||||
import type { ScreenshottingStart } from '../../../../screenshotting/server';
|
||||
import { ReportingCore } from '../..';
|
||||
import { ReportingCore } from '../../../';
|
||||
import type { ScreenshottingStart } from '../../../../../screenshotting/server';
|
||||
import {
|
||||
createMockConfigSchema,
|
||||
createMockLevelLogger,
|
||||
createMockPluginSetup,
|
||||
createMockReportingCore,
|
||||
} from '../../test_helpers';
|
||||
import type { ReportingRequestHandlerContext } from '../../types';
|
||||
import { registerDiagnoseBrowser } from './browser';
|
||||
} from '../../../test_helpers';
|
||||
import type { ReportingRequestHandlerContext } from '../../../types';
|
||||
import { registerDiagnoseBrowser } from '../browser';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
|
@ -8,19 +8,18 @@
|
|||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
import supertest from 'supertest';
|
||||
import { ReportingCore } from '../..';
|
||||
import { ReportingCore } from '../../../';
|
||||
import { generatePngObservable } from '../../../export_types/common';
|
||||
import {
|
||||
createMockReportingCore,
|
||||
createMockConfigSchema,
|
||||
createMockLevelLogger,
|
||||
createMockPluginSetup,
|
||||
createMockConfigSchema,
|
||||
} from '../../test_helpers';
|
||||
import { registerDiagnoseScreenshot } from './screenshot';
|
||||
import type { ReportingRequestHandlerContext } from '../../types';
|
||||
createMockReportingCore,
|
||||
} from '../../../test_helpers';
|
||||
import type { ReportingRequestHandlerContext } from '../../../types';
|
||||
import { registerDiagnoseScreenshot } from '../screenshot';
|
||||
|
||||
jest.mock('../../export_types/common/generate_png');
|
||||
|
||||
import { generatePngObservable } from '../../export_types/common';
|
||||
jest.mock('../../../export_types/common/generate_png');
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
|
@ -5,22 +5,22 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import rison from 'rison-node';
|
||||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import type { DeeplyMockedKeys } from '@kbn/utility-types/jest';
|
||||
import { of } from 'rxjs';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import rison from 'rison-node';
|
||||
import { of } from 'rxjs';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
import supertest from 'supertest';
|
||||
import { ReportingCore } from '../..';
|
||||
import { ExportTypesRegistry } from '../../lib/export_types_registry';
|
||||
import { createMockLevelLogger, createMockReportingCore } from '../../test_helpers';
|
||||
import { ReportingCore } from '../../../';
|
||||
import { ExportTypesRegistry } from '../../../lib/export_types_registry';
|
||||
import { createMockLevelLogger, createMockReportingCore } from '../../../test_helpers';
|
||||
import {
|
||||
createMockConfigSchema,
|
||||
createMockPluginSetup,
|
||||
} from '../../test_helpers/create_mock_reportingplugin';
|
||||
import type { ReportingRequestHandlerContext } from '../../types';
|
||||
import { registerJobGenerationRoutes } from './generate_from_jobparams';
|
||||
} from '../../../test_helpers/create_mock_reportingplugin';
|
||||
import type { ReportingRequestHandlerContext } from '../../../types';
|
||||
import { registerJobGenerationRoutes } from '../generate_from_jobparams';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { ReportingCore } from '..';
|
||||
import { LevelLogger } from '../lib';
|
||||
import { registerDeprecationsRoutes } from './deprecations';
|
||||
import { registerDeprecationsRoutes } from './deprecations/deprecations';
|
||||
import { registerDiagnosticRoutes } from './diagnostic';
|
||||
import {
|
||||
registerGenerateCsvFromSavedObjectImmediate,
|
||||
|
|
|
@ -5,27 +5,27 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
jest.mock('../../lib/content_stream', () => ({
|
||||
jest.mock('../../../lib/content_stream', () => ({
|
||||
getContentStream: jest.fn(),
|
||||
}));
|
||||
|
||||
import { Readable } from 'stream';
|
||||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import type { DeeplyMockedKeys } from '@kbn/utility-types/jest';
|
||||
import { of } from 'rxjs';
|
||||
import { ElasticsearchClient } from 'kibana/server';
|
||||
import { of } from 'rxjs';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
import { Readable } from 'stream';
|
||||
import supertest from 'supertest';
|
||||
import { ReportingCore } from '../..';
|
||||
import { ReportingInternalSetup } from '../../core';
|
||||
import { ContentStream, ExportTypesRegistry, getContentStream } from '../../lib';
|
||||
import { ReportingCore } from '../../../';
|
||||
import { ReportingInternalSetup } from '../../../core';
|
||||
import { ContentStream, ExportTypesRegistry, getContentStream } from '../../../lib';
|
||||
import {
|
||||
createMockConfigSchema,
|
||||
createMockPluginSetup,
|
||||
createMockReportingCore,
|
||||
} from '../../test_helpers';
|
||||
import { ExportTypeDefinition, ReportingRequestHandlerContext } from '../../types';
|
||||
import { registerJobInfoRoutes } from './jobs';
|
||||
} from '../../../test_helpers';
|
||||
import { ExportTypeDefinition, ReportingRequestHandlerContext } from '../../../types';
|
||||
import { registerJobInfoRoutes } from '../jobs';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue