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

FTR - adjust auth for esSupertest in serverless #166745

Merged
merged 3 commits into from
Sep 21, 2023
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
8 changes: 6 additions & 2 deletions test/api_integration/services/supertest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export function KibanaSupertestProvider({ getService }: FtrProviderContext) {
export function ElasticsearchSupertestProvider({ getService }: FtrProviderContext) {
const config = getService('config');
const esServerConfig = config.get('servers.elasticsearch');

// For stateful tests, use system indices user so tests can write to system indices
// For serverless tests, we don't have a system indices user, so we're using the default superuser
const elasticSearchServerUrl = formatUrl({
...esServerConfig,
// Use system indices user so tests can write to system indices
auth: `${systemIndicesSuperuser.username}:${systemIndicesSuperuser.password}`,
...(config.get('serverless')
? []
: { auth: `${systemIndicesSuperuser.username}:${systemIndicesSuperuser.password}` }),
});

let agentOptions = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 ({ getService }: FtrProviderContext) {
const esSupertest = getService('esSupertest');
const svlCommonApi = getService('svlCommonApi');

describe('Elasticsearch API', function () {
it('can request /', async () => {
const { body, status } = await esSupertest.get('/');
svlCommonApi.assertResponseStatusCode(200, status, body);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./scripts_tests'));
loadTestFile(require.resolve('./search_oss'));
loadTestFile(require.resolve('./search_xpack'));
loadTestFile(require.resolve('./elasticsearch_api'));
});
}
6 changes: 5 additions & 1 deletion x-pack/test_serverless/shared/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export default async () => {
protocol: 'https',
certificateAuthorities: process.env.TEST_CLOUD ? undefined : [Fs.readFileSync(CA_CERT_PATH)],
},
elasticsearch: { ...esTestConfig.getUrlParts(), protocol: 'https' },
elasticsearch: {
...esTestConfig.getUrlParts(),
protocol: 'https',
certificateAuthorities: process.env.TEST_CLOUD ? undefined : [Fs.readFileSync(CA_CERT_PATH)],
},
};

// "Fake" SAML provider
Expand Down
Loading