Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Siem Migrations] GET /integrations integration Test (#213251) #213357

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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 '@kbn/expect';
import { FtrProviderContext } from '../../../../ftr_provider_context';
import { migrationRulesRouteHelpersFactory } from '../../utils';

export default ({ getService }: FtrProviderContext) => {
const supertest = getService('supertest');
const migrationRulesRoutes = migrationRulesRouteHelpersFactory(supertest);

describe('Get Integrations', () => {
it('should return all integrations successfully', async () => {
const response = await migrationRulesRoutes.getIntegrations({});

const integrationsObj = response.body;
const integrationIds = Object.keys(integrationsObj);

expect(integrationIds.length).to.be.greaterThan(0);
expect(integrationsObj[integrationIds[0]]).to.have.keys('package', 'version');
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./update'));
loadTestFile(require.resolve('./start'));
loadTestFile(require.resolve('./stop'));
loadTestFile(require.resolve('./get_integrations'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import {
SIEM_RULE_MIGRATION_STATS_PATH,
SIEM_RULE_MIGRATION_TRANSLATION_STATS_PATH,
SIEM_RULE_MIGRATION_STOP_PATH,
SIEM_RULE_MIGRATIONS_INTEGRATIONS_PATH,
} from '@kbn/security-solution-plugin/common/siem_migrations/constants';
import {
CreateRuleMigrationResponse,
GetAllStatsRuleMigrationResponse,
GetRuleMigrationIntegrationsResponse,
GetRuleMigrationPrebuiltRulesResponse,
GetRuleMigrationRequestQuery,
GetRuleMigrationResponse,
Expand Down Expand Up @@ -262,5 +264,22 @@ export const migrationRulesRouteHelpersFactory = (supertest: SuperTest.Agent) =>

return response;
},

getIntegrations: async ({
expectStatusCode = 200,
}: RequestParams): Promise<{
body: GetRuleMigrationIntegrationsResponse;
}> => {
const response = await supertest
.get(SIEM_RULE_MIGRATIONS_INTEGRATIONS_PATH)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, API_VERSIONS.internal.v1)
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send();

assertStatusCode(expectStatusCode, response);

return response;
},
};
};