forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cloud Security] Fix serverless quality gate tests and introduce a be…
…tter solution tests that are only run in MKI Serverless Quality Gates (elastic#202038)
- Loading branch information
1 parent
33e9159
commit acba610
Showing
15 changed files
with
184 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...serverless/functional/test_suites/security/config.cloud_security_posture.agentless_api.ts
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
x-pack/test_serverless/functional/test_suites/security/config.mki_only.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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 { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; | ||
import { createTestConfig } from '../../config.base'; | ||
|
||
export default createTestConfig({ | ||
serverlessProject: 'security', | ||
testFiles: [require.resolve('./index.mki_only.ts')], | ||
junit: { | ||
reportName: 'Serverless Security MKI Functional Tests', | ||
}, | ||
suiteTags: { exclude: ['skipSvlSec'] }, | ||
|
||
// include settings from project controller | ||
// https://github.com/elastic/project-controller/blob/main/internal/project/security/config/elasticsearch.yml | ||
esServerArgs: ['xpack.ml.nlp.enabled=true'], | ||
kbnServerArgs: [ | ||
'--xpack.dataUsage.enabled=true', | ||
'--xpack.dataUsage.enableExperimental=[]', | ||
// dataUsage.autoops* config is set in kibana controller | ||
'--xpack.dataUsage.autoops.enabled=true', | ||
'--xpack.dataUsage.autoops.api.url=http://localhost:9000', | ||
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`, | ||
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...s/functional/test_suites/security/ftr/cloud_security_posture/mki_only/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# MKI Serverless Quality Gates | ||
|
||
This folder contains tests that **ONLY** run in the MKI Serverless Quality Gates. These tests are designed to ensure the security and functionality of the system in a serverless environment. | ||
|
||
## Contributing | ||
|
||
Please prefix the tests in this folder with `mki_` so that is clear to the following developer that these tests run only in MKI and Serverless Quality Gates. | ||
|
||
New MKI only test files should be loaded from the root index.ts file of the mki_only directory | ||
|
||
``` | ||
x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/mki_only/index.ts | ||
``` | ||
|
||
If you would like to contribute to these tests, please follow the contribution guidelines outlined in the main project repository. |
104 changes: 104 additions & 0 deletions
104
...al/test_suites/security/ftr/cloud_security_posture/mki_only/agentless/mki_create_agent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import type { FtrProviderContext } from '../../../../../../ftr_provider_context'; | ||
export default function ({ getPageObjects, getService }: FtrProviderContext) { | ||
const testSubjects = getService('testSubjects'); | ||
const pageObjects = getPageObjects([ | ||
'svlCommonPage', | ||
'cspSecurity', | ||
'security', | ||
'header', | ||
'cisAddIntegration', | ||
]); | ||
|
||
const CIS_AWS_OPTION_TEST_ID = 'cisAwsTestId'; | ||
|
||
const AWS_SINGLE_ACCOUNT_TEST_ID = 'awsSingleTestId'; | ||
|
||
// 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 () => { | ||
await pageObjects.svlCommonPage.loginAsAdmin(); | ||
cisIntegration = pageObjects.cisAddIntegration; | ||
}); | ||
|
||
it(`should create agentless-agent`, async () => { | ||
const integrationPolicyName = `cloud_security_posture-${new Date().toISOString()}`; | ||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage( | ||
CLOUD_CREDENTIALS_PACKAGE_VERSION | ||
); | ||
|
||
await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID); | ||
await cisIntegration.clickOptionButton(AWS_SINGLE_ACCOUNT_TEST_ID); | ||
|
||
await cisIntegration.inputIntegrationName(integrationPolicyName); | ||
|
||
await cisIntegration.selectSetupTechnology('agentless'); | ||
await cisIntegration.selectAwsCredentials('direct'); | ||
|
||
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 | ||
); | ||
|
||
await cisIntegration.fillInTextField( | ||
cisIntegration.testSubjectIds.DIRECT_ACCESS_SECRET_KEY_TEST_ID, | ||
process.env.CSPM_AWS_SECRET_KEY | ||
); | ||
} | ||
|
||
await cisIntegration.clickSaveButton(); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
await cisIntegration.navigateToIntegrationCspList(); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
expect(await cisIntegration.getFirstCspmIntegrationPageAgentlessIntegration()).to.be( | ||
integrationPolicyName | ||
); | ||
|
||
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 () => { | ||
const integrationPolicyName = `cloud_security_posture-${new Date().toISOString()}`; | ||
|
||
await cisIntegration.navigateToAddIntegrationCspmWithVersionPage( | ||
CLOUD_CREDENTIALS_PACKAGE_VERSION | ||
); | ||
|
||
await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID); | ||
await cisIntegration.clickOptionButton(AWS_SINGLE_ACCOUNT_TEST_ID); | ||
|
||
await cisIntegration.inputIntegrationName(integrationPolicyName); | ||
|
||
await cisIntegration.clickSaveButton(); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
const agentPolicyName = await cisIntegration.getAgentBasedPolicyValue(); | ||
|
||
await cisIntegration.navigateToIntegrationCspList(); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
|
||
expect(await cisIntegration.getFirstCspmIntegrationPageIntegration()).to.be( | ||
integrationPolicyName | ||
); | ||
expect(await cisIntegration.getFirstCspmIntegrationPageAgent()).to.be(agentPolicyName); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
x-pack/test_serverless/functional/test_suites/security/index.mki_only.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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('serverless security UI MKI only', function () { | ||
this.tags(['security-mki-only ']); | ||
loadTestFile(require.resolve('./ftr/cloud_security_posture/mki_only')); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters