mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Cloud Security] fix setupTechnology GCP credential type swapping (#210668)](https://github.com/elastic/kibana/pull/210668) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"seanrathier","email":"sean.rathier@gmail.com"},"sourceCommit":{"committedDate":"2025-02-13T19:06:37Z","message":"[Cloud Security] fix setupTechnology GCP credential type swapping (#210668)","sha":"4fe72b62b114d9b12f581ac4938e133eb869529f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Cloud Security","backport:prev-minor","v9.1.0"],"title":"[Cloud Security] fix setupTechnology GCP credential type swapping","number":210668,"url":"https://github.com/elastic/kibana/pull/210668","mergeCommit":{"message":"[Cloud Security] fix setupTechnology GCP credential type swapping (#210668)","sha":"4fe72b62b114d9b12f581ac4938e133eb869529f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210668","number":210668,"mergeCommit":{"message":"[Cloud Security] fix setupTechnology GCP credential type swapping (#210668)","sha":"4fe72b62b114d9b12f581ac4938e133eb869529f"}},{"url":"https://github.com/elastic/kibana/pull/211082","number":211082,"branch":"9.0","state":"OPEN"}]}] BACKPORT-->
This commit is contained in:
parent
a41ccf5bab
commit
4abe538044
14 changed files with 61 additions and 133 deletions
|
@ -63,7 +63,6 @@ import {
|
|||
import { usePackagePolicyList } from '../../common/api/use_package_policy_list';
|
||||
import {
|
||||
GCP_CREDENTIALS_TYPE,
|
||||
GCP_SETUP_ACCESS,
|
||||
gcpField,
|
||||
getInputVarsFields,
|
||||
} from './gcp_credentials_form/gcp_credential_form';
|
||||
|
@ -727,7 +726,7 @@ export const CspPolicyTemplateForm = memo<PackagePolicyReplaceDefineStepExtensio
|
|||
'gcp.credentials.type': {
|
||||
value: isAgentless
|
||||
? GCP_CREDENTIALS_TYPE.CREDENTIALS_JSON
|
||||
: GCP_SETUP_ACCESS.CLOUD_SHELL,
|
||||
: GCP_CREDENTIALS_TYPE.CREDENTIALS_NONE,
|
||||
type: 'text',
|
||||
},
|
||||
},
|
||||
|
|
|
@ -6,3 +6,5 @@
|
|||
*/
|
||||
|
||||
export { usageReportingService } from './usage_reporting_service';
|
||||
export const SECURITY_ES_ARCHIVES_DIR = 'x-pack/test/security_solution_cypress/es_archives';
|
||||
export const AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION = '1.13.0-preview02';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import type { FtrConfigProviderContext } from '@kbn/test';
|
||||
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
|
||||
import { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from './constants';
|
||||
import { pageObjects } from './page_objects';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
|
@ -32,7 +32,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
`--xpack.fleet.agentless.api.tls.ca=${CA_CERT_PATH}`,
|
||||
`--xpack.cloud.id=something-anything`,
|
||||
`--xpack.fleet.packages.0.name=cloud_security_posture`,
|
||||
`--xpack.fleet.packages.0.version=${CLOUD_CREDENTIALS_PACKAGE_VERSION}`,
|
||||
`--xpack.fleet.packages.0.version=${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`,
|
||||
],
|
||||
},
|
||||
// load tests in the index file
|
||||
|
|
|
@ -66,8 +66,6 @@ export const testSubjectIds = {
|
|||
'cloudSecurityGraphGraphInvestigationInvestigateInTimeline',
|
||||
ALERT_TABLE_ROW_CSS_SELECTOR: '[data-test-subj="alertsTable"] .euiDataGridRow',
|
||||
SETUP_TECHNOLOGY_SELECTOR: 'setup-technology-selector',
|
||||
SETUP_TECHNOLOGY_SELECTOR_ACCORDION_TEST_SUBJ: 'setup-technology-selector-accordion',
|
||||
SETUP_TECHNOLOGY_SELECTOR_AGENTLESS_OPTION: 'setup-technology-agentless-option',
|
||||
DIRECT_ACCESS_KEYS: 'direct_access_keys',
|
||||
SETUP_TECHNOLOGY_SELECTOR_AGENTLESS_RADIO: 'setup-technology-agentless-radio',
|
||||
SETUP_TECHNOLOGY_SELECTOR_AGENT_BASED_RADIO: 'setup-technology-agent-based-radio',
|
||||
|
|
|
@ -289,12 +289,16 @@ export function AddCisIntegrationFormPageProvider({
|
|||
await radio.click();
|
||||
};
|
||||
|
||||
const getSetupTechnologyRadio = async (setupTechnology: 'agentless' | 'agent-based') => {
|
||||
const radioGroup = await testSubjects.find(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR);
|
||||
return await radioGroup.findByCssSelector(`input[value='${setupTechnology}']`);
|
||||
};
|
||||
|
||||
const showSetupTechnologyComponent = async () => {
|
||||
return await testSubjects.exists(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR);
|
||||
};
|
||||
|
||||
const selectAwsCredentials = async (credentialType: 'direct' | 'temporary') => {
|
||||
await clickOptionButton(AWS_CREDENTIAL_SELECTOR);
|
||||
await selectValue(
|
||||
AWS_CREDENTIAL_SELECTOR,
|
||||
credentialType === 'direct' ? 'direct_access_keys' : 'temporary_keys'
|
||||
|
@ -415,7 +419,7 @@ export function AddCisIntegrationFormPageProvider({
|
|||
|
||||
await clickOptionButton(testSubjectIds.CIS_AWS_OPTION_TEST_ID);
|
||||
|
||||
await clickOptionButton(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR_AGENTLESS_RADIO);
|
||||
await selectSetupTechnology('agentless');
|
||||
await selectValue(testSubjectIds.AWS_CREDENTIAL_SELECTOR, 'direct_access_keys');
|
||||
await fillInTextField(testSubjectIds.DIRECT_ACCESS_KEY_ID_TEST_ID, directAccessKeyId);
|
||||
await fillInTextField(testSubjectIds.DIRECT_ACCESS_SECRET_KEY_TEST_ID, directAccessSecretKey);
|
||||
|
@ -427,7 +431,7 @@ export function AddCisIntegrationFormPageProvider({
|
|||
|
||||
await clickOptionButton(testSubjectIds.CIS_GCP_OPTION_TEST_ID);
|
||||
await clickOptionButton(testSubjectIds.GCP_SINGLE_ACCOUNT_TEST_ID);
|
||||
await clickOptionButton(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR_AGENTLESS_RADIO);
|
||||
await selectSetupTechnology('agentless');
|
||||
await fillInTextField(testSubjectIds.PRJ_ID_TEST_ID, projectId);
|
||||
await fillInTextField(testSubjectIds.CREDENTIALS_JSON_TEST_ID, credentialJson);
|
||||
};
|
||||
|
@ -452,6 +456,8 @@ export function AddCisIntegrationFormPageProvider({
|
|||
await navigateToAddIntegrationCspmPage();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await inputIntegrationName(`cloud_security_posture-${new Date().toISOString()}`);
|
||||
|
||||
await fillOutForm(cloudProvider);
|
||||
|
||||
// Click Save Button to create the Integration then navigate to Integration Policies Tab Page
|
||||
|
@ -469,6 +475,12 @@ export function AddCisIntegrationFormPageProvider({
|
|||
// Fill out form to edit an agentless integration
|
||||
await fillInTextField(testSubjectId, value);
|
||||
|
||||
// TechDebt: This is a workaround to ensure the form is saved
|
||||
// const agentlessRadio = await getSetupTechnologyRadio('agentless');
|
||||
// const agentBasedRadio = await getSetupTechnologyRadio('agent-based');
|
||||
// expect(await agentlessRadio.isEnabled()).to.be(true);
|
||||
// expect(agentBasedRadio.isEnabled()).to.be(true);
|
||||
|
||||
// Clicking Save Button updates and navigates to Integration Policies Tab Page
|
||||
await clickSaveIntegrationButton();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
@ -559,6 +571,7 @@ export function AddCisIntegrationFormPageProvider({
|
|||
clickOptionButton,
|
||||
selectAwsCredentials,
|
||||
selectSetupTechnology,
|
||||
getSetupTechnologyRadio,
|
||||
clickSaveButton,
|
||||
clickSaveIntegrationButton,
|
||||
clickAccordianButton,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants';
|
||||
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from './constants';
|
||||
import { createTestConfig } from '../../config.base';
|
||||
|
||||
// TODO: Remove the agentless default config once Serverless API is merged and default policy is deleted
|
||||
|
@ -17,7 +17,7 @@ export default createTestConfig({
|
|||
},
|
||||
kbnServerArgs: [
|
||||
`--xpack.fleet.packages.0.name=cloud_security_posture`,
|
||||
`--xpack.fleet.packages.0.version=${CLOUD_CREDENTIALS_PACKAGE_VERSION}`,
|
||||
`--xpack.fleet.packages.0.version=${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`,
|
||||
`--xpack.fleet.agentless.enabled=true`,
|
||||
`--xpack.fleet.agents.fleet_server.hosts=["https://ftr.kibana:8220"]`,
|
||||
`--xpack.fleet.internal.fleetServerStandalone=true`,
|
||||
|
|
|
@ -1,34 +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 { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants';
|
||||
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
|
||||
import { createTestConfig } from '../../config.base';
|
||||
|
||||
export default createTestConfig({
|
||||
serverlessProject: 'security',
|
||||
junit: {
|
||||
reportName: 'Serverless Security Cloud Security Agentless API Onboarding Functional Tests',
|
||||
},
|
||||
kbnServerArgs: [
|
||||
`--xpack.fleet.packages.0.name=cloud_security_posture`,
|
||||
`--xpack.fleet.packages.0.version=${CLOUD_CREDENTIALS_PACKAGE_VERSION}`,
|
||||
|
||||
`--xpack.fleet.agents.fleet_server.hosts=["https://ftr.kibana:8220"]`,
|
||||
`--xpack.fleet.internal.fleetServerStandalone=true`,
|
||||
|
||||
// Agentless Configuration based on Serverless Security Dev Yaml - config/serverless.security.dev.yml
|
||||
`--xpack.fleet.agentless.enabled=true`,
|
||||
`--xpack.fleet.agentless.api.url=http://localhost:8089`,
|
||||
`--xpack.fleet.agentless.api.tls.certificate=${KBN_CERT_PATH}`,
|
||||
`--xpack.fleet.agentless.api.tls.key=${KBN_KEY_PATH}`,
|
||||
`--xpack.fleet.agentless.api.tls.ca=${CA_CERT_PATH}`,
|
||||
`--xpack.cloud.serverless.project_id=some_fake_project_id`,
|
||||
],
|
||||
// load tests in the index file
|
||||
testFiles: [require.resolve('./ftr/cloud_security_posture/agentless_api')],
|
||||
});
|
|
@ -4,11 +4,11 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants';
|
||||
import expect from '@kbn/expect';
|
||||
import * as http from 'http';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from '../../../constants';
|
||||
import type { FtrProviderContext } from '../../../../../ftr_provider_context';
|
||||
import { setupMockServer } from '../agentless_api/mock_agentless_api';
|
||||
import { setupMockServer } from './mock_agentless_api';
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const mockAgentlessApiService = setupMockServer();
|
||||
const pageObjects = getPageObjects([
|
||||
|
@ -39,7 +39,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
after(async () => {
|
||||
await supertest
|
||||
.delete(
|
||||
`/api/fleet/epm/packages/cloud_security_posture/${CLOUD_CREDENTIALS_PACKAGE_VERSION}`
|
||||
`/api/fleet/epm/packages/cloud_security_posture/${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`
|
||||
)
|
||||
.set('kbn-xsrf', 'xxxx')
|
||||
.send({ force: true })
|
||||
|
@ -48,18 +48,22 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
describe('Serverless - Agentless CIS_AWS Single Account Launch Cloud formation', () => {
|
||||
it(`should show CIS_AWS Launch Cloud formation button when credentials selector is direct access keys and package version is ${CLOUD_CREDENTIALS_PACKAGE_VERSION}`, async () => {
|
||||
it(`should show CIS_AWS Launch Cloud formation button when credentials selector is direct access keys and package version is ${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`, async () => {
|
||||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage(
|
||||
CLOUD_CREDENTIALS_PACKAGE_VERSION
|
||||
AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION
|
||||
);
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await cisIntegration.clickOptionButton(testSubjectIds.CIS_AWS_OPTION_TEST_ID);
|
||||
await cisIntegration.clickOptionButton(testSubjectIds.AWS_SINGLE_ACCOUNT_TEST_ID);
|
||||
|
||||
await cisIntegration.selectSetupTechnology('agentless');
|
||||
await cisIntegration.selectAwsCredentials('direct');
|
||||
await cisIntegration.inputIntegrationName(
|
||||
`cloud_security_posture-${new Date().toISOString()}`
|
||||
);
|
||||
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
await cisIntegration.selectSetupTechnology('agentless');
|
||||
|
||||
await cisIntegration.selectAwsCredentials('direct');
|
||||
|
||||
expect(
|
||||
(await cisIntegrationAws.showLaunchCloudFormationAgentlessButton()) !== undefined
|
||||
|
@ -68,27 +72,22 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
describe('Serverless - Agentless CIS_AWS ORG Account Launch Cloud formation', () => {
|
||||
// tech debt: this test is failing because the credentials select is not working as expected
|
||||
// https://github.com/orgs/elastic/projects/705/views/92?sliceBy%5Bvalue%5D=Agentless+-+API+-+ESS&pane=issue&itemId=73261952
|
||||
it.skip(`should show CIS_AWS Launch Cloud formation button when credentials selector is direct access keys and package version is ${CLOUD_CREDENTIALS_PACKAGE_VERSION}`, async () => {
|
||||
it(`should show CIS_AWS Launch Cloud formation button when credentials selector is direct access keys and package version is ${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`, async () => {
|
||||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage(
|
||||
CLOUD_CREDENTIALS_PACKAGE_VERSION
|
||||
AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION
|
||||
);
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await cisIntegration.clickOptionButton(testSubjectIds.CIS_AWS_OPTION_TEST_ID);
|
||||
|
||||
await cisIntegration.selectSetupTechnology('agentless');
|
||||
|
||||
await cisIntegration.selectAwsCredentials('direct');
|
||||
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
expect(await cisIntegrationAws.showLaunchCloudFormationAgentlessButton()).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: Migrate test after Serverless default agentless policy is deleted.
|
||||
describe.skip('Serverless - Agentless CIS_AWS edit flow', () => {
|
||||
describe('Serverless - Agentless CIS_AWS edit flow', () => {
|
||||
it(`user should save and edit agentless integration policy`, async () => {
|
||||
const newDirectAccessKeyId = `newDirectAccessKey`;
|
||||
|
||||
|
@ -109,15 +108,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
)
|
||||
).to.be(newDirectAccessKeyId);
|
||||
expect(await cisIntegrationAws.showLaunchCloudFormationAgentlessButton()).to.be(true);
|
||||
expect(await cisIntegration.getElementText(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR)).to.be(
|
||||
'Agentless\nBETA'
|
||||
);
|
||||
expect(
|
||||
await cisIntegration.getFieldAttributeValue(
|
||||
testSubjectIds.SETUP_TECHNOLOGY_SELECTOR,
|
||||
'disabled'
|
||||
)
|
||||
).to.be('true');
|
||||
});
|
||||
});
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/191017
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { CLOUD_CREDENTIALS_PACKAGE_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants';
|
||||
import * as http from 'http';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from '../../../constants';
|
||||
import type { FtrProviderContext } from '../../../../../ftr_provider_context';
|
||||
import { setupMockServer } from '../agentless_api/mock_agentless_api';
|
||||
import { setupMockServer } from './mock_agentless_api';
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const pageObjects = getPageObjects(['common', 'svlCommonPage', 'cisAddIntegration', 'header']);
|
||||
|
||||
|
@ -36,7 +36,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
after(async () => {
|
||||
await supertest
|
||||
.delete(
|
||||
`/api/fleet/epm/packages/cloud_security_posture/${CLOUD_CREDENTIALS_PACKAGE_VERSION}`
|
||||
`/api/fleet/epm/packages/cloud_security_posture/${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`
|
||||
)
|
||||
.set('kbn-xsrf', 'xxxx')
|
||||
.send({ force: true })
|
||||
|
@ -44,10 +44,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
mockApiServer.close();
|
||||
});
|
||||
|
||||
describe.skip('Agentless CIS_GCP Single Account Launch Cloud shell', () => {
|
||||
it(`should show CIS_GCP Launch Cloud Shell button when package version is ${CLOUD_CREDENTIALS_PACKAGE_VERSION}`, async () => {
|
||||
describe('Agentless CIS_GCP Single Account Launch Cloud shell', () => {
|
||||
it(`should show CIS_GCP Launch Cloud Shell button when package version is ${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`, async () => {
|
||||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage(
|
||||
CLOUD_CREDENTIALS_PACKAGE_VERSION
|
||||
AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION
|
||||
);
|
||||
|
||||
await cisIntegration.clickOptionButton(testSubjectIds.CIS_GCP_OPTION_TEST_ID);
|
||||
|
@ -61,10 +61,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip('Agentless CIS_GCP ORG Account Launch Cloud Shell', () => {
|
||||
it(`should show CIS_GCP Launch Cloud Shell button when package version is ${CLOUD_CREDENTIALS_PACKAGE_VERSION}`, async () => {
|
||||
describe('Agentless CIS_GCP ORG Account Launch Cloud Shell', () => {
|
||||
it(`should show CIS_GCP Launch Cloud Shell button when package version is ${AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION}`, async () => {
|
||||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage(
|
||||
CLOUD_CREDENTIALS_PACKAGE_VERSION
|
||||
AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION
|
||||
);
|
||||
|
||||
await cisIntegration.clickOptionButton(testSubjectIds.CIS_GCP_OPTION_TEST_ID);
|
||||
|
@ -97,16 +97,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
'value'
|
||||
)
|
||||
).to.be(newCredentialsJSON);
|
||||
expect(await cisIntegrationGcp.showLaunchCloudShellAgentlessButton()).to.be(true);
|
||||
expect(await cisIntegration.getElementText(testSubjectIds.SETUP_TECHNOLOGY_SELECTOR)).to.be(
|
||||
'Agentless\nBETA'
|
||||
);
|
||||
expect(
|
||||
await cisIntegration.getFieldAttributeValue(
|
||||
testSubjectIds.SETUP_TECHNOLOGY_SELECTOR,
|
||||
'disabled'
|
||||
)
|
||||
).to.be('true');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +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 { FtrProviderContext } from '../../../../../ftr_provider_context';
|
||||
|
||||
export default function ({ loadTestFile }: FtrProviderContext) {
|
||||
describe('cloud_security_posture', function () {
|
||||
this.tags(['failsOnMKI', 'cloud_security_posture']);
|
||||
loadTestFile(require.resolve('./create_agent'));
|
||||
});
|
||||
}
|
|
@ -5,13 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import * as http from 'http';
|
||||
import expect from '@kbn/expect';
|
||||
import { setupMockServer } from './mock_agentless_api';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from './constants';
|
||||
import type { FtrProviderContext } from '../../../../../ftr_provider_context';
|
||||
import { AGENTLESS_SECURITY_POSTURE_PACKAGE_VERSION } from '../../../../constants';
|
||||
import type { FtrProviderContext } from '../../../../../../ftr_provider_context';
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const mockAgentlessApiService = setupMockServer();
|
||||
const testSubjects = getService('testSubjects');
|
||||
const pageObjects = getPageObjects([
|
||||
'svlCommonPage',
|
||||
'cspSecurity',
|
||||
|
@ -24,22 +22,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
const AWS_SINGLE_ACCOUNT_TEST_ID = 'awsSingleTestId';
|
||||
|
||||
describe('Agentless API Serverless', function () {
|
||||
let mockApiServer: http.Server;
|
||||
// This test suite is only running in the Serverless Quality Gates environment
|
||||
describe('Agentless API Serverless MKI only', function () {
|
||||
this.tags(['cloud_security_posture_agentless']);
|
||||
let cisIntegration: typeof pageObjects.cisAddIntegration;
|
||||
|
||||
before(async () => {
|
||||
// If process.env.TEST_CLOUD is set, then the test is running in the Serverless Quality Gates
|
||||
// and this MSW server will be listening for a request that will never come.
|
||||
mockApiServer = mockAgentlessApiService.listen(8089); // Start the usage api mock server on port 8089
|
||||
await pageObjects.svlCommonPage.loginAsAdmin();
|
||||
cisIntegration = pageObjects.cisAddIntegration;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
mockApiServer.close();
|
||||
});
|
||||
|
||||
it(`should create agentless-agent`, async () => {
|
||||
const integrationPolicyName = `cloud_security_posture-${new Date().toISOString()}`;
|
||||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage(
|
||||
|
@ -54,11 +46,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
await cisIntegration.selectSetupTechnology('agentless');
|
||||
await cisIntegration.selectAwsCredentials('direct');
|
||||
|
||||
if (
|
||||
process.env.TEST_CLOUD &&
|
||||
process.env.CSPM_AWS_ACCOUNT_ID &&
|
||||
process.env.CSPM_AWS_SECRET_KEY
|
||||
) {
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
if (process.env.CSPM_AWS_ACCOUNT_ID && process.env.CSPM_AWS_SECRET_KEY) {
|
||||
await cisIntegration.fillInTextField(
|
||||
cisIntegration.testSubjectIds.DIRECT_ACCESS_KEY_ID_TEST_ID,
|
||||
process.env.CSPM_AWS_ACCOUNT_ID
|
||||
|
@ -70,8 +60,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
);
|
||||
}
|
||||
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await cisIntegration.clickSaveButton();
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
|
@ -81,7 +69,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessIntegration()).to.be(
|
||||
integrationPolicyName
|
||||
);
|
||||
expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessStatus()).to.be('Pending');
|
||||
|
||||
const agentStatusBadge = testSubjects.find('agentlessStatusBadge');
|
||||
// The status badge could be either "Pending", "Healthy", or "Unhealthy" so we are just checking that it exists
|
||||
expect(agentStatusBadge).to.be.ok();
|
||||
});
|
||||
|
||||
it(`should create default agent-based agent`, async () => {
|
|
@ -8,8 +8,6 @@
|
|||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function ({ loadTestFile }: FtrProviderContext) {
|
||||
const isCloud = !!process.env.TEST_CLOUD;
|
||||
|
||||
describe('serverless security UI', function () {
|
||||
this.tags(['esGate']);
|
||||
|
||||
|
@ -17,9 +15,5 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./ftr/cases'));
|
||||
loadTestFile(require.resolve('./ftr/advanced_settings'));
|
||||
loadTestFile(require.resolve('./ml'));
|
||||
if (isCloud) {
|
||||
// only run the agentless API tests in the Serverless Quality Gates
|
||||
loadTestFile(require.resolve('./ftr/cloud_security_posture/agentless_api'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue