mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Run serverless jest integration with security enabled (#190414)
This commit is contained in:
parent
5ce361170c
commit
211170c3f0
3 changed files with 14 additions and 4 deletions
|
@ -14,6 +14,8 @@ import { REPO_ROOT } from '@kbn/repo-info';
|
|||
import { ToolingLog } from '@kbn/tooling-log';
|
||||
import { esTestConfig } from '@kbn/test';
|
||||
import { CliArgs } from '@kbn/config';
|
||||
import { kibanaDevServiceAccount } from '@kbn/dev-utils';
|
||||
import { systemIndicesSuperuser } from '@kbn/test';
|
||||
import { createRoot, type TestElasticsearchUtils, type TestKibanaUtils } from './create_root';
|
||||
|
||||
export type TestServerlessESUtils = Pick<TestElasticsearchUtils, 'stop' | 'es'> & {
|
||||
|
@ -27,7 +29,6 @@ export interface TestServerlessUtils {
|
|||
}
|
||||
|
||||
const ES_BASE_PATH_DIR = Path.join(REPO_ROOT, '.es/es_test_serverless');
|
||||
|
||||
const projectType: ServerlessProjectType = 'es';
|
||||
|
||||
/**
|
||||
|
@ -97,8 +98,6 @@ function createServerlessES() {
|
|||
kill: true,
|
||||
waitForReady: true,
|
||||
...esServerlessImageParams,
|
||||
// security is enabled by default, if needed kibana requires serviceAccountToken
|
||||
esArgs: ['xpack.security.enabled=false'],
|
||||
});
|
||||
const client = getServerlessESClient({ port: esPort });
|
||||
|
||||
|
@ -116,6 +115,7 @@ const getServerlessESClient = ({ port }: { port: number }) => {
|
|||
return new Client({
|
||||
node: `http://localhost:${port}`,
|
||||
Connection: HttpConnection,
|
||||
auth: { ...systemIndicesSuperuser },
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -130,6 +130,7 @@ const getServerlessDefault = () => {
|
|||
},
|
||||
elasticsearch: {
|
||||
hosts: [`http://localhost:${esTestConfig.getPort()}`],
|
||||
serviceAccountToken: kibanaDevServiceAccount.token,
|
||||
},
|
||||
migrations: {
|
||||
algorithm: 'zdt',
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"@kbn/repo-info",
|
||||
"@kbn/repo-packages",
|
||||
"@kbn/es",
|
||||
"@kbn/dev-utils",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
|
@ -31,7 +31,15 @@ describe('ES capabilities for serverless ES', () => {
|
|||
});
|
||||
|
||||
it('returns the correct capabilities', async () => {
|
||||
const capabilities = await getCapabilitiesFromClient(client);
|
||||
const capabilities = await Promise.race([
|
||||
getCapabilitiesFromClient(client),
|
||||
new Promise((_, reject) =>
|
||||
setTimeout(
|
||||
() => reject('Waited 10+ seconds to get capabilities from ES, timed out...'),
|
||||
10_000
|
||||
)
|
||||
),
|
||||
]);
|
||||
expect(capabilities).toEqual({
|
||||
serverless: true,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue